From db13c23186ea028e2cef51f57f75269acf56f262 Mon Sep 17 00:00:00 2001 From: Milan Burda Date: Wed, 17 Oct 2018 05:02:11 +0200 Subject: [PATCH] refactor: move devtools from brightray to atom --- atom/browser/api/atom_api_browser_window.h | 2 +- .../api/atom_api_browser_window_mac.mm | 5 +- atom/browser/api/atom_api_web_contents.cc | 4 +- atom/browser/api/atom_api_web_contents.h | 5 +- .../browser/api/atom_api_web_contents_view.cc | 4 +- atom/browser/api/atom_api_web_contents_view.h | 8 +-- atom/browser/atom_browser_client.cc | 11 ++++ atom/browser/atom_browser_client.h | 5 +- atom/browser/atom_browser_context.cc | 4 +- atom/browser/atom_browser_main_parts.cc | 19 +++--- atom/browser/atom_browser_main_parts.h | 12 ++-- .../browser/atom_web_ui_controller_factory.cc | 17 ++++- atom/browser/common_web_contents_delegate.cc | 13 ++-- atom/browser/common_web_contents_delegate.h | 17 +++-- .../common_web_contents_delegate_mac.mm | 2 +- atom/browser/native_browser_view.cc | 7 +-- atom/browser/native_browser_view.h | 19 +++--- atom/browser/native_browser_view_mac.h | 2 +- atom/browser/native_browser_view_mac.mm | 8 +-- atom/browser/native_browser_view_views.cc | 6 +- atom/browser/native_browser_view_views.h | 2 +- atom/browser/native_window_mac.mm | 4 +- atom/browser/native_window_views.cc | 4 +- .../atom_inspectable_web_contents_view.h | 17 +++-- .../atom_inspectable_web_contents_view.mm | 16 +++-- atom/browser/ui/cocoa/atom_ns_window.h | 2 +- .../ui/cocoa}/event_dispatching_window.h | 6 +- .../ui/cocoa}/event_dispatching_window.mm | 2 +- .../browser/ui}/devtools_manager_delegate.cc | 6 +- .../browser/ui}/devtools_manager_delegate.h | 10 +-- .../browser/ui}/devtools_ui.cc | 6 +- .../browser => atom/browser/ui}/devtools_ui.h | 10 +-- atom/browser/ui/inspectable_web_contents.cc | 19 ++++++ .../browser/ui}/inspectable_web_contents.h | 15 +++-- .../ui}/inspectable_web_contents_delegate.h | 15 +++-- .../ui}/inspectable_web_contents_impl.cc | 14 ++--- .../ui}/inspectable_web_contents_impl.h | 12 ++-- .../ui}/inspectable_web_contents_view.h | 15 +++-- .../inspectable_web_contents_view_delegate.cc | 14 +++++ .../inspectable_web_contents_view_delegate.h | 15 +++-- .../ui}/inspectable_web_contents_view_mac.h | 21 ++++--- .../ui}/inspectable_web_contents_view_mac.mm | 19 +++--- .../browser/ui/views/atom_views_delegate.cc | 6 +- .../browser/ui/views/atom_views_delegate.h | 10 +-- .../inspectable_web_contents_view_views.cc | 16 +++-- .../inspectable_web_contents_view_views.h | 16 +++-- brightray/BUILD.gn | 46 -------------- brightray/browser/browser_client.cc | 16 ----- brightray/browser/browser_client.h | 5 -- brightray/browser/browser_main_parts.cc | 12 ---- brightray/browser/browser_main_parts.h | 1 - brightray/browser/inspectable_web_contents.cc | 14 ----- .../inspectable_web_contents_view_delegate.cc | 9 --- .../browser/web_ui_controller_factory.cc | 62 ------------------- brightray/browser/web_ui_controller_factory.h | 48 -------------- chromium_src/BUILD.gn | 6 ++ filenames.gni | 22 +++++++ script/lint.js | 4 +- 58 files changed, 311 insertions(+), 396 deletions(-) rename brightray/browser/mac/bry_inspectable_web_contents_view.h => atom/browser/ui/cocoa/atom_inspectable_web_contents_view.h (59%) rename brightray/browser/mac/bry_inspectable_web_contents_view.mm => atom/browser/ui/cocoa/atom_inspectable_web_contents_view.mm (93%) rename {brightray/browser/mac => atom/browser/ui/cocoa}/event_dispatching_window.h (66%) rename {brightray/browser/mac => atom/browser/ui/cocoa}/event_dispatching_window.mm (92%) rename {brightray/browser => atom/browser/ui}/devtools_manager_delegate.cc (97%) rename {brightray/browser => atom/browser/ui}/devtools_manager_delegate.h (83%) rename {brightray/browser => atom/browser/ui}/devtools_ui.cc (97%) rename {brightray/browser => atom/browser/ui}/devtools_ui.h (76%) create mode 100644 atom/browser/ui/inspectable_web_contents.cc rename {brightray/browser => atom/browser/ui}/inspectable_web_contents.h (79%) rename {brightray/browser => atom/browser/ui}/inspectable_web_contents_delegate.h (72%) rename {brightray/browser => atom/browser/ui}/inspectable_web_contents_impl.cc (98%) rename {brightray/browser => atom/browser/ui}/inspectable_web_contents_impl.h (97%) rename {brightray/browser => atom/browser/ui}/inspectable_web_contents_view.h (75%) create mode 100644 atom/browser/ui/inspectable_web_contents_view_delegate.cc rename {brightray/browser => atom/browser/ui}/inspectable_web_contents_view_delegate.h (53%) rename {brightray/browser => atom/browser/ui}/inspectable_web_contents_view_mac.h (60%) rename {brightray/browser => atom/browser/ui}/inspectable_web_contents_view_mac.mm (72%) rename brightray/browser/views/views_delegate.cc => atom/browser/ui/views/atom_views_delegate.cc (97%) rename brightray/browser/views/views_delegate.h => atom/browser/ui/views/atom_views_delegate.h (90%) rename {brightray/browser => atom/browser/ui}/views/inspectable_web_contents_view_views.cc (93%) rename {brightray/browser => atom/browser/ui}/views/inspectable_web_contents_view_views.h (77%) delete mode 100644 brightray/browser/inspectable_web_contents.cc delete mode 100644 brightray/browser/inspectable_web_contents_view_delegate.cc delete mode 100644 brightray/browser/web_ui_controller_factory.cc delete mode 100644 brightray/browser/web_ui_controller_factory.h diff --git a/atom/browser/api/atom_api_browser_window.h b/atom/browser/api/atom_api_browser_window.h index 79a0737d7704b..074fcab7c06b3 100644 --- a/atom/browser/api/atom_api_browser_window.h +++ b/atom/browser/api/atom_api_browser_window.h @@ -82,7 +82,7 @@ class BrowserWindow : public TopLevelWindow, private: #if defined(OS_MACOSX) - void OverrideNSWindowContentView(brightray::InspectableWebContents* iwc); + void OverrideNSWindowContentView(InspectableWebContents* iwc); #endif // Helpers. diff --git a/atom/browser/api/atom_api_browser_window_mac.mm b/atom/browser/api/atom_api_browser_window_mac.mm index f6238ee8167e2..beca4dc7d16b0 100644 --- a/atom/browser/api/atom_api_browser_window_mac.mm +++ b/atom/browser/api/atom_api_browser_window_mac.mm @@ -8,9 +8,9 @@ #include "atom/browser/native_browser_view.h" #include "atom/browser/native_window_mac.h" +#include "atom/browser/ui/inspectable_web_contents_view.h" #include "atom/common/draggable_region.h" #include "base/mac/scoped_nsobject.h" -#include "brightray/browser/inspectable_web_contents_view.h" @interface NSView (WebContentsView) - (void)setMouseDownCanMoveWindow:(BOOL)can_move; @@ -55,8 +55,7 @@ - (NSView*)hitTest:(NSPoint)aPoint { } // namespace -void BrowserWindow::OverrideNSWindowContentView( - brightray::InspectableWebContents* iwc) { +void BrowserWindow::OverrideNSWindowContentView(InspectableWebContents* iwc) { // Make NativeWindow use a NSView as content view. static_cast(window())->OverrideNSWindowContentView(); // Add webview to contentView. diff --git a/atom/browser/api/atom_api_web_contents.cc b/atom/browser/api/atom_api_web_contents.cc index 4bbf6f579feb8..ec9f109c63f9e 100644 --- a/atom/browser/api/atom_api_web_contents.cc +++ b/atom/browser/api/atom_api_web_contents.cc @@ -22,6 +22,8 @@ #include "atom/browser/native_window.h" #include "atom/browser/net/atom_network_delegate.h" #include "atom/browser/ui/drag_util.h" +#include "atom/browser/ui/inspectable_web_contents.h" +#include "atom/browser/ui/inspectable_web_contents_view.h" #include "atom/browser/web_contents_permission_helper.h" #include "atom/browser/web_contents_preferences.h" #include "atom/browser/web_contents_zoom_controller.h" @@ -48,8 +50,6 @@ #include "base/threading/thread_restrictions.h" #include "base/threading/thread_task_runner_handle.h" #include "base/values.h" -#include "brightray/browser/inspectable_web_contents.h" -#include "brightray/browser/inspectable_web_contents_view.h" #include "chrome/browser/browser_process.h" #include "chrome/browser/ssl/security_state_tab_helper.h" #include "content/browser/frame_host/frame_tree_node.h" diff --git a/atom/browser/api/atom_api_web_contents.h b/atom/browser/api/atom_api_web_contents.h index 0dc47ab26a9d1..5586321326ff6 100644 --- a/atom/browser/api/atom_api_web_contents.h +++ b/atom/browser/api/atom_api_web_contents.h @@ -29,10 +29,6 @@ namespace blink { struct WebDeviceEmulationParams; } -namespace brightray { -class InspectableWebContents; -} - namespace mate { class Arguments; class Dictionary; @@ -46,6 +42,7 @@ namespace atom { class AtomBrowserContext; class AtomJavaScriptDialogManager; +class InspectableWebContents; class WebContentsZoomController; class WebViewGuestDelegate; class FrameSubscriber; diff --git a/atom/browser/api/atom_api_web_contents_view.cc b/atom/browser/api/atom_api_web_contents_view.cc index 60d04ff936bae..5abdac0a1ea1f 100644 --- a/atom/browser/api/atom_api_web_contents_view.cc +++ b/atom/browser/api/atom_api_web_contents_view.cc @@ -5,8 +5,8 @@ #include "atom/browser/api/atom_api_web_contents_view.h" #include "atom/browser/api/atom_api_web_contents.h" +#include "atom/browser/ui/inspectable_web_contents_view.h" #include "atom/common/api/constructor.h" -#include "brightray/browser/inspectable_web_contents_view.h" #include "content/public/browser/web_contents_user_data.h" #include "native_mate/dictionary.h" @@ -43,7 +43,7 @@ namespace api { WebContentsView::WebContentsView(v8::Isolate* isolate, mate::Handle web_contents, - brightray::InspectableWebContents* iwc) + InspectableWebContents* iwc) #if defined(OS_MACOSX) : View(new DelayedNativeViewHost(iwc->GetView()->GetNativeView())), #else diff --git a/atom/browser/api/atom_api_web_contents_view.h b/atom/browser/api/atom_api_web_contents_view.h index d502918a155a8..b4ec1b6d73d85 100644 --- a/atom/browser/api/atom_api_web_contents_view.h +++ b/atom/browser/api/atom_api_web_contents_view.h @@ -9,12 +9,10 @@ #include "content/public/browser/web_contents_observer.h" #include "native_mate/handle.h" -namespace brightray { -class InspectableWebContents; -} - namespace atom { +class InspectableWebContents; + namespace api { class WebContents; @@ -30,7 +28,7 @@ class WebContentsView : public View, public content::WebContentsObserver { protected: WebContentsView(v8::Isolate* isolate, mate::Handle web_contents, - brightray::InspectableWebContents* iwc); + InspectableWebContents* iwc); ~WebContentsView() override; // content::WebContentsObserver: diff --git a/atom/browser/atom_browser_client.cc b/atom/browser/atom_browser_client.cc index 2d195818f6a63..a79bb5a1d3a4a 100644 --- a/atom/browser/atom_browser_client.cc +++ b/atom/browser/atom_browser_client.cc @@ -26,6 +26,7 @@ #include "atom/browser/notifications/notification_presenter.h" #include "atom/browser/notifications/platform_notification_service.h" #include "atom/browser/session_preferences.h" +#include "atom/browser/ui/devtools_manager_delegate.h" #include "atom/browser/web_contents_permission_helper.h" #include "atom/browser/web_contents_preferences.h" #include "atom/browser/window_list.h" @@ -494,6 +495,11 @@ void AtomBrowserClient::GetAdditionalAllowedSchemesForFileSystem( additional_schemes->push_back(content::kChromeDevToolsScheme); } +void AtomBrowserClient::GetAdditionalWebUISchemes( + std::vector* additional_schemes) { + additional_schemes->push_back(content::kChromeDevToolsScheme); +} + void AtomBrowserClient::SiteInstanceDeleting( content::SiteInstance* site_instance) { // We are storing weak_ptr, is it fundamental to maintain the map up-to-date @@ -677,6 +683,11 @@ AtomBrowserClient::CreateThrottlesForNavigation( return throttles; } +content::DevToolsManagerDelegate* +AtomBrowserClient::GetDevToolsManagerDelegate() { + return new DevToolsManagerDelegate; +} + NotificationPresenter* AtomBrowserClient::GetNotificationPresenter() { if (!notification_presenter_) { notification_presenter_.reset(NotificationPresenter::Create()); diff --git a/atom/browser/atom_browser_client.h b/atom/browser/atom_browser_client.h index d182862e96cc5..d4a018b0334a5 100644 --- a/atom/browser/atom_browser_client.h +++ b/atom/browser/atom_browser_client.h @@ -111,7 +111,9 @@ class AtomBrowserClient : public brightray::BrowserClient, bool opener_suppressed, bool* no_javascript_access) override; void GetAdditionalAllowedSchemesForFileSystem( - std::vector* schemes) override; + std::vector* additional_schemes) override; + void GetAdditionalWebUISchemes( + std::vector* additional_schemes) override; void SiteInstanceDeleting(content::SiteInstance* site_instance) override; std::unique_ptr CreateClientCertStore( content::ResourceContext* resource_context) override; @@ -125,6 +127,7 @@ class AtomBrowserClient : public brightray::BrowserClient, std::unique_ptr GetServiceManifestOverlay( base::StringPiece name) override; net::NetLog* GetNetLog() override; + content::DevToolsManagerDelegate* GetDevToolsManagerDelegate() override; content::PlatformNotificationService* GetPlatformNotificationService() override; diff --git a/atom/browser/atom_browser_context.cc b/atom/browser/atom_browser_context.cc index dbd42a75af070..3cebe4f4e7226 100644 --- a/atom/browser/atom_browser_context.cc +++ b/atom/browser/atom_browser_context.cc @@ -15,6 +15,7 @@ #include "atom/browser/net/resolve_proxy_helper.h" #include "atom/browser/pref_store_delegate.h" #include "atom/browser/special_storage_policy.h" +#include "atom/browser/ui/inspectable_web_contents_impl.h" #include "atom/browser/web_view_manager.h" #include "atom/common/atom_version.h" #include "atom/common/chrome_version.h" @@ -27,7 +28,6 @@ #include "base/threading/sequenced_task_runner_handle.h" #include "base/threading/thread_restrictions.h" #include "brightray/browser/brightray_paths.h" -#include "brightray/browser/inspectable_web_contents_impl.h" #include "brightray/browser/zoom_level_delegate.h" #include "brightray/common/application_info.h" #include "chrome/common/chrome_paths.h" @@ -152,7 +152,7 @@ void AtomBrowserContext::InitPrefs() { registry->RegisterFilePathPref(prefs::kDownloadDefaultDirectory, download_dir); registry->RegisterDictionaryPref(prefs::kDevToolsFileSystemPaths); - brightray::InspectableWebContentsImpl::RegisterPrefs(registry.get()); + InspectableWebContentsImpl::RegisterPrefs(registry.get()); brightray::MediaDeviceIDSalt::RegisterPrefs(registry.get()); brightray::ZoomLevelDelegate::RegisterPrefs(registry.get()); PrefProxyConfigTrackerImpl::RegisterPrefs(registry.get()); diff --git a/atom/browser/atom_browser_main_parts.cc b/atom/browser/atom_browser_main_parts.cc index 0cc9f7f2cdd91..3f11b9d3a66d4 100644 --- a/atom/browser/atom_browser_main_parts.cc +++ b/atom/browser/atom_browser_main_parts.cc @@ -10,10 +10,12 @@ #include "atom/browser/api/trackable_object.h" #include "atom/browser/atom_browser_client.h" #include "atom/browser/atom_browser_context.h" +#include "atom/browser/atom_web_ui_controller_factory.h" #include "atom/browser/browser.h" #include "atom/browser/io_thread.h" #include "atom/browser/javascript_environment.h" #include "atom/browser/node_debugger.h" +#include "atom/browser/ui/devtools_manager_delegate.h" #include "atom/common/api/atom_bindings.h" #include "atom/common/asar/asar_util.h" #include "atom/common/node_bindings.h" @@ -25,6 +27,8 @@ #include "components/net_log/chrome_net_log.h" #include "components/net_log/net_export_file_writer.h" #include "content/public/browser/child_process_security_policy.h" +#include "content/public/browser/web_ui_controller_factory.h" +#include "content/public/common/content_switches.h" #include "content/public/common/result_codes.h" #include "content/public/common/service_manager_connection.h" #include "electron/buildflags/buildflags.h" @@ -39,14 +43,10 @@ #include "ui/events/devices/x11/touch_factory_x11.h" #endif -#if BUILDFLAG(ENABLE_PDF_VIEWER) -#include "atom/browser/atom_web_ui_controller_factory.h" -#endif // BUILDFLAG(ENABLE_PDF_VIEWER) - #if defined(OS_MACOSX) #include "atom/browser/ui/cocoa/views_delegate_mac.h" #else -#include "brightray/browser/views/views_delegate.h" +#include "atom/browser/ui/views/atom_views_delegate.h" #endif // Must be included after all other headers. @@ -212,7 +212,7 @@ void AtomBrowserMainParts::ToolkitInitialized() { #if defined(OS_MACOSX) views_delegate_.reset(new ViewsDelegateMac); #else - views_delegate_.reset(new brightray::ViewsDelegate); + views_delegate_.reset(new ViewsDelegate); #endif } @@ -231,12 +231,13 @@ void AtomBrowserMainParts::PreMainMessageLoopRun() { base::Bind(&v8::Isolate::LowMemoryNotification, base::Unretained(js_env_->isolate()))); -#if BUILDFLAG(ENABLE_PDF_VIEWER) content::WebUIControllerFactory::RegisterFactory( AtomWebUIControllerFactory::GetInstance()); -#endif // BUILDFLAG(ENABLE_PDF_VIEWER) - brightray::BrowserMainParts::PreMainMessageLoopRun(); + // --remote-debugging-port + auto* command_line = base::CommandLine::ForCurrentProcess(); + if (command_line->HasSwitch(switches::kRemoteDebuggingPort)) + DevToolsManagerDelegate::StartHttpHandler(); #if defined(USE_X11) libgtkui::GtkInitFromCommandLine(*base::CommandLine::ForCurrentProcess()); diff --git a/atom/browser/atom_browser_main_parts.h b/atom/browser/atom_browser_main_parts.h index 22122a70f55ad..28b31661f60a9 100644 --- a/atom/browser/atom_browser_main_parts.h +++ b/atom/browser/atom_browser_main_parts.h @@ -19,12 +19,6 @@ class BrowserProcess; class IconManager; -#if defined(TOOLKIT_VIEWS) -namespace brightray { -class ViewsDelegate; -} -#endif - namespace net_log { class ChromeNetLog; } @@ -40,6 +34,10 @@ class NodeDebugger; class NodeEnvironment; class BridgeTaskRunner; +#if defined(TOOLKIT_VIEWS) +class ViewsDelegate; +#endif + #if defined(OS_MACOSX) class ViewsDelegateMac; #endif @@ -103,7 +101,7 @@ class AtomBrowserMainParts : public brightray::BrowserMainParts { #if defined(OS_MACOSX) std::unique_ptr views_delegate_; #else - std::unique_ptr views_delegate_; + std::unique_ptr views_delegate_; #endif // A fake BrowserProcess object that used to feed the source code from chrome. diff --git a/atom/browser/atom_web_ui_controller_factory.cc b/atom/browser/atom_web_ui_controller_factory.cc index 5170bcd60cabe..dab0176e43d87 100644 --- a/atom/browser/atom_web_ui_controller_factory.cc +++ b/atom/browser/atom_web_ui_controller_factory.cc @@ -13,12 +13,20 @@ #include "atom/common/atom_constants.h" #include "base/strings/string_split.h" #include "base/strings/string_util.h" -#include "content/public/browser/web_contents.h" #include "net/base/escape.h" #endif // BUILDFLAG(ENABLE_PDF_VIEWER) +#include "atom/browser/ui/devtools_ui.h" +#include "content/public/browser/web_contents.h" + namespace atom { +namespace { + +const char kChromeUIDevToolsBundledHost[] = "devtools"; + +} // namespace + // static AtomWebUIControllerFactory* AtomWebUIControllerFactory::GetInstance() { return base::Singleton::get(); @@ -36,6 +44,9 @@ content::WebUI::TypeID AtomWebUIControllerFactory::GetWebUIType( return const_cast(this); } #endif // BUILDFLAG(ENABLE_PDF_VIEWER) + if (url.host() == kChromeUIDevToolsBundledHost) { + return const_cast(this); + } return content::WebUI::kNoWebUI; } @@ -78,6 +89,10 @@ AtomWebUIControllerFactory::CreateWebUIControllerForURL(content::WebUI* web_ui, return new PdfViewerUI(browser_context, web_ui, src); } #endif // BUILDFLAG(ENABLE_PDF_VIEWER) + if (url.host() == kChromeUIDevToolsBundledHost) { + auto* browser_context = web_ui->GetWebContents()->GetBrowserContext(); + return std::make_unique(browser_context, web_ui); + } return std::unique_ptr(); } diff --git a/atom/browser/common_web_contents_delegate.cc b/atom/browser/common_web_contents_delegate.cc index 50980cf3cc72f..03eca15850411 100644 --- a/atom/browser/common_web_contents_delegate.cc +++ b/atom/browser/common_web_contents_delegate.cc @@ -188,7 +188,7 @@ void CommonWebContentsDelegate::InitWithWebContents( !web_preferences || web_preferences->IsEnabled(options::kOffscreen); // Create InspectableWebContents. - web_contents_.reset(brightray::InspectableWebContents::Create( + web_contents_.reset(InspectableWebContents::Create( web_contents, browser_context->prefs(), is_guest)); web_contents_->SetDelegate(this); } @@ -229,11 +229,12 @@ void CommonWebContentsDelegate::ResetManagedWebContents(bool async) { // is required to get the right quit closure for the main message loop. base::ThreadTaskRunnerHandle::Get()->PostNonNestableTask( FROM_HERE, - base::BindOnce([](scoped_refptr browser_context, - std::unique_ptr - web_contents) { web_contents.reset(); }, - base::RetainedRef(browser_context_), - std::move(web_contents_))); + base::BindOnce( + [](scoped_refptr browser_context, + std::unique_ptr web_contents) { + web_contents.reset(); + }, + base::RetainedRef(browser_context_), std::move(web_contents_))); } else { web_contents_.reset(); } diff --git a/atom/browser/common_web_contents_delegate.h b/atom/browser/common_web_contents_delegate.h index 22643131c4bbe..9481eddbac767 100644 --- a/atom/browser/common_web_contents_delegate.h +++ b/atom/browser/common_web_contents_delegate.h @@ -10,10 +10,10 @@ #include #include +#include "atom/browser/ui/inspectable_web_contents_delegate.h" +#include "atom/browser/ui/inspectable_web_contents_impl.h" +#include "atom/browser/ui/inspectable_web_contents_view_delegate.h" #include "base/memory/weak_ptr.h" -#include "brightray/browser/inspectable_web_contents_delegate.h" -#include "brightray/browser/inspectable_web_contents_impl.h" -#include "brightray/browser/inspectable_web_contents_view_delegate.h" #include "chrome/browser/devtools/devtools_file_system_indexer.h" #include "content/public/browser/web_contents_delegate.h" #include "electron/buildflags/buildflags.h" @@ -36,10 +36,9 @@ class WebDialogHelper; class OffScreenRenderWidgetHostView; #endif -class CommonWebContentsDelegate - : public content::WebContentsDelegate, - public brightray::InspectableWebContentsDelegate, - public brightray::InspectableWebContentsViewDelegate { +class CommonWebContentsDelegate : public content::WebContentsDelegate, + public InspectableWebContentsDelegate, + public InspectableWebContentsViewDelegate { public: CommonWebContentsDelegate(); ~CommonWebContentsDelegate() override; @@ -61,7 +60,7 @@ class CommonWebContentsDelegate // Returns the WebContents of devtools. content::WebContents* GetDevToolsWebContents() const; - brightray::InspectableWebContents* managed_web_contents() const { + InspectableWebContents* managed_web_contents() const { return web_contents_.get(); } @@ -189,7 +188,7 @@ class CommonWebContentsDelegate // Notice that web_contents_ must be placed after dialog_manager_, so we can // make sure web_contents_ is destroyed before dialog_manager_, otherwise a // crash would happen. - std::unique_ptr web_contents_; + std::unique_ptr web_contents_; // Maps url to file path, used by the file requests sent from devtools. typedef std::map PathsMap; diff --git a/atom/browser/common_web_contents_delegate_mac.mm b/atom/browser/common_web_contents_delegate_mac.mm index e42361d27926e..23b2a7eee9cde 100644 --- a/atom/browser/common_web_contents_delegate_mac.mm +++ b/atom/browser/common_web_contents_delegate_mac.mm @@ -6,8 +6,8 @@ #import +#include "atom/browser/ui/cocoa/event_dispatching_window.h" #include "atom/browser/web_contents_preferences.h" -#include "brightray/browser/mac/event_dispatching_window.h" #include "content/public/browser/native_web_keyboard_event.h" #include "ui/events/keycodes/keyboard_codes.h" diff --git a/atom/browser/native_browser_view.cc b/atom/browser/native_browser_view.cc index 6460f2bfbd22f..c5d81e42b9743 100644 --- a/atom/browser/native_browser_view.cc +++ b/atom/browser/native_browser_view.cc @@ -7,18 +7,17 @@ #include "atom/browser/native_browser_view.h" #include "atom/browser/api/atom_api_web_contents.h" -#include "brightray/browser/inspectable_web_contents.h" +#include "atom/browser/ui/inspectable_web_contents.h" namespace atom { NativeBrowserView::NativeBrowserView( - brightray::InspectableWebContents* inspectable_web_contents) + InspectableWebContents* inspectable_web_contents) : inspectable_web_contents_(inspectable_web_contents) {} NativeBrowserView::~NativeBrowserView() {} -brightray::InspectableWebContentsView* -NativeBrowserView::GetInspectableWebContentsView() { +InspectableWebContentsView* NativeBrowserView::GetInspectableWebContentsView() { return inspectable_web_contents_->GetView(); } diff --git a/atom/browser/native_browser_view.h b/atom/browser/native_browser_view.h index 56937e4c8c69e..575af194b6419 100644 --- a/atom/browser/native_browser_view.h +++ b/atom/browser/native_browser_view.h @@ -12,11 +12,6 @@ #include "content/public/browser/web_contents.h" #include "third_party/skia/include/core/SkColor.h" -namespace brightray { -class InspectableWebContents; -class InspectableWebContentsView; -} // namespace brightray - namespace gfx { class Rect; } @@ -28,18 +23,21 @@ enum AutoResizeFlags { kAutoResizeHeight = 0x2, }; +class InspectableWebContents; +class InspectableWebContentsView; + class NativeBrowserView { public: virtual ~NativeBrowserView(); static NativeBrowserView* Create( - brightray::InspectableWebContents* inspectable_web_contents); + InspectableWebContents* inspectable_web_contents); - brightray::InspectableWebContents* GetInspectableWebContents() { + InspectableWebContents* GetInspectableWebContents() { return inspectable_web_contents_; } - brightray::InspectableWebContentsView* GetInspectableWebContentsView(); + InspectableWebContentsView* GetInspectableWebContentsView(); content::WebContents* GetWebContents(); virtual void SetAutoResizeFlags(uint8_t flags) = 0; @@ -51,10 +49,9 @@ class NativeBrowserView { const std::vector& system_drag_exclude_areas) {} protected: - explicit NativeBrowserView( - brightray::InspectableWebContents* inspectable_web_contents); + explicit NativeBrowserView(InspectableWebContents* inspectable_web_contents); - brightray::InspectableWebContents* inspectable_web_contents_; + InspectableWebContents* inspectable_web_contents_; private: DISALLOW_COPY_AND_ASSIGN(NativeBrowserView); diff --git a/atom/browser/native_browser_view_mac.h b/atom/browser/native_browser_view_mac.h index 726ca75433e80..ae0f497f93559 100644 --- a/atom/browser/native_browser_view_mac.h +++ b/atom/browser/native_browser_view_mac.h @@ -17,7 +17,7 @@ namespace atom { class NativeBrowserViewMac : public NativeBrowserView { public: explicit NativeBrowserViewMac( - brightray::InspectableWebContents* inspectable_web_contents); + InspectableWebContents* inspectable_web_contents); ~NativeBrowserViewMac() override; void SetAutoResizeFlags(uint8_t flags) override; diff --git a/atom/browser/native_browser_view_mac.mm b/atom/browser/native_browser_view_mac.mm index 300e9b1050576..b8a822ca4d1c2 100644 --- a/atom/browser/native_browser_view_mac.mm +++ b/atom/browser/native_browser_view_mac.mm @@ -4,8 +4,8 @@ #include "atom/browser/native_browser_view_mac.h" -#include "brightray/browser/inspectable_web_contents.h" -#include "brightray/browser/inspectable_web_contents_view.h" +#include "atom/browser/ui/inspectable_web_contents.h" +#include "atom/browser/ui/inspectable_web_contents_view.h" #include "skia/ext/skia_utils_mac.h" #include "ui/gfx/geometry/rect.h" @@ -158,7 +158,7 @@ - (BOOL)mouseDownCanMoveWindow { namespace atom { NativeBrowserViewMac::NativeBrowserViewMac( - brightray::InspectableWebContents* inspectable_web_contents) + InspectableWebContents* inspectable_web_contents) : NativeBrowserView(inspectable_web_contents) { auto* view = GetInspectableWebContentsView()->GetNativeView(); view.autoresizingMask = kDefaultAutoResizingMask; @@ -233,7 +233,7 @@ - (BOOL)mouseDownCanMoveWindow { // static NativeBrowserView* NativeBrowserView::Create( - brightray::InspectableWebContents* inspectable_web_contents) { + InspectableWebContents* inspectable_web_contents) { return new NativeBrowserViewMac(inspectable_web_contents); } diff --git a/atom/browser/native_browser_view_views.cc b/atom/browser/native_browser_view_views.cc index 6414005a1e40d..d69200ed48389 100644 --- a/atom/browser/native_browser_view_views.cc +++ b/atom/browser/native_browser_view_views.cc @@ -4,7 +4,7 @@ #include "atom/browser/native_browser_view_views.h" -#include "brightray/browser/inspectable_web_contents_view.h" +#include "atom/browser/ui/inspectable_web_contents_view.h" #include "ui/gfx/geometry/rect.h" #include "ui/views/background.h" #include "ui/views/view.h" @@ -12,7 +12,7 @@ namespace atom { NativeBrowserViewViews::NativeBrowserViewViews( - brightray::InspectableWebContents* inspectable_web_contents) + InspectableWebContents* inspectable_web_contents) : NativeBrowserView(inspectable_web_contents) {} NativeBrowserViewViews::~NativeBrowserViewViews() {} @@ -33,7 +33,7 @@ void NativeBrowserViewViews::SetBackgroundColor(SkColor color) { // static NativeBrowserView* NativeBrowserView::Create( - brightray::InspectableWebContents* inspectable_web_contents) { + InspectableWebContents* inspectable_web_contents) { return new NativeBrowserViewViews(inspectable_web_contents); } diff --git a/atom/browser/native_browser_view_views.h b/atom/browser/native_browser_view_views.h index 8f8e860292bad..f9ca925c0eed8 100644 --- a/atom/browser/native_browser_view_views.h +++ b/atom/browser/native_browser_view_views.h @@ -12,7 +12,7 @@ namespace atom { class NativeBrowserViewViews : public NativeBrowserView { public: explicit NativeBrowserViewViews( - brightray::InspectableWebContents* inspectable_web_contents); + InspectableWebContents* inspectable_web_contents); ~NativeBrowserViewViews() override; uint8_t GetAutoResizeFlags() { return auto_resize_flags_; } diff --git a/atom/browser/native_window_mac.mm b/atom/browser/native_window_mac.mm index 4954cb5fd5082..df2e4fc9a1ecd 100644 --- a/atom/browser/native_window_mac.mm +++ b/atom/browser/native_window_mac.mm @@ -16,13 +16,13 @@ #include "atom/browser/ui/cocoa/atom_preview_item.h" #include "atom/browser/ui/cocoa/atom_touch_bar.h" #include "atom/browser/ui/cocoa/root_view_mac.h" +#include "atom/browser/ui/inspectable_web_contents.h" +#include "atom/browser/ui/inspectable_web_contents_view.h" #include "atom/browser/window_list.h" #include "atom/common/options_switches.h" #include "base/mac/mac_util.h" #include "base/mac/scoped_cftyperef.h" #include "base/strings/sys_string_conversions.h" -#include "brightray/browser/inspectable_web_contents.h" -#include "brightray/browser/inspectable_web_contents_view.h" #include "content/public/browser/browser_accessibility_state.h" #include "native_mate/dictionary.h" #include "skia/ext/skia_utils_mac.h" diff --git a/atom/browser/native_window_views.cc b/atom/browser/native_window_views.cc index 8f3d9a2dc70d5..66605bc1866b3 100644 --- a/atom/browser/native_window_views.cc +++ b/atom/browser/native_window_views.cc @@ -15,6 +15,8 @@ #include "atom/browser/api/atom_api_web_contents.h" #include "atom/browser/native_browser_view_views.h" +#include "atom/browser/ui/inspectable_web_contents.h" +#include "atom/browser/ui/inspectable_web_contents_view.h" #include "atom/browser/ui/views/root_view.h" #include "atom/browser/web_contents_preferences.h" #include "atom/browser/web_view_manager.h" @@ -23,8 +25,6 @@ #include "atom/common/native_mate_converters/image_converter.h" #include "atom/common/options_switches.h" #include "base/strings/utf_string_conversions.h" -#include "brightray/browser/inspectable_web_contents.h" -#include "brightray/browser/inspectable_web_contents_view.h" #include "content/public/browser/browser_thread.h" #include "native_mate/dictionary.h" #include "ui/aura/window_tree_host.h" diff --git a/brightray/browser/mac/bry_inspectable_web_contents_view.h b/atom/browser/ui/cocoa/atom_inspectable_web_contents_view.h similarity index 59% rename from brightray/browser/mac/bry_inspectable_web_contents_view.h rename to atom/browser/ui/cocoa/atom_inspectable_web_contents_view.h index 2e9729ba93685..c2db85cad0a2d 100644 --- a/brightray/browser/mac/bry_inspectable_web_contents_view.h +++ b/atom/browser/ui/cocoa/atom_inspectable_web_contents_view.h @@ -1,18 +1,25 @@ +// Copyright (c) 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE-CHROMIUM file. + +#ifndef ATOM_BROWSER_UI_COCOA_BRY_INSPECTABLE_WEB_CONTENTS_VIEW_H_ +#define ATOM_BROWSER_UI_COCOA_BRY_INSPECTABLE_WEB_CONTENTS_VIEW_H_ + #import #include "base/mac/scoped_nsobject.h" #include "chrome/browser/devtools/devtools_contents_resizing_strategy.h" #include "ui/base/cocoa/base_view.h" -namespace brightray { +namespace atom { class InspectableWebContentsViewMac; } -using brightray::InspectableWebContentsViewMac; +using atom::InspectableWebContentsViewMac; -@interface BRYInspectableWebContentsView : BaseView { +@interface AtomInspectableWebContentsView : BaseView { @private - brightray::InspectableWebContentsViewMac* inspectableWebContentsView_; + atom::InspectableWebContentsViewMac* inspectableWebContentsView_; base::scoped_nsobject fake_view_; base::scoped_nsobject devtools_window_; @@ -36,3 +43,5 @@ using brightray::InspectableWebContentsViewMac; - (void)setTitle:(NSString*)title; @end + +#endif // ATOM_BROWSER_UI_COCOA_BRY_INSPECTABLE_WEB_CONTENTS_VIEW_H_ diff --git a/brightray/browser/mac/bry_inspectable_web_contents_view.mm b/atom/browser/ui/cocoa/atom_inspectable_web_contents_view.mm similarity index 93% rename from brightray/browser/mac/bry_inspectable_web_contents_view.mm rename to atom/browser/ui/cocoa/atom_inspectable_web_contents_view.mm index 176339fb78925..6d1fc8f250602 100644 --- a/brightray/browser/mac/bry_inspectable_web_contents_view.mm +++ b/atom/browser/ui/cocoa/atom_inspectable_web_contents_view.mm @@ -1,13 +1,17 @@ -#include "brightray/browser/mac/bry_inspectable_web_contents_view.h" +// Copyright (c) 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE-CHROMIUM file. -#include "brightray/browser/inspectable_web_contents_impl.h" -#include "brightray/browser/inspectable_web_contents_view_delegate.h" -#include "brightray/browser/inspectable_web_contents_view_mac.h" -#include "brightray/browser/mac/event_dispatching_window.h" +#include "atom/browser/ui/cocoa/atom_inspectable_web_contents_view.h" + +#include "atom/browser/ui/cocoa/event_dispatching_window.h" +#include "atom/browser/ui/inspectable_web_contents_impl.h" +#include "atom/browser/ui/inspectable_web_contents_view_delegate.h" +#include "atom/browser/ui/inspectable_web_contents_view_mac.h" #include "content/public/browser/render_widget_host_view.h" #include "ui/gfx/mac/scoped_cocoa_disable_screen_updates.h" -@implementation BRYInspectableWebContentsView +@implementation AtomInspectableWebContentsView - (instancetype)initWithInspectableWebContentsViewMac: (InspectableWebContentsViewMac*)view { diff --git a/atom/browser/ui/cocoa/atom_ns_window.h b/atom/browser/ui/cocoa/atom_ns_window.h index 861916b1853aa..d708b5f5d8b84 100644 --- a/atom/browser/ui/cocoa/atom_ns_window.h +++ b/atom/browser/ui/cocoa/atom_ns_window.h @@ -5,7 +5,7 @@ #ifndef ATOM_BROWSER_UI_COCOA_ATOM_NS_WINDOW_H_ #define ATOM_BROWSER_UI_COCOA_ATOM_NS_WINDOW_H_ -#include "brightray/browser/mac/event_dispatching_window.h" +#include "atom/browser/ui/cocoa/event_dispatching_window.h" #include "ui/views/cocoa/native_widget_mac_nswindow.h" #include "ui/views/widget/native_widget_mac.h" diff --git a/brightray/browser/mac/event_dispatching_window.h b/atom/browser/ui/cocoa/event_dispatching_window.h similarity index 66% rename from brightray/browser/mac/event_dispatching_window.h rename to atom/browser/ui/cocoa/event_dispatching_window.h index 27ed9e6bf2f97..151a125f00724 100644 --- a/brightray/browser/mac/event_dispatching_window.h +++ b/atom/browser/ui/cocoa/event_dispatching_window.h @@ -2,8 +2,8 @@ // Use of this source code is governed by the MIT license that can be // found in the LICENSE file. -#ifndef BROWSER_EVENT_DISPATCHING_WINDOW_H_ -#define BROWSER_EVENT_DISPATCHING_WINDOW_H_ +#ifndef ATOM_BROWSER_UI_COCOA_EVENT_DISPATCHING_WINDOW_H_ +#define ATOM_BROWSER_UI_COCOA_EVENT_DISPATCHING_WINDOW_H_ #import "ui/base/cocoa/underlay_opengl_hosting_window.h" @@ -16,4 +16,4 @@ @end -#endif // BROWSER_EVENT_DISPATCHING_WINDOW_H_ +#endif // ATOM_BROWSER_UI_COCOA_EVENT_DISPATCHING_WINDOW_H_ diff --git a/brightray/browser/mac/event_dispatching_window.mm b/atom/browser/ui/cocoa/event_dispatching_window.mm similarity index 92% rename from brightray/browser/mac/event_dispatching_window.mm rename to atom/browser/ui/cocoa/event_dispatching_window.mm index 50082c6d51cfd..4b90ae924be7b 100644 --- a/brightray/browser/mac/event_dispatching_window.mm +++ b/atom/browser/ui/cocoa/event_dispatching_window.mm @@ -2,7 +2,7 @@ // Use of this source code is governed by the MIT license that can be // found in the LICENSE file. -#include "brightray/browser/mac/event_dispatching_window.h" +#include "atom/browser/ui/cocoa/event_dispatching_window.h" @implementation EventDispatchingWindow diff --git a/brightray/browser/devtools_manager_delegate.cc b/atom/browser/ui/devtools_manager_delegate.cc similarity index 97% rename from brightray/browser/devtools_manager_delegate.cc rename to atom/browser/ui/devtools_manager_delegate.cc index 53ee9c4f818ba..e5dd5d7e5d530 100644 --- a/brightray/browser/devtools_manager_delegate.cc +++ b/atom/browser/ui/devtools_manager_delegate.cc @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE-CHROMIUM file. -#include "brightray/browser/devtools_manager_delegate.h" +#include "atom/browser/ui/devtools_manager_delegate.h" #include #include @@ -28,7 +28,7 @@ #include "net/socket/tcp_server_socket.h" #include "ui/base/resource/resource_bundle.h" -namespace brightray { +namespace atom { namespace { @@ -116,4 +116,4 @@ bool DevToolsManagerDelegate::HasBundledFrontendResources() { return true; } -} // namespace brightray +} // namespace atom diff --git a/brightray/browser/devtools_manager_delegate.h b/atom/browser/ui/devtools_manager_delegate.h similarity index 83% rename from brightray/browser/devtools_manager_delegate.h rename to atom/browser/ui/devtools_manager_delegate.h index b25ed37d901a7..7170785933c72 100644 --- a/brightray/browser/devtools_manager_delegate.h +++ b/atom/browser/ui/devtools_manager_delegate.h @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE-CHROMIUM file. -#ifndef BRIGHTRAY_BROWSER_DEVTOOLS_MANAGER_DELEGATE_H_ -#define BRIGHTRAY_BROWSER_DEVTOOLS_MANAGER_DELEGATE_H_ +#ifndef ATOM_BROWSER_UI_DEVTOOLS_MANAGER_DELEGATE_H_ +#define ATOM_BROWSER_UI_DEVTOOLS_MANAGER_DELEGATE_H_ #include @@ -11,7 +11,7 @@ #include "base/macros.h" #include "content/public/browser/devtools_manager_delegate.h" -namespace brightray { +namespace atom { class DevToolsManagerDelegate : public content::DevToolsManagerDelegate { public: @@ -34,6 +34,6 @@ class DevToolsManagerDelegate : public content::DevToolsManagerDelegate { DISALLOW_COPY_AND_ASSIGN(DevToolsManagerDelegate); }; -} // namespace brightray +} // namespace atom -#endif // BRIGHTRAY_BROWSER_DEVTOOLS_MANAGER_DELEGATE_H_ +#endif // ATOM_BROWSER_UI_DEVTOOLS_MANAGER_DELEGATE_H_ diff --git a/brightray/browser/devtools_ui.cc b/atom/browser/ui/devtools_ui.cc similarity index 97% rename from brightray/browser/devtools_ui.cc rename to atom/browser/ui/devtools_ui.cc index 2a8cf8e481323..47a989ec22456 100644 --- a/brightray/browser/devtools_ui.cc +++ b/atom/browser/ui/devtools_ui.cc @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE-CHROMIUM file. -#include "brightray/browser/devtools_ui.h" +#include "atom/browser/ui/devtools_ui.h" #include @@ -14,7 +14,7 @@ #include "content/public/browser/web_contents.h" #include "content/public/browser/web_ui.h" -namespace brightray { +namespace atom { namespace { @@ -117,4 +117,4 @@ DevToolsUI::DevToolsUI(content::BrowserContext* browser_context, content::URLDataSource::Add(browser_context, new BundledDataSource()); } -} // namespace brightray +} // namespace atom diff --git a/brightray/browser/devtools_ui.h b/atom/browser/ui/devtools_ui.h similarity index 76% rename from brightray/browser/devtools_ui.h rename to atom/browser/ui/devtools_ui.h index eb78fdf2a780b..b6cc21e29e750 100644 --- a/brightray/browser/devtools_ui.h +++ b/atom/browser/ui/devtools_ui.h @@ -2,14 +2,14 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE-CHROMIUM file. -#ifndef BRIGHTRAY_BROWSER_DEVTOOLS_UI_H_ -#define BRIGHTRAY_BROWSER_DEVTOOLS_UI_H_ +#ifndef ATOM_BROWSER_UI_DEVTOOLS_UI_H_ +#define ATOM_BROWSER_UI_DEVTOOLS_UI_H_ #include "base/compiler_specific.h" #include "content/public/browser/browser_context.h" #include "content/public/browser/web_ui_controller.h" -namespace brightray { +namespace atom { class BrowserContext; @@ -22,6 +22,6 @@ class DevToolsUI : public content::WebUIController { DISALLOW_COPY_AND_ASSIGN(DevToolsUI); }; -} // namespace brightray +} // namespace atom -#endif // BRIGHTRAY_BROWSER_DEVTOOLS_UI_H_ +#endif // ATOM_BROWSER_UI_DEVTOOLS_UI_H_ diff --git a/atom/browser/ui/inspectable_web_contents.cc b/atom/browser/ui/inspectable_web_contents.cc new file mode 100644 index 0000000000000..858a8b5db5118 --- /dev/null +++ b/atom/browser/ui/inspectable_web_contents.cc @@ -0,0 +1,19 @@ +// Copyright (c) 2012 The Chromium Authors. All rights reserved. +// Copyright (c) 2013 Adam Roben . All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE-CHROMIUM file. + +#include "atom/browser/ui/inspectable_web_contents.h" + +#include "atom/browser/ui/inspectable_web_contents_impl.h" + +namespace atom { + +InspectableWebContents* InspectableWebContents::Create( + content::WebContents* web_contents, + PrefService* pref_service, + bool is_guest) { + return new InspectableWebContentsImpl(web_contents, pref_service, is_guest); +} + +} // namespace atom diff --git a/brightray/browser/inspectable_web_contents.h b/atom/browser/ui/inspectable_web_contents.h similarity index 79% rename from brightray/browser/inspectable_web_contents.h rename to atom/browser/ui/inspectable_web_contents.h index f659de1b2fa74..3835baa046861 100644 --- a/brightray/browser/inspectable_web_contents.h +++ b/atom/browser/ui/inspectable_web_contents.h @@ -1,5 +1,10 @@ -#ifndef BRIGHTRAY_BROWSER_INSPECTABLE_WEB_CONTENTS_H_ -#define BRIGHTRAY_BROWSER_INSPECTABLE_WEB_CONTENTS_H_ +// Copyright (c) 2012 The Chromium Authors. All rights reserved. +// Copyright (c) 2013 Adam Roben . All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE-CHROMIUM file. + +#ifndef ATOM_BROWSER_UI_INSPECTABLE_WEB_CONTENTS_H_ +#define ATOM_BROWSER_UI_INSPECTABLE_WEB_CONTENTS_H_ #include @@ -15,7 +20,7 @@ class DevToolsAgentHost; class PrefService; -namespace brightray { +namespace atom { class InspectableWebContentsDelegate; class InspectableWebContentsView; @@ -54,6 +59,6 @@ class InspectableWebContents { virtual void InspectElement(int x, int y) = 0; }; -} // namespace brightray +} // namespace atom -#endif // BRIGHTRAY_BROWSER_INSPECTABLE_WEB_CONTENTS_H_ +#endif // ATOM_BROWSER_UI_INSPECTABLE_WEB_CONTENTS_H_ diff --git a/brightray/browser/inspectable_web_contents_delegate.h b/atom/browser/ui/inspectable_web_contents_delegate.h similarity index 72% rename from brightray/browser/inspectable_web_contents_delegate.h rename to atom/browser/ui/inspectable_web_contents_delegate.h index be4ab52466f82..d72622e251bfe 100644 --- a/brightray/browser/inspectable_web_contents_delegate.h +++ b/atom/browser/ui/inspectable_web_contents_delegate.h @@ -1,11 +1,16 @@ -#ifndef BRIGHTRAY_BROWSER_INSPECTABLE_WEB_CONTENTS_DELEGATE_H_ -#define BRIGHTRAY_BROWSER_INSPECTABLE_WEB_CONTENTS_DELEGATE_H_ +// Copyright (c) 2012 The Chromium Authors. All rights reserved. +// Copyright (c) 2013 Adam Roben . All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE-CHROMIUM file. + +#ifndef ATOM_BROWSER_UI_INSPECTABLE_WEB_CONTENTS_DELEGATE_H_ +#define ATOM_BROWSER_UI_INSPECTABLE_WEB_CONTENTS_DELEGATE_H_ #include #include "base/files/file_path.h" -namespace brightray { +namespace atom { class InspectableWebContentsDelegate { public: @@ -32,6 +37,6 @@ class InspectableWebContentsDelegate { const std::string& query) {} }; -} // namespace brightray +} // namespace atom -#endif // BRIGHTRAY_BROWSER_INSPECTABLE_WEB_CONTENTS_DELEGATE_H_ +#endif // ATOM_BROWSER_UI_INSPECTABLE_WEB_CONTENTS_DELEGATE_H_ diff --git a/brightray/browser/inspectable_web_contents_impl.cc b/atom/browser/ui/inspectable_web_contents_impl.cc similarity index 98% rename from brightray/browser/inspectable_web_contents_impl.cc rename to atom/browser/ui/inspectable_web_contents_impl.cc index 9115513605dcd..9fc86a0b337a4 100644 --- a/brightray/browser/inspectable_web_contents_impl.cc +++ b/atom/browser/ui/inspectable_web_contents_impl.cc @@ -6,8 +6,11 @@ #include #include -#include "brightray/browser/inspectable_web_contents_impl.h" +#include "atom/browser/ui/inspectable_web_contents_impl.h" +#include "atom/browser/ui/inspectable_web_contents_delegate.h" +#include "atom/browser/ui/inspectable_web_contents_view.h" +#include "atom/browser/ui/inspectable_web_contents_view_delegate.h" #include "atom/common/platform_util.h" #include "base/guid.h" #include "base/json/json_reader.h" @@ -18,11 +21,6 @@ #include "base/strings/stringprintf.h" #include "base/strings/utf_string_conversions.h" #include "base/values.h" -#include "brightray/browser/browser_client.h" -#include "brightray/browser/browser_main_parts.h" -#include "brightray/browser/inspectable_web_contents_delegate.h" -#include "brightray/browser/inspectable_web_contents_view.h" -#include "brightray/browser/inspectable_web_contents_view_delegate.h" #include "components/prefs/pref_registry_simple.h" #include "components/prefs/pref_service.h" #include "components/prefs/scoped_user_pref_update.h" @@ -42,7 +40,7 @@ #include "ui/display/display.h" #include "ui/display/screen.h" -namespace brightray { +namespace atom { namespace { @@ -896,4 +894,4 @@ void InspectableWebContentsImpl::SendMessageAck(int request_id, CallClientFunction("DevToolsAPI.embedderMessageAck", &id_value, arg, nullptr); } -} // namespace brightray +} // namespace atom diff --git a/brightray/browser/inspectable_web_contents_impl.h b/atom/browser/ui/inspectable_web_contents_impl.h similarity index 97% rename from brightray/browser/inspectable_web_contents_impl.h rename to atom/browser/ui/inspectable_web_contents_impl.h index 5dca5972e63a1..4816fe7853569 100644 --- a/brightray/browser/inspectable_web_contents_impl.h +++ b/atom/browser/ui/inspectable_web_contents_impl.h @@ -3,16 +3,16 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE-CHROMIUM file. -#ifndef BRIGHTRAY_BROWSER_INSPECTABLE_WEB_CONTENTS_IMPL_H_ -#define BRIGHTRAY_BROWSER_INSPECTABLE_WEB_CONTENTS_IMPL_H_ +#ifndef ATOM_BROWSER_UI_INSPECTABLE_WEB_CONTENTS_IMPL_H_ +#define ATOM_BROWSER_UI_INSPECTABLE_WEB_CONTENTS_IMPL_H_ #include #include #include #include +#include "atom/browser/ui/inspectable_web_contents.h" #include "base/memory/weak_ptr.h" -#include "brightray/browser/inspectable_web_contents.h" #include "chrome/browser/devtools/devtools_contents_resizing_strategy.h" #include "chrome/browser/devtools/devtools_embedder_message_dispatcher.h" #include "content/public/browser/devtools_agent_host.h" @@ -25,7 +25,7 @@ class PrefService; class PrefRegistrySimple; -namespace brightray { +namespace atom { class InspectableWebContentsDelegate; class InspectableWebContentsView; @@ -237,6 +237,6 @@ class InspectableWebContentsImpl DISALLOW_COPY_AND_ASSIGN(InspectableWebContentsImpl); }; -} // namespace brightray +} // namespace atom -#endif // BRIGHTRAY_BROWSER_INSPECTABLE_WEB_CONTENTS_IMPL_H_ +#endif // ATOM_BROWSER_UI_INSPECTABLE_WEB_CONTENTS_IMPL_H_ diff --git a/brightray/browser/inspectable_web_contents_view.h b/atom/browser/ui/inspectable_web_contents_view.h similarity index 75% rename from brightray/browser/inspectable_web_contents_view.h rename to atom/browser/ui/inspectable_web_contents_view.h index 0ec2dae4814f1..fea7b09ac8a86 100644 --- a/brightray/browser/inspectable_web_contents_view.h +++ b/atom/browser/ui/inspectable_web_contents_view.h @@ -1,5 +1,10 @@ -#ifndef BRIGHTRAY_BROWSER_INSPECTABLE_WEB_CONTENTS_VIEW_H_ -#define BRIGHTRAY_BROWSER_INSPECTABLE_WEB_CONTENTS_VIEW_H_ +// Copyright (c) 2012 The Chromium Authors. All rights reserved. +// Copyright (c) 2013 Adam Roben . All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE-CHROMIUM file. + +#ifndef ATOM_BROWSER_UI_INSPECTABLE_WEB_CONTENTS_VIEW_H_ +#define ATOM_BROWSER_UI_INSPECTABLE_WEB_CONTENTS_VIEW_H_ #include "base/strings/string16.h" #include "ui/gfx/native_widget_types.h" @@ -12,7 +17,7 @@ class View; } #endif -namespace brightray { +namespace atom { class InspectableWebContentsViewDelegate; @@ -52,6 +57,6 @@ class InspectableWebContentsView { InspectableWebContentsViewDelegate* delegate_; // weak references. }; -} // namespace brightray +} // namespace atom -#endif // BRIGHTRAY_BROWSER_INSPECTABLE_WEB_CONTENTS_VIEW_H_ +#endif // ATOM_BROWSER_UI_INSPECTABLE_WEB_CONTENTS_VIEW_H_ diff --git a/atom/browser/ui/inspectable_web_contents_view_delegate.cc b/atom/browser/ui/inspectable_web_contents_view_delegate.cc new file mode 100644 index 0000000000000..eb4ba30d7612c --- /dev/null +++ b/atom/browser/ui/inspectable_web_contents_view_delegate.cc @@ -0,0 +1,14 @@ +// Copyright (c) 2012 The Chromium Authors. All rights reserved. +// Copyright (c) 2013 Adam Roben . All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE-CHROMIUM file. + +#include "atom/browser/ui/inspectable_web_contents_view_delegate.h" + +namespace atom { + +gfx::ImageSkia InspectableWebContentsViewDelegate::GetDevToolsWindowIcon() { + return gfx::ImageSkia(); +} + +} // namespace atom diff --git a/brightray/browser/inspectable_web_contents_view_delegate.h b/atom/browser/ui/inspectable_web_contents_view_delegate.h similarity index 53% rename from brightray/browser/inspectable_web_contents_view_delegate.h rename to atom/browser/ui/inspectable_web_contents_view_delegate.h index e124bb730526e..0788cc9f50bbb 100644 --- a/brightray/browser/inspectable_web_contents_view_delegate.h +++ b/atom/browser/ui/inspectable_web_contents_view_delegate.h @@ -1,11 +1,16 @@ -#ifndef BRIGHTRAY_BROWSER_INSPECTABLE_WEB_CONTENTS_VIEW_DELEGATE_H_ -#define BRIGHTRAY_BROWSER_INSPECTABLE_WEB_CONTENTS_VIEW_DELEGATE_H_ +// Copyright (c) 2012 The Chromium Authors. All rights reserved. +// Copyright (c) 2013 Adam Roben . All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE-CHROMIUM file. + +#ifndef ATOM_BROWSER_UI_INSPECTABLE_WEB_CONTENTS_VIEW_DELEGATE_H_ +#define ATOM_BROWSER_UI_INSPECTABLE_WEB_CONTENTS_VIEW_DELEGATE_H_ #include #include "ui/gfx/image/image_skia.h" -namespace brightray { +namespace atom { class InspectableWebContentsViewDelegate { public: @@ -25,6 +30,6 @@ class InspectableWebContentsViewDelegate { #endif }; -} // namespace brightray +} // namespace atom -#endif // BRIGHTRAY_BROWSER_INSPECTABLE_WEB_CONTENTS_VIEW_DELEGATE_H_ +#endif // ATOM_BROWSER_UI_INSPECTABLE_WEB_CONTENTS_VIEW_DELEGATE_H_ diff --git a/brightray/browser/inspectable_web_contents_view_mac.h b/atom/browser/ui/inspectable_web_contents_view_mac.h similarity index 60% rename from brightray/browser/inspectable_web_contents_view_mac.h rename to atom/browser/ui/inspectable_web_contents_view_mac.h index 40a140c7297f2..d09581e6a6aef 100644 --- a/brightray/browser/inspectable_web_contents_view_mac.h +++ b/atom/browser/ui/inspectable_web_contents_view_mac.h @@ -1,13 +1,18 @@ -#ifndef BRIGHTRAY_BROWSER_INSPECTABLE_WEB_CONTENTS_VIEW_MAC_H_ -#define BRIGHTRAY_BROWSER_INSPECTABLE_WEB_CONTENTS_VIEW_MAC_H_ +// Copyright (c) 2012 The Chromium Authors. All rights reserved. +// Copyright (c) 2013 Adam Roben . All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE-CHROMIUM file. -#include "brightray/browser/inspectable_web_contents_view.h" +#ifndef ATOM_BROWSER_UI_INSPECTABLE_WEB_CONTENTS_VIEW_MAC_H_ +#define ATOM_BROWSER_UI_INSPECTABLE_WEB_CONTENTS_VIEW_MAC_H_ + +#include "atom/browser/ui/inspectable_web_contents_view.h" #include "base/mac/scoped_nsobject.h" -@class BRYInspectableWebContentsView; +@class AtomInspectableWebContentsView; -namespace brightray { +namespace atom { class InspectableWebContentsImpl; @@ -35,11 +40,11 @@ class InspectableWebContentsViewMac : public InspectableWebContentsView { // Owns us. InspectableWebContentsImpl* inspectable_web_contents_; - base::scoped_nsobject view_; + base::scoped_nsobject view_; DISALLOW_COPY_AND_ASSIGN(InspectableWebContentsViewMac); }; -} // namespace brightray +} // namespace atom -#endif // BRIGHTRAY_BROWSER_INSPECTABLE_WEB_CONTENTS_VIEW_MAC_H_ +#endif // ATOM_BROWSER_UI_INSPECTABLE_WEB_CONTENTS_VIEW_MAC_H_ diff --git a/brightray/browser/inspectable_web_contents_view_mac.mm b/atom/browser/ui/inspectable_web_contents_view_mac.mm similarity index 72% rename from brightray/browser/inspectable_web_contents_view_mac.mm rename to atom/browser/ui/inspectable_web_contents_view_mac.mm index ad41099241c5e..956446b486c9f 100644 --- a/brightray/browser/inspectable_web_contents_view_mac.mm +++ b/atom/browser/ui/inspectable_web_contents_view_mac.mm @@ -1,13 +1,18 @@ -#include "brightray/browser/inspectable_web_contents_view_mac.h" +// Copyright (c) 2012 The Chromium Authors. All rights reserved. +// Copyright (c) 2013 Adam Roben . All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE-CHROMIUM file. + +#include "atom/browser/ui/inspectable_web_contents_view_mac.h" #import +#import "atom/browser/ui/cocoa/atom_inspectable_web_contents_view.h" +#include "atom/browser/ui/inspectable_web_contents.h" +#include "atom/browser/ui/inspectable_web_contents_view_delegate.h" #include "base/strings/sys_string_conversions.h" -#include "brightray/browser/inspectable_web_contents.h" -#include "brightray/browser/inspectable_web_contents_view_delegate.h" -#import "brightray/browser/mac/bry_inspectable_web_contents_view.h" -namespace brightray { +namespace atom { InspectableWebContentsView* CreateInspectableContentsView( InspectableWebContentsImpl* inspectable_web_contents) { @@ -17,7 +22,7 @@ InspectableWebContentsViewMac::InspectableWebContentsViewMac( InspectableWebContentsImpl* inspectable_web_contents) : inspectable_web_contents_(inspectable_web_contents), - view_([[BRYInspectableWebContentsView alloc] + view_([[AtomInspectableWebContentsView alloc] initWithInspectableWebContentsViewMac:this]) {} InspectableWebContentsViewMac::~InspectableWebContentsViewMac() { @@ -58,4 +63,4 @@ [view_ setTitle:base::SysUTF16ToNSString(title)]; } -} // namespace brightray +} // namespace atom diff --git a/brightray/browser/views/views_delegate.cc b/atom/browser/ui/views/atom_views_delegate.cc similarity index 97% rename from brightray/browser/views/views_delegate.cc rename to atom/browser/ui/views/atom_views_delegate.cc index 16795d49da1a7..4ec4805beabf1 100644 --- a/brightray/browser/views/views_delegate.cc +++ b/atom/browser/ui/views/atom_views_delegate.cc @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE-CHROMIUM file. -#include "brightray/browser/views/views_delegate.h" +#include "atom/browser/ui/views/atom_views_delegate.h" #include @@ -28,7 +28,7 @@ bool IsDesktopEnvironmentUnity() { } // namespace -namespace brightray { +namespace atom { ViewsDelegate::ViewsDelegate() {} @@ -115,4 +115,4 @@ bool ViewsDelegate::WindowManagerProvidesTitleBar(bool maximized) { #endif } -} // namespace brightray +} // namespace atom diff --git a/brightray/browser/views/views_delegate.h b/atom/browser/ui/views/atom_views_delegate.h similarity index 90% rename from brightray/browser/views/views_delegate.h rename to atom/browser/ui/views/atom_views_delegate.h index 5ad6ac68dd847..f3fede18d97da 100644 --- a/brightray/browser/views/views_delegate.h +++ b/atom/browser/ui/views/atom_views_delegate.h @@ -2,15 +2,15 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE-CHROMIUM file. -#ifndef BRIGHTRAY_BROWSER_VIEWS_VIEWS_DELEGATE_H_ -#define BRIGHTRAY_BROWSER_VIEWS_VIEWS_DELEGATE_H_ +#ifndef ATOM_BROWSER_UI_VIEWS_ATOM_VIEWS_DELEGATE_H_ +#define ATOM_BROWSER_UI_VIEWS_ATOM_VIEWS_DELEGATE_H_ #include #include "base/compiler_specific.h" #include "ui/views/views_delegate.h" -namespace brightray { +namespace atom { class ViewsDelegate : public views::ViewsDelegate { public: @@ -55,6 +55,6 @@ class ViewsDelegate : public views::ViewsDelegate { DISALLOW_COPY_AND_ASSIGN(ViewsDelegate); }; -} // namespace brightray +} // namespace atom -#endif // BRIGHTRAY_BROWSER_VIEWS_VIEWS_DELEGATE_H_ +#endif // ATOM_BROWSER_UI_VIEWS_ATOM_VIEWS_DELEGATE_H_ diff --git a/brightray/browser/views/inspectable_web_contents_view_views.cc b/atom/browser/ui/views/inspectable_web_contents_view_views.cc similarity index 93% rename from brightray/browser/views/inspectable_web_contents_view_views.cc rename to atom/browser/ui/views/inspectable_web_contents_view_views.cc index 7cca54f03144d..b3e63f1cbc8cc 100644 --- a/brightray/browser/views/inspectable_web_contents_view_views.cc +++ b/atom/browser/ui/views/inspectable_web_contents_view_views.cc @@ -1,16 +1,20 @@ -#include "brightray/browser/views/inspectable_web_contents_view_views.h" +// Copyright (c) 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE-CHROMIUM file. +#include "atom/browser/ui/views/inspectable_web_contents_view_views.h" + +#include "atom/browser/ui/inspectable_web_contents_delegate.h" +#include "atom/browser/ui/inspectable_web_contents_impl.h" +#include "atom/browser/ui/inspectable_web_contents_view_delegate.h" #include "base/strings/utf_string_conversions.h" -#include "brightray/browser/inspectable_web_contents_delegate.h" -#include "brightray/browser/inspectable_web_contents_impl.h" -#include "brightray/browser/inspectable_web_contents_view_delegate.h" #include "ui/views/controls/label.h" #include "ui/views/controls/webview/webview.h" #include "ui/views/widget/widget.h" #include "ui/views/widget/widget_delegate.h" #include "ui/views/window/client_view.h" -namespace brightray { +namespace atom { namespace { @@ -224,4 +228,4 @@ void InspectableWebContentsViewViews::Layout() { contents_web_view_->SetBoundsRect(new_contents_bounds); } -} // namespace brightray +} // namespace atom diff --git a/brightray/browser/views/inspectable_web_contents_view_views.h b/atom/browser/ui/views/inspectable_web_contents_view_views.h similarity index 77% rename from brightray/browser/views/inspectable_web_contents_view_views.h rename to atom/browser/ui/views/inspectable_web_contents_view_views.h index 0ed703b541e00..a4d2578f969de 100644 --- a/brightray/browser/views/inspectable_web_contents_view_views.h +++ b/atom/browser/ui/views/inspectable_web_contents_view_views.h @@ -1,10 +1,14 @@ -#ifndef BRIGHTRAY_BROWSER_VIEWS_INSPECTABLE_WEB_CONTENTS_VIEW_VIEWS_H_ -#define BRIGHTRAY_BROWSER_VIEWS_INSPECTABLE_WEB_CONTENTS_VIEW_VIEWS_H_ +// Copyright (c) 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE-CHROMIUM file. + +#ifndef ATOM_BROWSER_UI_VIEWS_INSPECTABLE_WEB_CONTENTS_VIEW_VIEWS_H_ +#define ATOM_BROWSER_UI_VIEWS_INSPECTABLE_WEB_CONTENTS_VIEW_VIEWS_H_ #include +#include "atom/browser/ui/inspectable_web_contents_view.h" #include "base/compiler_specific.h" -#include "brightray/browser/inspectable_web_contents_view.h" #include "chrome/browser/devtools/devtools_contents_resizing_strategy.h" #include "ui/views/view.h" @@ -14,7 +18,7 @@ class Widget; class WidgetDelegate; } // namespace views -namespace brightray { +namespace atom { class InspectableWebContentsImpl; @@ -63,6 +67,6 @@ class InspectableWebContentsViewViews : public InspectableWebContentsView, DISALLOW_COPY_AND_ASSIGN(InspectableWebContentsViewViews); }; -} // namespace brightray +} // namespace atom -#endif // BRIGHTRAY_BROWSER_VIEWS_INSPECTABLE_WEB_CONTENTS_VIEW_VIEWS_H_ +#endif // ATOM_BROWSER_UI_VIEWS_INSPECTABLE_WEB_CONTENTS_VIEW_VIEWS_H_ diff --git a/brightray/BUILD.gn b/brightray/BUILD.gn index b1a0d22fc9756..b02c40b69d9b2 100644 --- a/brightray/BUILD.gn +++ b/brightray/BUILD.gn @@ -8,7 +8,6 @@ static_library("brightray") { "//content/shell:copy_shell_resources", "//net:extras", "//net:net_with_v8", - "//skia", "//ui/views", ] @@ -18,17 +17,6 @@ static_library("brightray") { deps += [ "//build/config/linux/gtk" ] } - extra_source_filters = [] - if (is_mac) { - extra_source_filters += [ - "*_views.cc", - "*_views.h", - "*\bviews/*", - ] - } - - set_sources_assignment_filter( - sources_assignment_filter + extra_source_filters) sources = [ "browser/brightray_paths.h", "browser/browser_client.cc", @@ -36,24 +24,6 @@ static_library("brightray") { "browser/browser_main_parts.cc", "browser/browser_main_parts.h", "browser/browser_main_parts_mac.mm", - "browser/devtools_manager_delegate.cc", - "browser/devtools_manager_delegate.h", - "browser/devtools_ui.cc", - "browser/devtools_ui.h", - "browser/inspectable_web_contents.cc", - "browser/inspectable_web_contents.h", - "browser/inspectable_web_contents_delegate.h", - "browser/inspectable_web_contents_impl.cc", - "browser/inspectable_web_contents_impl.h", - "browser/inspectable_web_contents_view.h", - "browser/inspectable_web_contents_view_delegate.cc", - "browser/inspectable_web_contents_view_delegate.h", - "browser/inspectable_web_contents_view_mac.h", - "browser/inspectable_web_contents_view_mac.mm", - "browser/mac/bry_inspectable_web_contents_view.h", - "browser/mac/bry_inspectable_web_contents_view.mm", - "browser/mac/event_dispatching_window.h", - "browser/mac/event_dispatching_window.mm", "browser/media/media_capture_devices_dispatcher.cc", "browser/media/media_capture_devices_dispatcher.h", "browser/media/media_device_id_salt.cc", @@ -62,12 +32,6 @@ static_library("brightray") { "browser/media/media_stream_devices_controller.h", "browser/net/require_ct_delegate.cc", "browser/net/require_ct_delegate.h", - "browser/views/inspectable_web_contents_view_views.cc", - "browser/views/inspectable_web_contents_view_views.h", - "browser/views/views_delegate.cc", - "browser/views/views_delegate.h", - "browser/web_ui_controller_factory.cc", - "browser/web_ui_controller_factory.h", "browser/win/scoped_hstring.cc", "browser/win/scoped_hstring.h", "browser/zoom_level_delegate.cc", @@ -86,14 +50,4 @@ static_library("brightray") { "common/platform_util.h", "common/platform_util_linux.cc", ] - set_sources_assignment_filter(sources_assignment_filter) - - sources += [ - "//chrome/browser/devtools/devtools_contents_resizing_strategy.cc", - "//chrome/browser/devtools/devtools_contents_resizing_strategy.h", - "//chrome/browser/devtools/devtools_embedder_message_dispatcher.cc", - "//chrome/browser/devtools/devtools_embedder_message_dispatcher.h", - "//chrome/browser/devtools/devtools_file_system_indexer.cc", - "//chrome/browser/devtools/devtools_file_system_indexer.h", - ] } diff --git a/brightray/browser/browser_client.cc b/brightray/browser/browser_client.cc index 0e73b19420736..4ae108486c122 100644 --- a/brightray/browser/browser_client.cc +++ b/brightray/browser/browser_client.cc @@ -8,7 +8,6 @@ #include "base/no_destructor.h" #include "base/path_service.h" #include "brightray/browser/browser_main_parts.h" -#include "brightray/browser/devtools_manager_delegate.h" #include "brightray/browser/media/media_capture_devices_dispatcher.h" #include "content/public/browser/browser_thread.h" #include "content/public/common/url_constants.h" @@ -73,17 +72,6 @@ content::MediaObserver* BrowserClient::GetMediaObserver() { return MediaCaptureDevicesDispatcher::GetInstance(); } -void BrowserClient::GetAdditionalAllowedSchemesForFileSystem( - std::vector* additional_schemes) { - additional_schemes->push_back(content::kChromeDevToolsScheme); - additional_schemes->push_back(content::kChromeUIScheme); -} - -void BrowserClient::GetAdditionalWebUISchemes( - std::vector* additional_schemes) { - additional_schemes->push_back(content::kChromeDevToolsScheme); -} - base::FilePath BrowserClient::GetDefaultDownloadDirectory() { // ~/Downloads base::FilePath path; @@ -93,10 +81,6 @@ base::FilePath BrowserClient::GetDefaultDownloadDirectory() { return path; } -content::DevToolsManagerDelegate* BrowserClient::GetDevToolsManagerDelegate() { - return new DevToolsManagerDelegate; -} - std::string BrowserClient::GetApplicationLocale() { if (BrowserThread::CurrentlyOn(BrowserThread::IO)) return g_io_thread_application_locale.Get(); diff --git a/brightray/browser/browser_client.h b/brightray/browser/browser_client.h index 3e59448c30735..7fbf1722a8cc4 100644 --- a/brightray/browser/browser_client.h +++ b/brightray/browser/browser_client.h @@ -30,12 +30,7 @@ class BrowserClient : public content::ContentBrowserClient { content::BrowserMainParts* CreateBrowserMainParts( const content::MainFunctionParams&) override; content::MediaObserver* GetMediaObserver() override; - void GetAdditionalAllowedSchemesForFileSystem( - std::vector* additional_schemes) override; - void GetAdditionalWebUISchemes( - std::vector* additional_schemes) override; base::FilePath GetDefaultDownloadDirectory() override; - content::DevToolsManagerDelegate* GetDevToolsManagerDelegate() override; std::string GetApplicationLocale() override; protected: diff --git a/brightray/browser/browser_main_parts.cc b/brightray/browser/browser_main_parts.cc index 41e417f3a5d8f..72637a2dc9029 100644 --- a/brightray/browser/browser_main_parts.cc +++ b/brightray/browser/browser_main_parts.cc @@ -23,9 +23,7 @@ #include "base/strings/string_number_conversions.h" #include "base/strings/utf_string_conversions.h" #include "brightray/browser/browser_client.h" -#include "brightray/browser/devtools_manager_delegate.h" #include "brightray/browser/media/media_capture_devices_dispatcher.h" -#include "brightray/browser/web_ui_controller_factory.h" #include "brightray/common/application_info.h" #include "brightray/common/main_delegate.h" #include "content/public/browser/browser_thread.h" @@ -275,16 +273,6 @@ void BrowserMainParts::PreMainMessageLoopStart() { media::SetLocalizedStringProvider(MediaStringProvider); } -void BrowserMainParts::PreMainMessageLoopRun() { - content::WebUIControllerFactory::RegisterFactory( - WebUIControllerFactory::GetInstance()); - - // --remote-debugging-port - auto* command_line = base::CommandLine::ForCurrentProcess(); - if (command_line->HasSwitch(switches::kRemoteDebuggingPort)) - DevToolsManagerDelegate::StartHttpHandler(); -} - void BrowserMainParts::PostMainMessageLoopStart() { #if defined(USE_X11) // Installs the X11 error handlers for the browser process after the diff --git a/brightray/browser/browser_main_parts.h b/brightray/browser/browser_main_parts.h index f4e345540b673..505689e6704c8 100644 --- a/brightray/browser/browser_main_parts.h +++ b/brightray/browser/browser_main_parts.h @@ -34,7 +34,6 @@ class BrowserMainParts : public content::BrowserMainParts { int PreEarlyInitialization() override; void ToolkitInitialized() override; void PreMainMessageLoopStart() override; - void PreMainMessageLoopRun() override; void PostMainMessageLoopStart() override; void PostMainMessageLoopRun() override; int PreCreateThreads() override; diff --git a/brightray/browser/inspectable_web_contents.cc b/brightray/browser/inspectable_web_contents.cc deleted file mode 100644 index e7c350a3e5c32..0000000000000 --- a/brightray/browser/inspectable_web_contents.cc +++ /dev/null @@ -1,14 +0,0 @@ -#include "brightray/browser/inspectable_web_contents.h" - -#include "brightray/browser/inspectable_web_contents_impl.h" - -namespace brightray { - -InspectableWebContents* InspectableWebContents::Create( - content::WebContents* web_contents, - PrefService* pref_service, - bool is_guest) { - return new InspectableWebContentsImpl(web_contents, pref_service, is_guest); -} - -} // namespace brightray diff --git a/brightray/browser/inspectable_web_contents_view_delegate.cc b/brightray/browser/inspectable_web_contents_view_delegate.cc deleted file mode 100644 index 4bc66a20a69d8..0000000000000 --- a/brightray/browser/inspectable_web_contents_view_delegate.cc +++ /dev/null @@ -1,9 +0,0 @@ -#include "brightray/browser/inspectable_web_contents_view_delegate.h" - -namespace brightray { - -gfx::ImageSkia InspectableWebContentsViewDelegate::GetDevToolsWindowIcon() { - return gfx::ImageSkia(); -} - -} // namespace brightray diff --git a/brightray/browser/web_ui_controller_factory.cc b/brightray/browser/web_ui_controller_factory.cc deleted file mode 100644 index 053318bccfbdf..0000000000000 --- a/brightray/browser/web_ui_controller_factory.cc +++ /dev/null @@ -1,62 +0,0 @@ -// Copyright (c) 2013 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE-CHROMIUM file. - -#include "brightray/browser/web_ui_controller_factory.h" - -#include "base/memory/singleton.h" -#include "brightray/browser/devtools_ui.h" -#include "content/public/browser/web_contents.h" -#include "content/public/browser/web_ui.h" -#include "content/public/common/url_constants.h" - -namespace brightray { - -namespace { - -const char kChromeUIDevToolsBundledHost[] = "devtools"; - -} // namespace - -// static -WebUIControllerFactory* WebUIControllerFactory::GetInstance() { - return base::Singleton::get(); -} - -WebUIControllerFactory::WebUIControllerFactory() {} - -WebUIControllerFactory::~WebUIControllerFactory() {} - -content::WebUI::TypeID WebUIControllerFactory::GetWebUIType( - content::BrowserContext* browser_context, - const GURL& url) const { - if (url.host() == kChromeUIDevToolsBundledHost) { - return const_cast(this); - } - - return content::WebUI::kNoWebUI; -} - -bool WebUIControllerFactory::UseWebUIForURL( - content::BrowserContext* browser_context, - const GURL& url) const { - return GetWebUIType(browser_context, url) != content::WebUI::kNoWebUI; -} - -bool WebUIControllerFactory::UseWebUIBindingsForURL( - content::BrowserContext* browser_context, - const GURL& url) const { - return UseWebUIForURL(browser_context, url); -} - -std::unique_ptr -WebUIControllerFactory::CreateWebUIControllerForURL(content::WebUI* web_ui, - const GURL& url) const { - if (url.host() == kChromeUIDevToolsBundledHost) { - auto* browser_context = web_ui->GetWebContents()->GetBrowserContext(); - return std::make_unique(browser_context, web_ui); - } - return std::unique_ptr(); -} - -} // namespace brightray diff --git a/brightray/browser/web_ui_controller_factory.h b/brightray/browser/web_ui_controller_factory.h deleted file mode 100644 index 9c280a8e8adf2..0000000000000 --- a/brightray/browser/web_ui_controller_factory.h +++ /dev/null @@ -1,48 +0,0 @@ -// Copyright (c) 2013 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE-CHROMIUM file. - -#ifndef BRIGHTRAY_BROWSER_WEB_UI_CONTROLLER_FACTORY_H_ -#define BRIGHTRAY_BROWSER_WEB_UI_CONTROLLER_FACTORY_H_ - -#include - -#include "base/macros.h" -#include "content/public/browser/web_ui.h" -#include "content/public/browser/web_ui_controller_factory.h" - -namespace base { -template -struct DefaultSingletonTraits; -} - -namespace brightray { - -class BrowserContext; - -class WebUIControllerFactory : public content::WebUIControllerFactory { - public: - static WebUIControllerFactory* GetInstance(); - - WebUIControllerFactory(); - ~WebUIControllerFactory() override; - - content::WebUI::TypeID GetWebUIType(content::BrowserContext* browser_context, - const GURL& url) const override; - bool UseWebUIForURL(content::BrowserContext* browser_context, - const GURL& url) const override; - bool UseWebUIBindingsForURL(content::BrowserContext* browser_context, - const GURL& url) const override; - std::unique_ptr CreateWebUIControllerForURL( - content::WebUI* web_ui, - const GURL& url) const override; - - private: - friend struct base::DefaultSingletonTraits; - - DISALLOW_COPY_AND_ASSIGN(WebUIControllerFactory); -}; - -} // namespace brightray - -#endif // BRIGHTRAY_BROWSER_WEB_UI_CONTROLLER_FACTORY_H_ diff --git a/chromium_src/BUILD.gn b/chromium_src/BUILD.gn index 6602ad13405cc..0f1a5ecd0835f 100644 --- a/chromium_src/BUILD.gn +++ b/chromium_src/BUILD.gn @@ -12,6 +12,12 @@ static_library("chrome") { sources = [ "//chrome/browser/browser_process.cc", "//chrome/browser/browser_process.h", + "//chrome/browser/devtools/devtools_contents_resizing_strategy.cc", + "//chrome/browser/devtools/devtools_contents_resizing_strategy.h", + "//chrome/browser/devtools/devtools_embedder_message_dispatcher.cc", + "//chrome/browser/devtools/devtools_embedder_message_dispatcher.h", + "//chrome/browser/devtools/devtools_file_system_indexer.cc", + "//chrome/browser/devtools/devtools_file_system_indexer.h", "//chrome/browser/extensions/global_shortcut_listener.cc", "//chrome/browser/extensions/global_shortcut_listener.h", "//chrome/browser/extensions/global_shortcut_listener_mac.h", diff --git a/filenames.gni b/filenames.gni index e45a0cd77709d..e261261267e89 100644 --- a/filenames.gni +++ b/filenames.gni @@ -400,6 +400,14 @@ filenames = { "atom/browser/ui/cocoa/root_view_mac.mm", "atom/browser/ui/cocoa/root_view_mac.h", "atom/browser/ui/cocoa/touch_bar_forward_declarations.h", + "atom/browser/ui/cocoa/atom_inspectable_web_contents_view.h", + "atom/browser/ui/cocoa/atom_inspectable_web_contents_view.mm", + "atom/browser/ui/cocoa/event_dispatching_window.h", + "atom/browser/ui/cocoa/event_dispatching_window.mm", + "atom/browser/ui/devtools_manager_delegate.cc", + "atom/browser/ui/devtools_manager_delegate.h", + "atom/browser/ui/devtools_ui.cc", + "atom/browser/ui/devtools_ui.h", "atom/browser/ui/drag_util_mac.mm", "atom/browser/ui/drag_util_views.cc", "atom/browser/ui/drag_util.h", @@ -407,6 +415,16 @@ filenames = { "atom/browser/ui/file_dialog_gtk.cc", "atom/browser/ui/file_dialog_mac.mm", "atom/browser/ui/file_dialog_win.cc", + "atom/browser/ui/inspectable_web_contents.cc", + "atom/browser/ui/inspectable_web_contents.h", + "atom/browser/ui/inspectable_web_contents_delegate.h", + "atom/browser/ui/inspectable_web_contents_impl.cc", + "atom/browser/ui/inspectable_web_contents_impl.h", + "atom/browser/ui/inspectable_web_contents_view.h", + "atom/browser/ui/inspectable_web_contents_view_delegate.cc", + "atom/browser/ui/inspectable_web_contents_view_delegate.h", + "atom/browser/ui/inspectable_web_contents_view_mac.h", + "atom/browser/ui/inspectable_web_contents_view_mac.mm", "atom/browser/ui/message_box.h", "atom/browser/ui/message_box_gtk.cc", "atom/browser/ui/message_box_mac.mm", @@ -423,12 +441,16 @@ filenames = { "atom/browser/ui/tray_icon_cocoa.mm", "atom/browser/ui/tray_icon_observer.h", "atom/browser/ui/tray_icon_win.cc", + "atom/browser/ui/views/atom_views_delegate.cc", + "atom/browser/ui/views/atom_views_delegate.h", "atom/browser/ui/views/autofill_popup_view.cc", "atom/browser/ui/views/autofill_popup_view.h", "atom/browser/ui/views/frameless_view.cc", "atom/browser/ui/views/frameless_view.h", "atom/browser/ui/views/global_menu_bar_x11.cc", "atom/browser/ui/views/global_menu_bar_x11.h", + "atom/browser/ui/views/inspectable_web_contents_view_views.cc", + "atom/browser/ui/views/inspectable_web_contents_view_views.h", "atom/browser/ui/views/menu_bar.cc", "atom/browser/ui/views/menu_bar.h", "atom/browser/ui/views/menu_delegate.cc", diff --git a/script/lint.js b/script/lint.js index f9465311b52fe..c8a79811bc234 100755 --- a/script/lint.js +++ b/script/lint.js @@ -19,6 +19,8 @@ const BLACKLIST = new Set([ ['atom', 'browser', 'ui', 'cocoa', 'atom_ns_window_delegate.h'], ['atom', 'browser', 'ui', 'cocoa', 'atom_preview_item.h'], ['atom', 'browser', 'ui', 'cocoa', 'atom_touch_bar.h'], + ['atom', 'browser', 'ui', 'cocoa', 'atom_inspectable_web_contents_view.h'], + ['atom', 'browser', 'ui', 'cocoa', 'event_dispatching_window.h'], ['atom', 'browser', 'ui', 'cocoa', 'touch_bar_forward_declarations.h'], ['atom', 'browser', 'ui', 'cocoa', 'NSColor+Hex.h'], ['atom', 'browser', 'ui', 'cocoa', 'NSString+ANSI.h'], @@ -27,8 +29,6 @@ const BLACKLIST = new Set([ ['atom', 'common', 'common_message_generator.h'], ['atom', 'common', 'node_includes.h'], ['atom', 'node', 'osfhandle.cc'], - ['brightray', 'browser', 'mac', 'bry_inspectable_web_contents_view.h'], - ['brightray', 'browser', 'mac', 'event_dispatching_window.h'], ['spec', 'static', 'jquery-2.0.3.min.js'] ].map(tokens => path.join(SOURCE_ROOT, ...tokens)))