refactor: move devtools from brightray to atom (#15234)

This commit is contained in:
Milan Burda 2018-10-19 15:50:30 +02:00 committed by Alexey Kuzmin
parent 122017e6fa
commit 6f3c46cc7e
58 changed files with 315 additions and 400 deletions

View file

@ -82,7 +82,7 @@ class BrowserWindow : public TopLevelWindow,
private: private:
#if defined(OS_MACOSX) #if defined(OS_MACOSX)
void OverrideNSWindowContentView(brightray::InspectableWebContents* iwc); void OverrideNSWindowContentView(InspectableWebContents* iwc);
#endif #endif
// Helpers. // Helpers.

View file

@ -8,9 +8,9 @@
#include "atom/browser/native_browser_view.h" #include "atom/browser/native_browser_view.h"
#include "atom/browser/native_window_mac.h" #include "atom/browser/native_window_mac.h"
#include "atom/browser/ui/inspectable_web_contents_view.h"
#include "atom/common/draggable_region.h" #include "atom/common/draggable_region.h"
#include "base/mac/scoped_nsobject.h" #include "base/mac/scoped_nsobject.h"
#include "brightray/browser/inspectable_web_contents_view.h"
@interface NSView (WebContentsView) @interface NSView (WebContentsView)
- (void)setMouseDownCanMoveWindow:(BOOL)can_move; - (void)setMouseDownCanMoveWindow:(BOOL)can_move;
@ -55,8 +55,7 @@ std::vector<gfx::Rect> CalculateNonDraggableRegions(
} // namespace } // namespace
void BrowserWindow::OverrideNSWindowContentView( void BrowserWindow::OverrideNSWindowContentView(InspectableWebContents* iwc) {
brightray::InspectableWebContents* iwc) {
// Make NativeWindow use a NSView as content view. // Make NativeWindow use a NSView as content view.
static_cast<NativeWindowMac*>(window())->OverrideNSWindowContentView(); static_cast<NativeWindowMac*>(window())->OverrideNSWindowContentView();
// Add webview to contentView. // Add webview to contentView.

View file

@ -22,6 +22,8 @@
#include "atom/browser/native_window.h" #include "atom/browser/native_window.h"
#include "atom/browser/net/atom_network_delegate.h" #include "atom/browser/net/atom_network_delegate.h"
#include "atom/browser/ui/drag_util.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_permission_helper.h"
#include "atom/browser/web_contents_preferences.h" #include "atom/browser/web_contents_preferences.h"
#include "atom/browser/web_contents_zoom_controller.h" #include "atom/browser/web_contents_zoom_controller.h"
@ -48,8 +50,6 @@
#include "base/threading/thread_restrictions.h" #include "base/threading/thread_restrictions.h"
#include "base/threading/thread_task_runner_handle.h" #include "base/threading/thread_task_runner_handle.h"
#include "base/values.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/browser_process.h"
#include "chrome/browser/ssl/security_state_tab_helper.h" #include "chrome/browser/ssl/security_state_tab_helper.h"
#include "content/browser/frame_host/frame_tree_node.h" #include "content/browser/frame_host/frame_tree_node.h"

View file

@ -29,10 +29,6 @@ namespace blink {
struct WebDeviceEmulationParams; struct WebDeviceEmulationParams;
} }
namespace brightray {
class InspectableWebContents;
}
namespace mate { namespace mate {
class Arguments; class Arguments;
class Dictionary; class Dictionary;
@ -46,6 +42,7 @@ namespace atom {
class AtomBrowserContext; class AtomBrowserContext;
class AtomJavaScriptDialogManager; class AtomJavaScriptDialogManager;
class InspectableWebContents;
class WebContentsZoomController; class WebContentsZoomController;
class WebViewGuestDelegate; class WebViewGuestDelegate;
class FrameSubscriber; class FrameSubscriber;
@ -419,10 +416,10 @@ class WebContents : public mate::TrackableObject<WebContents>,
content::WebContentsObserver::MediaStoppedReason reason) override; content::WebContentsObserver::MediaStoppedReason reason) override;
void DidChangeThemeColor(SkColor theme_color) override; void DidChangeThemeColor(SkColor theme_color) override;
// brightray::InspectableWebContentsDelegate: // InspectableWebContentsDelegate:
void DevToolsReloadPage() override; void DevToolsReloadPage() override;
// brightray::InspectableWebContentsViewDelegate: // InspectableWebContentsViewDelegate:
void DevToolsFocused() override; void DevToolsFocused() override;
void DevToolsOpened() override; void DevToolsOpened() override;
void DevToolsClosed() override; void DevToolsClosed() override;

View file

@ -5,8 +5,8 @@
#include "atom/browser/api/atom_api_web_contents_view.h" #include "atom/browser/api/atom_api_web_contents_view.h"
#include "atom/browser/api/atom_api_web_contents.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 "atom/common/api/constructor.h"
#include "brightray/browser/inspectable_web_contents_view.h"
#include "content/public/browser/web_contents_user_data.h" #include "content/public/browser/web_contents_user_data.h"
#include "native_mate/dictionary.h" #include "native_mate/dictionary.h"
@ -43,7 +43,7 @@ namespace api {
WebContentsView::WebContentsView(v8::Isolate* isolate, WebContentsView::WebContentsView(v8::Isolate* isolate,
mate::Handle<WebContents> web_contents, mate::Handle<WebContents> web_contents,
brightray::InspectableWebContents* iwc) InspectableWebContents* iwc)
#if defined(OS_MACOSX) #if defined(OS_MACOSX)
: View(new DelayedNativeViewHost(iwc->GetView()->GetNativeView())), : View(new DelayedNativeViewHost(iwc->GetView()->GetNativeView())),
#else #else

View file

@ -9,12 +9,10 @@
#include "content/public/browser/web_contents_observer.h" #include "content/public/browser/web_contents_observer.h"
#include "native_mate/handle.h" #include "native_mate/handle.h"
namespace brightray {
class InspectableWebContents;
}
namespace atom { namespace atom {
class InspectableWebContents;
namespace api { namespace api {
class WebContents; class WebContents;
@ -30,7 +28,7 @@ class WebContentsView : public View, public content::WebContentsObserver {
protected: protected:
WebContentsView(v8::Isolate* isolate, WebContentsView(v8::Isolate* isolate,
mate::Handle<WebContents> web_contents, mate::Handle<WebContents> web_contents,
brightray::InspectableWebContents* iwc); InspectableWebContents* iwc);
~WebContentsView() override; ~WebContentsView() override;
// content::WebContentsObserver: // content::WebContentsObserver:

View file

@ -26,6 +26,7 @@
#include "atom/browser/notifications/notification_presenter.h" #include "atom/browser/notifications/notification_presenter.h"
#include "atom/browser/notifications/platform_notification_service.h" #include "atom/browser/notifications/platform_notification_service.h"
#include "atom/browser/session_preferences.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_permission_helper.h"
#include "atom/browser/web_contents_preferences.h" #include "atom/browser/web_contents_preferences.h"
#include "atom/browser/window_list.h" #include "atom/browser/window_list.h"
@ -494,6 +495,11 @@ void AtomBrowserClient::GetAdditionalAllowedSchemesForFileSystem(
additional_schemes->push_back(content::kChromeDevToolsScheme); additional_schemes->push_back(content::kChromeDevToolsScheme);
} }
void AtomBrowserClient::GetAdditionalWebUISchemes(
std::vector<std::string>* additional_schemes) {
additional_schemes->push_back(content::kChromeDevToolsScheme);
}
void AtomBrowserClient::SiteInstanceDeleting( void AtomBrowserClient::SiteInstanceDeleting(
content::SiteInstance* site_instance) { content::SiteInstance* site_instance) {
// We are storing weak_ptr, is it fundamental to maintain the map up-to-date // We are storing weak_ptr, is it fundamental to maintain the map up-to-date
@ -677,6 +683,11 @@ AtomBrowserClient::CreateThrottlesForNavigation(
return throttles; return throttles;
} }
content::DevToolsManagerDelegate*
AtomBrowserClient::GetDevToolsManagerDelegate() {
return new DevToolsManagerDelegate;
}
NotificationPresenter* AtomBrowserClient::GetNotificationPresenter() { NotificationPresenter* AtomBrowserClient::GetNotificationPresenter() {
if (!notification_presenter_) { if (!notification_presenter_) {
notification_presenter_.reset(NotificationPresenter::Create()); notification_presenter_.reset(NotificationPresenter::Create());

View file

@ -111,7 +111,9 @@ class AtomBrowserClient : public brightray::BrowserClient,
bool opener_suppressed, bool opener_suppressed,
bool* no_javascript_access) override; bool* no_javascript_access) override;
void GetAdditionalAllowedSchemesForFileSystem( void GetAdditionalAllowedSchemesForFileSystem(
std::vector<std::string>* schemes) override; std::vector<std::string>* additional_schemes) override;
void GetAdditionalWebUISchemes(
std::vector<std::string>* additional_schemes) override;
void SiteInstanceDeleting(content::SiteInstance* site_instance) override; void SiteInstanceDeleting(content::SiteInstance* site_instance) override;
std::unique_ptr<net::ClientCertStore> CreateClientCertStore( std::unique_ptr<net::ClientCertStore> CreateClientCertStore(
content::ResourceContext* resource_context) override; content::ResourceContext* resource_context) override;
@ -125,6 +127,7 @@ class AtomBrowserClient : public brightray::BrowserClient,
std::unique_ptr<base::Value> GetServiceManifestOverlay( std::unique_ptr<base::Value> GetServiceManifestOverlay(
base::StringPiece name) override; base::StringPiece name) override;
net::NetLog* GetNetLog() override; net::NetLog* GetNetLog() override;
content::DevToolsManagerDelegate* GetDevToolsManagerDelegate() override;
content::PlatformNotificationService* GetPlatformNotificationService() content::PlatformNotificationService* GetPlatformNotificationService()
override; override;

View file

@ -15,6 +15,7 @@
#include "atom/browser/net/resolve_proxy_helper.h" #include "atom/browser/net/resolve_proxy_helper.h"
#include "atom/browser/pref_store_delegate.h" #include "atom/browser/pref_store_delegate.h"
#include "atom/browser/special_storage_policy.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/browser/web_view_manager.h"
#include "atom/common/atom_version.h" #include "atom/common/atom_version.h"
#include "atom/common/chrome_version.h" #include "atom/common/chrome_version.h"
@ -27,7 +28,6 @@
#include "base/threading/sequenced_task_runner_handle.h" #include "base/threading/sequenced_task_runner_handle.h"
#include "base/threading/thread_restrictions.h" #include "base/threading/thread_restrictions.h"
#include "brightray/browser/brightray_paths.h" #include "brightray/browser/brightray_paths.h"
#include "brightray/browser/inspectable_web_contents_impl.h"
#include "brightray/browser/zoom_level_delegate.h" #include "brightray/browser/zoom_level_delegate.h"
#include "brightray/common/application_info.h" #include "brightray/common/application_info.h"
#include "chrome/common/chrome_paths.h" #include "chrome/common/chrome_paths.h"
@ -152,7 +152,7 @@ void AtomBrowserContext::InitPrefs() {
registry->RegisterFilePathPref(prefs::kDownloadDefaultDirectory, registry->RegisterFilePathPref(prefs::kDownloadDefaultDirectory,
download_dir); download_dir);
registry->RegisterDictionaryPref(prefs::kDevToolsFileSystemPaths); registry->RegisterDictionaryPref(prefs::kDevToolsFileSystemPaths);
brightray::InspectableWebContentsImpl::RegisterPrefs(registry.get()); InspectableWebContentsImpl::RegisterPrefs(registry.get());
brightray::MediaDeviceIDSalt::RegisterPrefs(registry.get()); brightray::MediaDeviceIDSalt::RegisterPrefs(registry.get());
brightray::ZoomLevelDelegate::RegisterPrefs(registry.get()); brightray::ZoomLevelDelegate::RegisterPrefs(registry.get());
PrefProxyConfigTrackerImpl::RegisterPrefs(registry.get()); PrefProxyConfigTrackerImpl::RegisterPrefs(registry.get());

View file

@ -10,10 +10,12 @@
#include "atom/browser/api/trackable_object.h" #include "atom/browser/api/trackable_object.h"
#include "atom/browser/atom_browser_client.h" #include "atom/browser/atom_browser_client.h"
#include "atom/browser/atom_browser_context.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/browser.h"
#include "atom/browser/io_thread.h" #include "atom/browser/io_thread.h"
#include "atom/browser/javascript_environment.h" #include "atom/browser/javascript_environment.h"
#include "atom/browser/node_debugger.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/api/atom_bindings.h"
#include "atom/common/asar/asar_util.h" #include "atom/common/asar/asar_util.h"
#include "atom/common/node_bindings.h" #include "atom/common/node_bindings.h"
@ -25,6 +27,8 @@
#include "components/net_log/chrome_net_log.h" #include "components/net_log/chrome_net_log.h"
#include "components/net_log/net_export_file_writer.h" #include "components/net_log/net_export_file_writer.h"
#include "content/public/browser/child_process_security_policy.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/result_codes.h"
#include "content/public/common/service_manager_connection.h" #include "content/public/common/service_manager_connection.h"
#include "electron/buildflags/buildflags.h" #include "electron/buildflags/buildflags.h"
@ -39,14 +43,10 @@
#include "ui/events/devices/x11/touch_factory_x11.h" #include "ui/events/devices/x11/touch_factory_x11.h"
#endif #endif
#if BUILDFLAG(ENABLE_PDF_VIEWER)
#include "atom/browser/atom_web_ui_controller_factory.h"
#endif // BUILDFLAG(ENABLE_PDF_VIEWER)
#if defined(OS_MACOSX) #if defined(OS_MACOSX)
#include "atom/browser/ui/cocoa/views_delegate_mac.h" #include "atom/browser/ui/cocoa/views_delegate_mac.h"
#else #else
#include "brightray/browser/views/views_delegate.h" #include "atom/browser/ui/views/atom_views_delegate.h"
#endif #endif
// Must be included after all other headers. // Must be included after all other headers.
@ -212,7 +212,7 @@ void AtomBrowserMainParts::ToolkitInitialized() {
#if defined(OS_MACOSX) #if defined(OS_MACOSX)
views_delegate_.reset(new ViewsDelegateMac); views_delegate_.reset(new ViewsDelegateMac);
#else #else
views_delegate_.reset(new brightray::ViewsDelegate); views_delegate_.reset(new ViewsDelegate);
#endif #endif
} }
@ -231,12 +231,13 @@ void AtomBrowserMainParts::PreMainMessageLoopRun() {
base::Bind(&v8::Isolate::LowMemoryNotification, base::Bind(&v8::Isolate::LowMemoryNotification,
base::Unretained(js_env_->isolate()))); base::Unretained(js_env_->isolate())));
#if BUILDFLAG(ENABLE_PDF_VIEWER)
content::WebUIControllerFactory::RegisterFactory( content::WebUIControllerFactory::RegisterFactory(
AtomWebUIControllerFactory::GetInstance()); 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) #if defined(USE_X11)
libgtkui::GtkInitFromCommandLine(*base::CommandLine::ForCurrentProcess()); libgtkui::GtkInitFromCommandLine(*base::CommandLine::ForCurrentProcess());

View file

@ -19,12 +19,6 @@
class BrowserProcess; class BrowserProcess;
class IconManager; class IconManager;
#if defined(TOOLKIT_VIEWS)
namespace brightray {
class ViewsDelegate;
}
#endif
namespace net_log { namespace net_log {
class ChromeNetLog; class ChromeNetLog;
} }
@ -40,6 +34,10 @@ class NodeDebugger;
class NodeEnvironment; class NodeEnvironment;
class BridgeTaskRunner; class BridgeTaskRunner;
#if defined(TOOLKIT_VIEWS)
class ViewsDelegate;
#endif
#if defined(OS_MACOSX) #if defined(OS_MACOSX)
class ViewsDelegateMac; class ViewsDelegateMac;
#endif #endif
@ -103,7 +101,7 @@ class AtomBrowserMainParts : public brightray::BrowserMainParts {
#if defined(OS_MACOSX) #if defined(OS_MACOSX)
std::unique_ptr<ViewsDelegateMac> views_delegate_; std::unique_ptr<ViewsDelegateMac> views_delegate_;
#else #else
std::unique_ptr<brightray::ViewsDelegate> views_delegate_; std::unique_ptr<ViewsDelegate> views_delegate_;
#endif #endif
// A fake BrowserProcess object that used to feed the source code from chrome. // A fake BrowserProcess object that used to feed the source code from chrome.

View file

@ -13,12 +13,20 @@
#include "atom/common/atom_constants.h" #include "atom/common/atom_constants.h"
#include "base/strings/string_split.h" #include "base/strings/string_split.h"
#include "base/strings/string_util.h" #include "base/strings/string_util.h"
#include "content/public/browser/web_contents.h"
#include "net/base/escape.h" #include "net/base/escape.h"
#endif // BUILDFLAG(ENABLE_PDF_VIEWER) #endif // BUILDFLAG(ENABLE_PDF_VIEWER)
#include "atom/browser/ui/devtools_ui.h"
#include "content/public/browser/web_contents.h"
namespace atom { namespace atom {
namespace {
const char kChromeUIDevToolsBundledHost[] = "devtools";
} // namespace
// static // static
AtomWebUIControllerFactory* AtomWebUIControllerFactory::GetInstance() { AtomWebUIControllerFactory* AtomWebUIControllerFactory::GetInstance() {
return base::Singleton<AtomWebUIControllerFactory>::get(); return base::Singleton<AtomWebUIControllerFactory>::get();
@ -36,6 +44,9 @@ content::WebUI::TypeID AtomWebUIControllerFactory::GetWebUIType(
return const_cast<AtomWebUIControllerFactory*>(this); return const_cast<AtomWebUIControllerFactory*>(this);
} }
#endif // BUILDFLAG(ENABLE_PDF_VIEWER) #endif // BUILDFLAG(ENABLE_PDF_VIEWER)
if (url.host() == kChromeUIDevToolsBundledHost) {
return const_cast<AtomWebUIControllerFactory*>(this);
}
return content::WebUI::kNoWebUI; return content::WebUI::kNoWebUI;
} }
@ -78,6 +89,10 @@ AtomWebUIControllerFactory::CreateWebUIControllerForURL(content::WebUI* web_ui,
return new PdfViewerUI(browser_context, web_ui, src); return new PdfViewerUI(browser_context, web_ui, src);
} }
#endif // BUILDFLAG(ENABLE_PDF_VIEWER) #endif // BUILDFLAG(ENABLE_PDF_VIEWER)
if (url.host() == kChromeUIDevToolsBundledHost) {
auto* browser_context = web_ui->GetWebContents()->GetBrowserContext();
return std::make_unique<DevToolsUI>(browser_context, web_ui);
}
return std::unique_ptr<content::WebUIController>(); return std::unique_ptr<content::WebUIController>();
} }

View file

@ -188,7 +188,7 @@ void CommonWebContentsDelegate::InitWithWebContents(
!web_preferences || web_preferences->IsEnabled(options::kOffscreen); !web_preferences || web_preferences->IsEnabled(options::kOffscreen);
// Create InspectableWebContents. // Create InspectableWebContents.
web_contents_.reset(brightray::InspectableWebContents::Create( web_contents_.reset(InspectableWebContents::Create(
web_contents, browser_context->prefs(), is_guest)); web_contents, browser_context->prefs(), is_guest));
web_contents_->SetDelegate(this); 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. // is required to get the right quit closure for the main message loop.
base::ThreadTaskRunnerHandle::Get()->PostNonNestableTask( base::ThreadTaskRunnerHandle::Get()->PostNonNestableTask(
FROM_HERE, FROM_HERE,
base::BindOnce([](scoped_refptr<AtomBrowserContext> browser_context, base::BindOnce(
std::unique_ptr<brightray::InspectableWebContents> [](scoped_refptr<AtomBrowserContext> browser_context,
web_contents) { web_contents.reset(); }, std::unique_ptr<InspectableWebContents> web_contents) {
base::RetainedRef(browser_context_), web_contents.reset();
std::move(web_contents_))); },
base::RetainedRef(browser_context_), std::move(web_contents_)));
} else { } else {
web_contents_.reset(); web_contents_.reset();
} }

View file

@ -10,10 +10,10 @@
#include <string> #include <string>
#include <vector> #include <vector>
#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 "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 "chrome/browser/devtools/devtools_file_system_indexer.h"
#include "content/public/browser/web_contents_delegate.h" #include "content/public/browser/web_contents_delegate.h"
#include "electron/buildflags/buildflags.h" #include "electron/buildflags/buildflags.h"
@ -36,10 +36,9 @@ class WebDialogHelper;
class OffScreenRenderWidgetHostView; class OffScreenRenderWidgetHostView;
#endif #endif
class CommonWebContentsDelegate class CommonWebContentsDelegate : public content::WebContentsDelegate,
: public content::WebContentsDelegate, public InspectableWebContentsDelegate,
public brightray::InspectableWebContentsDelegate, public InspectableWebContentsViewDelegate {
public brightray::InspectableWebContentsViewDelegate {
public: public:
CommonWebContentsDelegate(); CommonWebContentsDelegate();
~CommonWebContentsDelegate() override; ~CommonWebContentsDelegate() override;
@ -61,7 +60,7 @@ class CommonWebContentsDelegate
// Returns the WebContents of devtools. // Returns the WebContents of devtools.
content::WebContents* GetDevToolsWebContents() const; content::WebContents* GetDevToolsWebContents() const;
brightray::InspectableWebContents* managed_web_contents() const { InspectableWebContents* managed_web_contents() const {
return web_contents_.get(); return web_contents_.get();
} }
@ -115,7 +114,7 @@ class CommonWebContentsDelegate
void HideAutofillPopup(); void HideAutofillPopup();
#endif #endif
// brightray::InspectableWebContentsDelegate: // InspectableWebContentsDelegate:
void DevToolsSaveToFile(const std::string& url, void DevToolsSaveToFile(const std::string& url,
const std::string& content, const std::string& content,
bool save_as) override; bool save_as) override;
@ -134,7 +133,7 @@ class CommonWebContentsDelegate
const std::string& file_system_path, const std::string& file_system_path,
const std::string& query) override; const std::string& query) override;
// brightray::InspectableWebContentsViewDelegate: // InspectableWebContentsViewDelegate:
#if defined(TOOLKIT_VIEWS) && !defined(OS_MACOSX) #if defined(TOOLKIT_VIEWS) && !defined(OS_MACOSX)
gfx::ImageSkia GetDevToolsWindowIcon() override; gfx::ImageSkia GetDevToolsWindowIcon() override;
#endif #endif
@ -189,7 +188,7 @@ class CommonWebContentsDelegate
// Notice that web_contents_ must be placed after dialog_manager_, so we can // Notice that web_contents_ must be placed after dialog_manager_, so we can
// make sure web_contents_ is destroyed before dialog_manager_, otherwise a // make sure web_contents_ is destroyed before dialog_manager_, otherwise a
// crash would happen. // crash would happen.
std::unique_ptr<brightray::InspectableWebContents> web_contents_; std::unique_ptr<InspectableWebContents> web_contents_;
// Maps url to file path, used by the file requests sent from devtools. // Maps url to file path, used by the file requests sent from devtools.
typedef std::map<std::string, base::FilePath> PathsMap; typedef std::map<std::string, base::FilePath> PathsMap;

View file

@ -6,8 +6,8 @@
#import <Cocoa/Cocoa.h> #import <Cocoa/Cocoa.h>
#include "atom/browser/ui/cocoa/event_dispatching_window.h"
#include "atom/browser/web_contents_preferences.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 "content/public/browser/native_web_keyboard_event.h"
#include "ui/events/keycodes/keyboard_codes.h" #include "ui/events/keycodes/keyboard_codes.h"

View file

@ -7,18 +7,17 @@
#include "atom/browser/native_browser_view.h" #include "atom/browser/native_browser_view.h"
#include "atom/browser/api/atom_api_web_contents.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 { namespace atom {
NativeBrowserView::NativeBrowserView( NativeBrowserView::NativeBrowserView(
brightray::InspectableWebContents* inspectable_web_contents) InspectableWebContents* inspectable_web_contents)
: inspectable_web_contents_(inspectable_web_contents) {} : inspectable_web_contents_(inspectable_web_contents) {}
NativeBrowserView::~NativeBrowserView() {} NativeBrowserView::~NativeBrowserView() {}
brightray::InspectableWebContentsView* InspectableWebContentsView* NativeBrowserView::GetInspectableWebContentsView() {
NativeBrowserView::GetInspectableWebContentsView() {
return inspectable_web_contents_->GetView(); return inspectable_web_contents_->GetView();
} }

View file

@ -12,11 +12,6 @@
#include "content/public/browser/web_contents.h" #include "content/public/browser/web_contents.h"
#include "third_party/skia/include/core/SkColor.h" #include "third_party/skia/include/core/SkColor.h"
namespace brightray {
class InspectableWebContents;
class InspectableWebContentsView;
} // namespace brightray
namespace gfx { namespace gfx {
class Rect; class Rect;
} }
@ -28,18 +23,21 @@ enum AutoResizeFlags {
kAutoResizeHeight = 0x2, kAutoResizeHeight = 0x2,
}; };
class InspectableWebContents;
class InspectableWebContentsView;
class NativeBrowserView { class NativeBrowserView {
public: public:
virtual ~NativeBrowserView(); virtual ~NativeBrowserView();
static NativeBrowserView* Create( static NativeBrowserView* Create(
brightray::InspectableWebContents* inspectable_web_contents); InspectableWebContents* inspectable_web_contents);
brightray::InspectableWebContents* GetInspectableWebContents() { InspectableWebContents* GetInspectableWebContents() {
return inspectable_web_contents_; return inspectable_web_contents_;
} }
brightray::InspectableWebContentsView* GetInspectableWebContentsView(); InspectableWebContentsView* GetInspectableWebContentsView();
content::WebContents* GetWebContents(); content::WebContents* GetWebContents();
virtual void SetAutoResizeFlags(uint8_t flags) = 0; virtual void SetAutoResizeFlags(uint8_t flags) = 0;
@ -51,10 +49,9 @@ class NativeBrowserView {
const std::vector<gfx::Rect>& system_drag_exclude_areas) {} const std::vector<gfx::Rect>& system_drag_exclude_areas) {}
protected: protected:
explicit NativeBrowserView( explicit NativeBrowserView(InspectableWebContents* inspectable_web_contents);
brightray::InspectableWebContents* inspectable_web_contents);
brightray::InspectableWebContents* inspectable_web_contents_; InspectableWebContents* inspectable_web_contents_;
private: private:
DISALLOW_COPY_AND_ASSIGN(NativeBrowserView); DISALLOW_COPY_AND_ASSIGN(NativeBrowserView);

View file

@ -17,7 +17,7 @@ namespace atom {
class NativeBrowserViewMac : public NativeBrowserView { class NativeBrowserViewMac : public NativeBrowserView {
public: public:
explicit NativeBrowserViewMac( explicit NativeBrowserViewMac(
brightray::InspectableWebContents* inspectable_web_contents); InspectableWebContents* inspectable_web_contents);
~NativeBrowserViewMac() override; ~NativeBrowserViewMac() override;
void SetAutoResizeFlags(uint8_t flags) override; void SetAutoResizeFlags(uint8_t flags) override;

View file

@ -4,8 +4,8 @@
#include "atom/browser/native_browser_view_mac.h" #include "atom/browser/native_browser_view_mac.h"
#include "brightray/browser/inspectable_web_contents.h" #include "atom/browser/ui/inspectable_web_contents.h"
#include "brightray/browser/inspectable_web_contents_view.h" #include "atom/browser/ui/inspectable_web_contents_view.h"
#include "skia/ext/skia_utils_mac.h" #include "skia/ext/skia_utils_mac.h"
#include "ui/gfx/geometry/rect.h" #include "ui/gfx/geometry/rect.h"
@ -158,7 +158,7 @@ const NSAutoresizingMaskOptions kDefaultAutoResizingMask =
namespace atom { namespace atom {
NativeBrowserViewMac::NativeBrowserViewMac( NativeBrowserViewMac::NativeBrowserViewMac(
brightray::InspectableWebContents* inspectable_web_contents) InspectableWebContents* inspectable_web_contents)
: NativeBrowserView(inspectable_web_contents) { : NativeBrowserView(inspectable_web_contents) {
auto* view = GetInspectableWebContentsView()->GetNativeView(); auto* view = GetInspectableWebContentsView()->GetNativeView();
view.autoresizingMask = kDefaultAutoResizingMask; view.autoresizingMask = kDefaultAutoResizingMask;
@ -233,7 +233,7 @@ void NativeBrowserViewMac::UpdateDraggableRegions(
// static // static
NativeBrowserView* NativeBrowserView::Create( NativeBrowserView* NativeBrowserView::Create(
brightray::InspectableWebContents* inspectable_web_contents) { InspectableWebContents* inspectable_web_contents) {
return new NativeBrowserViewMac(inspectable_web_contents); return new NativeBrowserViewMac(inspectable_web_contents);
} }

View file

@ -4,7 +4,7 @@
#include "atom/browser/native_browser_view_views.h" #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/gfx/geometry/rect.h"
#include "ui/views/background.h" #include "ui/views/background.h"
#include "ui/views/view.h" #include "ui/views/view.h"
@ -12,7 +12,7 @@
namespace atom { namespace atom {
NativeBrowserViewViews::NativeBrowserViewViews( NativeBrowserViewViews::NativeBrowserViewViews(
brightray::InspectableWebContents* inspectable_web_contents) InspectableWebContents* inspectable_web_contents)
: NativeBrowserView(inspectable_web_contents) {} : NativeBrowserView(inspectable_web_contents) {}
NativeBrowserViewViews::~NativeBrowserViewViews() {} NativeBrowserViewViews::~NativeBrowserViewViews() {}
@ -33,7 +33,7 @@ void NativeBrowserViewViews::SetBackgroundColor(SkColor color) {
// static // static
NativeBrowserView* NativeBrowserView::Create( NativeBrowserView* NativeBrowserView::Create(
brightray::InspectableWebContents* inspectable_web_contents) { InspectableWebContents* inspectable_web_contents) {
return new NativeBrowserViewViews(inspectable_web_contents); return new NativeBrowserViewViews(inspectable_web_contents);
} }

View file

@ -12,7 +12,7 @@ namespace atom {
class NativeBrowserViewViews : public NativeBrowserView { class NativeBrowserViewViews : public NativeBrowserView {
public: public:
explicit NativeBrowserViewViews( explicit NativeBrowserViewViews(
brightray::InspectableWebContents* inspectable_web_contents); InspectableWebContents* inspectable_web_contents);
~NativeBrowserViewViews() override; ~NativeBrowserViewViews() override;
uint8_t GetAutoResizeFlags() { return auto_resize_flags_; } uint8_t GetAutoResizeFlags() { return auto_resize_flags_; }

View file

@ -16,13 +16,13 @@
#include "atom/browser/ui/cocoa/atom_preview_item.h" #include "atom/browser/ui/cocoa/atom_preview_item.h"
#include "atom/browser/ui/cocoa/atom_touch_bar.h" #include "atom/browser/ui/cocoa/atom_touch_bar.h"
#include "atom/browser/ui/cocoa/root_view_mac.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/browser/window_list.h"
#include "atom/common/options_switches.h" #include "atom/common/options_switches.h"
#include "base/mac/mac_util.h" #include "base/mac/mac_util.h"
#include "base/mac/scoped_cftyperef.h" #include "base/mac/scoped_cftyperef.h"
#include "base/strings/sys_string_conversions.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 "content/public/browser/browser_accessibility_state.h"
#include "native_mate/dictionary.h" #include "native_mate/dictionary.h"
#include "skia/ext/skia_utils_mac.h" #include "skia/ext/skia_utils_mac.h"

View file

@ -15,6 +15,8 @@
#include "atom/browser/api/atom_api_web_contents.h" #include "atom/browser/api/atom_api_web_contents.h"
#include "atom/browser/native_browser_view_views.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/ui/views/root_view.h"
#include "atom/browser/web_contents_preferences.h" #include "atom/browser/web_contents_preferences.h"
#include "atom/browser/web_view_manager.h" #include "atom/browser/web_view_manager.h"
@ -23,8 +25,6 @@
#include "atom/common/native_mate_converters/image_converter.h" #include "atom/common/native_mate_converters/image_converter.h"
#include "atom/common/options_switches.h" #include "atom/common/options_switches.h"
#include "base/strings/utf_string_conversions.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 "content/public/browser/browser_thread.h"
#include "native_mate/dictionary.h" #include "native_mate/dictionary.h"
#include "ui/aura/window_tree_host.h" #include "ui/aura/window_tree_host.h"

View file

@ -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 <AppKit/AppKit.h> #import <AppKit/AppKit.h>
#include "base/mac/scoped_nsobject.h" #include "base/mac/scoped_nsobject.h"
#include "chrome/browser/devtools/devtools_contents_resizing_strategy.h" #include "chrome/browser/devtools/devtools_contents_resizing_strategy.h"
#include "ui/base/cocoa/base_view.h" #include "ui/base/cocoa/base_view.h"
namespace brightray { namespace atom {
class InspectableWebContentsViewMac; class InspectableWebContentsViewMac;
} }
using brightray::InspectableWebContentsViewMac; using atom::InspectableWebContentsViewMac;
@interface BRYInspectableWebContentsView : BaseView <NSWindowDelegate> { @interface AtomInspectableWebContentsView : BaseView <NSWindowDelegate> {
@private @private
brightray::InspectableWebContentsViewMac* inspectableWebContentsView_; atom::InspectableWebContentsViewMac* inspectableWebContentsView_;
base::scoped_nsobject<NSView> fake_view_; base::scoped_nsobject<NSView> fake_view_;
base::scoped_nsobject<NSWindow> devtools_window_; base::scoped_nsobject<NSWindow> devtools_window_;
@ -36,3 +43,5 @@ using brightray::InspectableWebContentsViewMac;
- (void)setTitle:(NSString*)title; - (void)setTitle:(NSString*)title;
@end @end
#endif // ATOM_BROWSER_UI_COCOA_BRY_INSPECTABLE_WEB_CONTENTS_VIEW_H_

View file

@ -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 "atom/browser/ui/cocoa/atom_inspectable_web_contents_view.h"
#include "brightray/browser/inspectable_web_contents_view_delegate.h"
#include "brightray/browser/inspectable_web_contents_view_mac.h" #include "atom/browser/ui/cocoa/event_dispatching_window.h"
#include "brightray/browser/mac/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 "content/public/browser/render_widget_host_view.h"
#include "ui/gfx/mac/scoped_cocoa_disable_screen_updates.h" #include "ui/gfx/mac/scoped_cocoa_disable_screen_updates.h"
@implementation BRYInspectableWebContentsView @implementation AtomInspectableWebContentsView
- (instancetype)initWithInspectableWebContentsViewMac: - (instancetype)initWithInspectableWebContentsViewMac:
(InspectableWebContentsViewMac*)view { (InspectableWebContentsViewMac*)view {

View file

@ -5,7 +5,7 @@
#ifndef ATOM_BROWSER_UI_COCOA_ATOM_NS_WINDOW_H_ #ifndef ATOM_BROWSER_UI_COCOA_ATOM_NS_WINDOW_H_
#define 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/cocoa/native_widget_mac_nswindow.h"
#include "ui/views/widget/native_widget_mac.h" #include "ui/views/widget/native_widget_mac.h"

View file

@ -2,8 +2,8 @@
// Use of this source code is governed by the MIT license that can be // Use of this source code is governed by the MIT license that can be
// found in the LICENSE file. // found in the LICENSE file.
#ifndef BROWSER_EVENT_DISPATCHING_WINDOW_H_ #ifndef ATOM_BROWSER_UI_COCOA_EVENT_DISPATCHING_WINDOW_H_
#define BROWSER_EVENT_DISPATCHING_WINDOW_H_ #define ATOM_BROWSER_UI_COCOA_EVENT_DISPATCHING_WINDOW_H_
#import "ui/base/cocoa/underlay_opengl_hosting_window.h" #import "ui/base/cocoa/underlay_opengl_hosting_window.h"
@ -16,4 +16,4 @@
@end @end
#endif // BROWSER_EVENT_DISPATCHING_WINDOW_H_ #endif // ATOM_BROWSER_UI_COCOA_EVENT_DISPATCHING_WINDOW_H_

View file

@ -2,7 +2,7 @@
// Use of this source code is governed by the MIT license that can be // Use of this source code is governed by the MIT license that can be
// found in the LICENSE file. // found in the LICENSE file.
#include "brightray/browser/mac/event_dispatching_window.h" #include "atom/browser/ui/cocoa/event_dispatching_window.h"
@implementation EventDispatchingWindow @implementation EventDispatchingWindow

View file

@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE-CHROMIUM file. // found in the LICENSE-CHROMIUM file.
#include "brightray/browser/devtools_manager_delegate.h" #include "atom/browser/ui/devtools_manager_delegate.h"
#include <memory> #include <memory>
#include <vector> #include <vector>
@ -28,7 +28,7 @@
#include "net/socket/tcp_server_socket.h" #include "net/socket/tcp_server_socket.h"
#include "ui/base/resource/resource_bundle.h" #include "ui/base/resource/resource_bundle.h"
namespace brightray { namespace atom {
namespace { namespace {
@ -116,4 +116,4 @@ bool DevToolsManagerDelegate::HasBundledFrontendResources() {
return true; return true;
} }
} // namespace brightray } // namespace atom

View file

@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE-CHROMIUM file. // found in the LICENSE-CHROMIUM file.
#ifndef BRIGHTRAY_BROWSER_DEVTOOLS_MANAGER_DELEGATE_H_ #ifndef ATOM_BROWSER_UI_DEVTOOLS_MANAGER_DELEGATE_H_
#define BRIGHTRAY_BROWSER_DEVTOOLS_MANAGER_DELEGATE_H_ #define ATOM_BROWSER_UI_DEVTOOLS_MANAGER_DELEGATE_H_
#include <string> #include <string>
@ -11,7 +11,7 @@
#include "base/macros.h" #include "base/macros.h"
#include "content/public/browser/devtools_manager_delegate.h" #include "content/public/browser/devtools_manager_delegate.h"
namespace brightray { namespace atom {
class DevToolsManagerDelegate : public content::DevToolsManagerDelegate { class DevToolsManagerDelegate : public content::DevToolsManagerDelegate {
public: public:
@ -34,6 +34,6 @@ class DevToolsManagerDelegate : public content::DevToolsManagerDelegate {
DISALLOW_COPY_AND_ASSIGN(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_

View file

@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE-CHROMIUM file. // found in the LICENSE-CHROMIUM file.
#include "brightray/browser/devtools_ui.h" #include "atom/browser/ui/devtools_ui.h"
#include <string> #include <string>
@ -14,7 +14,7 @@
#include "content/public/browser/web_contents.h" #include "content/public/browser/web_contents.h"
#include "content/public/browser/web_ui.h" #include "content/public/browser/web_ui.h"
namespace brightray { namespace atom {
namespace { namespace {
@ -117,4 +117,4 @@ DevToolsUI::DevToolsUI(content::BrowserContext* browser_context,
content::URLDataSource::Add(browser_context, new BundledDataSource()); content::URLDataSource::Add(browser_context, new BundledDataSource());
} }
} // namespace brightray } // namespace atom

View file

@ -2,14 +2,14 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE-CHROMIUM file. // found in the LICENSE-CHROMIUM file.
#ifndef BRIGHTRAY_BROWSER_DEVTOOLS_UI_H_ #ifndef ATOM_BROWSER_UI_DEVTOOLS_UI_H_
#define BRIGHTRAY_BROWSER_DEVTOOLS_UI_H_ #define ATOM_BROWSER_UI_DEVTOOLS_UI_H_
#include "base/compiler_specific.h" #include "base/compiler_specific.h"
#include "content/public/browser/browser_context.h" #include "content/public/browser/browser_context.h"
#include "content/public/browser/web_ui_controller.h" #include "content/public/browser/web_ui_controller.h"
namespace brightray { namespace atom {
class BrowserContext; class BrowserContext;
@ -22,6 +22,6 @@ class DevToolsUI : public content::WebUIController {
DISALLOW_COPY_AND_ASSIGN(DevToolsUI); DISALLOW_COPY_AND_ASSIGN(DevToolsUI);
}; };
} // namespace brightray } // namespace atom
#endif // BRIGHTRAY_BROWSER_DEVTOOLS_UI_H_ #endif // ATOM_BROWSER_UI_DEVTOOLS_UI_H_

View file

@ -0,0 +1,19 @@
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Copyright (c) 2013 Adam Roben <adam@roben.org>. 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

View file

@ -1,5 +1,10 @@
#ifndef BRIGHTRAY_BROWSER_INSPECTABLE_WEB_CONTENTS_H_ // Copyright (c) 2012 The Chromium Authors. All rights reserved.
#define BRIGHTRAY_BROWSER_INSPECTABLE_WEB_CONTENTS_H_ // Copyright (c) 2013 Adam Roben <adam@roben.org>. 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 <string> #include <string>
@ -15,7 +20,7 @@ class DevToolsAgentHost;
class PrefService; class PrefService;
namespace brightray { namespace atom {
class InspectableWebContentsDelegate; class InspectableWebContentsDelegate;
class InspectableWebContentsView; class InspectableWebContentsView;
@ -54,6 +59,6 @@ class InspectableWebContents {
virtual void InspectElement(int x, int y) = 0; 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_

View file

@ -1,11 +1,16 @@
#ifndef BRIGHTRAY_BROWSER_INSPECTABLE_WEB_CONTENTS_DELEGATE_H_ // Copyright (c) 2012 The Chromium Authors. All rights reserved.
#define BRIGHTRAY_BROWSER_INSPECTABLE_WEB_CONTENTS_DELEGATE_H_ // Copyright (c) 2013 Adam Roben <adam@roben.org>. 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 <string> #include <string>
#include "base/files/file_path.h" #include "base/files/file_path.h"
namespace brightray { namespace atom {
class InspectableWebContentsDelegate { class InspectableWebContentsDelegate {
public: public:
@ -32,6 +37,6 @@ class InspectableWebContentsDelegate {
const std::string& query) {} 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_

View file

@ -6,8 +6,11 @@
#include <memory> #include <memory>
#include <utility> #include <utility>
#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 "atom/common/platform_util.h"
#include "base/guid.h" #include "base/guid.h"
#include "base/json/json_reader.h" #include "base/json/json_reader.h"
@ -18,11 +21,6 @@
#include "base/strings/stringprintf.h" #include "base/strings/stringprintf.h"
#include "base/strings/utf_string_conversions.h" #include "base/strings/utf_string_conversions.h"
#include "base/values.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_registry_simple.h"
#include "components/prefs/pref_service.h" #include "components/prefs/pref_service.h"
#include "components/prefs/scoped_user_pref_update.h" #include "components/prefs/scoped_user_pref_update.h"
@ -42,7 +40,7 @@
#include "ui/display/display.h" #include "ui/display/display.h"
#include "ui/display/screen.h" #include "ui/display/screen.h"
namespace brightray { namespace atom {
namespace { namespace {
@ -896,4 +894,4 @@ void InspectableWebContentsImpl::SendMessageAck(int request_id,
CallClientFunction("DevToolsAPI.embedderMessageAck", &id_value, arg, nullptr); CallClientFunction("DevToolsAPI.embedderMessageAck", &id_value, arg, nullptr);
} }
} // namespace brightray } // namespace atom

View file

@ -3,16 +3,16 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE-CHROMIUM file. // found in the LICENSE-CHROMIUM file.
#ifndef BRIGHTRAY_BROWSER_INSPECTABLE_WEB_CONTENTS_IMPL_H_ #ifndef ATOM_BROWSER_UI_INSPECTABLE_WEB_CONTENTS_IMPL_H_
#define BRIGHTRAY_BROWSER_INSPECTABLE_WEB_CONTENTS_IMPL_H_ #define ATOM_BROWSER_UI_INSPECTABLE_WEB_CONTENTS_IMPL_H_
#include <map> #include <map>
#include <memory> #include <memory>
#include <string> #include <string>
#include <vector> #include <vector>
#include "atom/browser/ui/inspectable_web_contents.h"
#include "base/memory/weak_ptr.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_contents_resizing_strategy.h"
#include "chrome/browser/devtools/devtools_embedder_message_dispatcher.h" #include "chrome/browser/devtools/devtools_embedder_message_dispatcher.h"
#include "content/public/browser/devtools_agent_host.h" #include "content/public/browser/devtools_agent_host.h"
@ -25,7 +25,7 @@
class PrefService; class PrefService;
class PrefRegistrySimple; class PrefRegistrySimple;
namespace brightray { namespace atom {
class InspectableWebContentsDelegate; class InspectableWebContentsDelegate;
class InspectableWebContentsView; class InspectableWebContentsView;
@ -237,6 +237,6 @@ class InspectableWebContentsImpl
DISALLOW_COPY_AND_ASSIGN(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_

View file

@ -1,5 +1,10 @@
#ifndef BRIGHTRAY_BROWSER_INSPECTABLE_WEB_CONTENTS_VIEW_H_ // Copyright (c) 2012 The Chromium Authors. All rights reserved.
#define BRIGHTRAY_BROWSER_INSPECTABLE_WEB_CONTENTS_VIEW_H_ // Copyright (c) 2013 Adam Roben <adam@roben.org>. 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 "base/strings/string16.h"
#include "ui/gfx/native_widget_types.h" #include "ui/gfx/native_widget_types.h"
@ -12,7 +17,7 @@ class View;
} }
#endif #endif
namespace brightray { namespace atom {
class InspectableWebContentsViewDelegate; class InspectableWebContentsViewDelegate;
@ -52,6 +57,6 @@ class InspectableWebContentsView {
InspectableWebContentsViewDelegate* delegate_; // weak references. 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_

View file

@ -0,0 +1,14 @@
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Copyright (c) 2013 Adam Roben <adam@roben.org>. 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

View file

@ -1,11 +1,16 @@
#ifndef BRIGHTRAY_BROWSER_INSPECTABLE_WEB_CONTENTS_VIEW_DELEGATE_H_ // Copyright (c) 2012 The Chromium Authors. All rights reserved.
#define BRIGHTRAY_BROWSER_INSPECTABLE_WEB_CONTENTS_VIEW_DELEGATE_H_ // Copyright (c) 2013 Adam Roben <adam@roben.org>. 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 <string> #include <string>
#include "ui/gfx/image/image_skia.h" #include "ui/gfx/image/image_skia.h"
namespace brightray { namespace atom {
class InspectableWebContentsViewDelegate { class InspectableWebContentsViewDelegate {
public: public:
@ -25,6 +30,6 @@ class InspectableWebContentsViewDelegate {
#endif #endif
}; };
} // namespace brightray } // namespace atom
#endif // BRIGHTRAY_BROWSER_INSPECTABLE_WEB_CONTENTS_VIEW_DELEGATE_H_ #endif // ATOM_BROWSER_UI_INSPECTABLE_WEB_CONTENTS_VIEW_DELEGATE_H_

View file

@ -1,13 +1,18 @@
#ifndef BRIGHTRAY_BROWSER_INSPECTABLE_WEB_CONTENTS_VIEW_MAC_H_ // Copyright (c) 2012 The Chromium Authors. All rights reserved.
#define BRIGHTRAY_BROWSER_INSPECTABLE_WEB_CONTENTS_VIEW_MAC_H_ // Copyright (c) 2013 Adam Roben <adam@roben.org>. 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" #include "base/mac/scoped_nsobject.h"
@class BRYInspectableWebContentsView; @class AtomInspectableWebContentsView;
namespace brightray { namespace atom {
class InspectableWebContentsImpl; class InspectableWebContentsImpl;
@ -35,11 +40,11 @@ class InspectableWebContentsViewMac : public InspectableWebContentsView {
// Owns us. // Owns us.
InspectableWebContentsImpl* inspectable_web_contents_; InspectableWebContentsImpl* inspectable_web_contents_;
base::scoped_nsobject<BRYInspectableWebContentsView> view_; base::scoped_nsobject<AtomInspectableWebContentsView> view_;
DISALLOW_COPY_AND_ASSIGN(InspectableWebContentsViewMac); 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_

View file

@ -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 <adam@roben.org>. 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 <AppKit/AppKit.h> #import <AppKit/AppKit.h>
#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 "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( InspectableWebContentsView* CreateInspectableContentsView(
InspectableWebContentsImpl* inspectable_web_contents) { InspectableWebContentsImpl* inspectable_web_contents) {
@ -17,7 +22,7 @@ InspectableWebContentsView* CreateInspectableContentsView(
InspectableWebContentsViewMac::InspectableWebContentsViewMac( InspectableWebContentsViewMac::InspectableWebContentsViewMac(
InspectableWebContentsImpl* inspectable_web_contents) InspectableWebContentsImpl* inspectable_web_contents)
: inspectable_web_contents_(inspectable_web_contents), : inspectable_web_contents_(inspectable_web_contents),
view_([[BRYInspectableWebContentsView alloc] view_([[AtomInspectableWebContentsView alloc]
initWithInspectableWebContentsViewMac:this]) {} initWithInspectableWebContentsViewMac:this]) {}
InspectableWebContentsViewMac::~InspectableWebContentsViewMac() { InspectableWebContentsViewMac::~InspectableWebContentsViewMac() {
@ -58,4 +63,4 @@ void InspectableWebContentsViewMac::SetTitle(const base::string16& title) {
[view_ setTitle:base::SysUTF16ToNSString(title)]; [view_ setTitle:base::SysUTF16ToNSString(title)];
} }
} // namespace brightray } // namespace atom

View file

@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE-CHROMIUM file. // found in the LICENSE-CHROMIUM file.
#include "brightray/browser/views/views_delegate.h" #include "atom/browser/ui/views/atom_views_delegate.h"
#include <memory> #include <memory>
@ -28,7 +28,7 @@ bool IsDesktopEnvironmentUnity() {
} // namespace } // namespace
namespace brightray { namespace atom {
ViewsDelegate::ViewsDelegate() {} ViewsDelegate::ViewsDelegate() {}
@ -115,4 +115,4 @@ bool ViewsDelegate::WindowManagerProvidesTitleBar(bool maximized) {
#endif #endif
} }
} // namespace brightray } // namespace atom

View file

@ -2,15 +2,15 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE-CHROMIUM file. // found in the LICENSE-CHROMIUM file.
#ifndef BRIGHTRAY_BROWSER_VIEWS_VIEWS_DELEGATE_H_ #ifndef ATOM_BROWSER_UI_VIEWS_ATOM_VIEWS_DELEGATE_H_
#define BRIGHTRAY_BROWSER_VIEWS_VIEWS_DELEGATE_H_ #define ATOM_BROWSER_UI_VIEWS_ATOM_VIEWS_DELEGATE_H_
#include <string> #include <string>
#include "base/compiler_specific.h" #include "base/compiler_specific.h"
#include "ui/views/views_delegate.h" #include "ui/views/views_delegate.h"
namespace brightray { namespace atom {
class ViewsDelegate : public views::ViewsDelegate { class ViewsDelegate : public views::ViewsDelegate {
public: public:
@ -55,6 +55,6 @@ class ViewsDelegate : public views::ViewsDelegate {
DISALLOW_COPY_AND_ASSIGN(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_

View file

@ -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 "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/label.h"
#include "ui/views/controls/webview/webview.h" #include "ui/views/controls/webview/webview.h"
#include "ui/views/widget/widget.h" #include "ui/views/widget/widget.h"
#include "ui/views/widget/widget_delegate.h" #include "ui/views/widget/widget_delegate.h"
#include "ui/views/window/client_view.h" #include "ui/views/window/client_view.h"
namespace brightray { namespace atom {
namespace { namespace {
@ -224,4 +228,4 @@ void InspectableWebContentsViewViews::Layout() {
contents_web_view_->SetBoundsRect(new_contents_bounds); contents_web_view_->SetBoundsRect(new_contents_bounds);
} }
} // namespace brightray } // namespace atom

View file

@ -1,10 +1,14 @@
#ifndef BRIGHTRAY_BROWSER_VIEWS_INSPECTABLE_WEB_CONTENTS_VIEW_VIEWS_H_ // Copyright (c) 2014 The Chromium Authors. All rights reserved.
#define BRIGHTRAY_BROWSER_VIEWS_INSPECTABLE_WEB_CONTENTS_VIEW_VIEWS_H_ // 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 <memory> #include <memory>
#include "atom/browser/ui/inspectable_web_contents_view.h"
#include "base/compiler_specific.h" #include "base/compiler_specific.h"
#include "brightray/browser/inspectable_web_contents_view.h"
#include "chrome/browser/devtools/devtools_contents_resizing_strategy.h" #include "chrome/browser/devtools/devtools_contents_resizing_strategy.h"
#include "ui/views/view.h" #include "ui/views/view.h"
@ -14,7 +18,7 @@ class Widget;
class WidgetDelegate; class WidgetDelegate;
} // namespace views } // namespace views
namespace brightray { namespace atom {
class InspectableWebContentsImpl; class InspectableWebContentsImpl;
@ -63,6 +67,6 @@ class InspectableWebContentsViewViews : public InspectableWebContentsView,
DISALLOW_COPY_AND_ASSIGN(InspectableWebContentsViewViews); 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_

View file

@ -8,7 +8,6 @@ static_library("brightray") {
"//content/shell:copy_shell_resources", "//content/shell:copy_shell_resources",
"//net:extras", "//net:extras",
"//net:net_with_v8", "//net:net_with_v8",
"//skia",
"//ui/views", "//ui/views",
] ]
@ -18,17 +17,6 @@ static_library("brightray") {
deps += [ "//build/config/linux/gtk" ] 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 = [ sources = [
"browser/brightray_paths.h", "browser/brightray_paths.h",
"browser/browser_client.cc", "browser/browser_client.cc",
@ -36,24 +24,6 @@ static_library("brightray") {
"browser/browser_main_parts.cc", "browser/browser_main_parts.cc",
"browser/browser_main_parts.h", "browser/browser_main_parts.h",
"browser/browser_main_parts_mac.mm", "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.cc",
"browser/media/media_capture_devices_dispatcher.h", "browser/media/media_capture_devices_dispatcher.h",
"browser/media/media_device_id_salt.cc", "browser/media/media_device_id_salt.cc",
@ -62,12 +32,6 @@ static_library("brightray") {
"browser/media/media_stream_devices_controller.h", "browser/media/media_stream_devices_controller.h",
"browser/net/require_ct_delegate.cc", "browser/net/require_ct_delegate.cc",
"browser/net/require_ct_delegate.h", "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.cc",
"browser/win/scoped_hstring.h", "browser/win/scoped_hstring.h",
"browser/zoom_level_delegate.cc", "browser/zoom_level_delegate.cc",
@ -86,14 +50,4 @@ static_library("brightray") {
"common/platform_util.h", "common/platform_util.h",
"common/platform_util_linux.cc", "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",
]
} }

View file

@ -8,7 +8,6 @@
#include "base/no_destructor.h" #include "base/no_destructor.h"
#include "base/path_service.h" #include "base/path_service.h"
#include "brightray/browser/browser_main_parts.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 "brightray/browser/media/media_capture_devices_dispatcher.h"
#include "content/public/browser/browser_thread.h" #include "content/public/browser/browser_thread.h"
#include "content/public/common/url_constants.h" #include "content/public/common/url_constants.h"
@ -73,17 +72,6 @@ content::MediaObserver* BrowserClient::GetMediaObserver() {
return MediaCaptureDevicesDispatcher::GetInstance(); return MediaCaptureDevicesDispatcher::GetInstance();
} }
void BrowserClient::GetAdditionalAllowedSchemesForFileSystem(
std::vector<std::string>* additional_schemes) {
additional_schemes->push_back(content::kChromeDevToolsScheme);
additional_schemes->push_back(content::kChromeUIScheme);
}
void BrowserClient::GetAdditionalWebUISchemes(
std::vector<std::string>* additional_schemes) {
additional_schemes->push_back(content::kChromeDevToolsScheme);
}
base::FilePath BrowserClient::GetDefaultDownloadDirectory() { base::FilePath BrowserClient::GetDefaultDownloadDirectory() {
// ~/Downloads // ~/Downloads
base::FilePath path; base::FilePath path;
@ -93,10 +81,6 @@ base::FilePath BrowserClient::GetDefaultDownloadDirectory() {
return path; return path;
} }
content::DevToolsManagerDelegate* BrowserClient::GetDevToolsManagerDelegate() {
return new DevToolsManagerDelegate;
}
std::string BrowserClient::GetApplicationLocale() { std::string BrowserClient::GetApplicationLocale() {
if (BrowserThread::CurrentlyOn(BrowserThread::IO)) if (BrowserThread::CurrentlyOn(BrowserThread::IO))
return g_io_thread_application_locale.Get(); return g_io_thread_application_locale.Get();

View file

@ -30,12 +30,7 @@ class BrowserClient : public content::ContentBrowserClient {
content::BrowserMainParts* CreateBrowserMainParts( content::BrowserMainParts* CreateBrowserMainParts(
const content::MainFunctionParams&) override; const content::MainFunctionParams&) override;
content::MediaObserver* GetMediaObserver() override; content::MediaObserver* GetMediaObserver() override;
void GetAdditionalAllowedSchemesForFileSystem(
std::vector<std::string>* additional_schemes) override;
void GetAdditionalWebUISchemes(
std::vector<std::string>* additional_schemes) override;
base::FilePath GetDefaultDownloadDirectory() override; base::FilePath GetDefaultDownloadDirectory() override;
content::DevToolsManagerDelegate* GetDevToolsManagerDelegate() override;
std::string GetApplicationLocale() override; std::string GetApplicationLocale() override;
protected: protected:

View file

@ -23,9 +23,7 @@
#include "base/strings/string_number_conversions.h" #include "base/strings/string_number_conversions.h"
#include "base/strings/utf_string_conversions.h" #include "base/strings/utf_string_conversions.h"
#include "brightray/browser/browser_client.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/media/media_capture_devices_dispatcher.h"
#include "brightray/browser/web_ui_controller_factory.h"
#include "brightray/common/application_info.h" #include "brightray/common/application_info.h"
#include "brightray/common/main_delegate.h" #include "brightray/common/main_delegate.h"
#include "content/public/browser/browser_thread.h" #include "content/public/browser/browser_thread.h"
@ -275,16 +273,6 @@ void BrowserMainParts::PreMainMessageLoopStart() {
media::SetLocalizedStringProvider(MediaStringProvider); 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() { void BrowserMainParts::PostMainMessageLoopStart() {
#if defined(USE_X11) #if defined(USE_X11)
// Installs the X11 error handlers for the browser process after the // Installs the X11 error handlers for the browser process after the

View file

@ -34,7 +34,6 @@ class BrowserMainParts : public content::BrowserMainParts {
int PreEarlyInitialization() override; int PreEarlyInitialization() override;
void ToolkitInitialized() override; void ToolkitInitialized() override;
void PreMainMessageLoopStart() override; void PreMainMessageLoopStart() override;
void PreMainMessageLoopRun() override;
void PostMainMessageLoopStart() override; void PostMainMessageLoopStart() override;
void PostMainMessageLoopRun() override; void PostMainMessageLoopRun() override;
int PreCreateThreads() override; int PreCreateThreads() override;

View file

@ -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

View file

@ -1,9 +0,0 @@
#include "brightray/browser/inspectable_web_contents_view_delegate.h"
namespace brightray {
gfx::ImageSkia InspectableWebContentsViewDelegate::GetDevToolsWindowIcon() {
return gfx::ImageSkia();
}
} // namespace brightray

View file

@ -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<WebUIControllerFactory>::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<WebUIControllerFactory*>(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<content::WebUIController>
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<DevToolsUI>(browser_context, web_ui);
}
return std::unique_ptr<content::WebUIController>();
}
} // namespace brightray

View file

@ -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 <memory>
#include "base/macros.h"
#include "content/public/browser/web_ui.h"
#include "content/public/browser/web_ui_controller_factory.h"
namespace base {
template <typename T>
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<content::WebUIController> CreateWebUIControllerForURL(
content::WebUI* web_ui,
const GURL& url) const override;
private:
friend struct base::DefaultSingletonTraits<WebUIControllerFactory>;
DISALLOW_COPY_AND_ASSIGN(WebUIControllerFactory);
};
} // namespace brightray
#endif // BRIGHTRAY_BROWSER_WEB_UI_CONTROLLER_FACTORY_H_

View file

@ -12,6 +12,12 @@ static_library("chrome") {
sources = [ sources = [
"//chrome/browser/browser_process.cc", "//chrome/browser/browser_process.cc",
"//chrome/browser/browser_process.h", "//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.cc",
"//chrome/browser/extensions/global_shortcut_listener.h", "//chrome/browser/extensions/global_shortcut_listener.h",
"//chrome/browser/extensions/global_shortcut_listener_mac.h", "//chrome/browser/extensions/global_shortcut_listener_mac.h",

View file

@ -401,6 +401,14 @@ filenames = {
"atom/browser/ui/cocoa/root_view_mac.mm", "atom/browser/ui/cocoa/root_view_mac.mm",
"atom/browser/ui/cocoa/root_view_mac.h", "atom/browser/ui/cocoa/root_view_mac.h",
"atom/browser/ui/cocoa/touch_bar_forward_declarations.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_mac.mm",
"atom/browser/ui/drag_util_views.cc", "atom/browser/ui/drag_util_views.cc",
"atom/browser/ui/drag_util.h", "atom/browser/ui/drag_util.h",
@ -408,6 +416,16 @@ filenames = {
"atom/browser/ui/file_dialog_gtk.cc", "atom/browser/ui/file_dialog_gtk.cc",
"atom/browser/ui/file_dialog_mac.mm", "atom/browser/ui/file_dialog_mac.mm",
"atom/browser/ui/file_dialog_win.cc", "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.h",
"atom/browser/ui/message_box_gtk.cc", "atom/browser/ui/message_box_gtk.cc",
"atom/browser/ui/message_box_mac.mm", "atom/browser/ui/message_box_mac.mm",
@ -424,12 +442,16 @@ filenames = {
"atom/browser/ui/tray_icon_cocoa.mm", "atom/browser/ui/tray_icon_cocoa.mm",
"atom/browser/ui/tray_icon_observer.h", "atom/browser/ui/tray_icon_observer.h",
"atom/browser/ui/tray_icon_win.cc", "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.cc",
"atom/browser/ui/views/autofill_popup_view.h", "atom/browser/ui/views/autofill_popup_view.h",
"atom/browser/ui/views/frameless_view.cc", "atom/browser/ui/views/frameless_view.cc",
"atom/browser/ui/views/frameless_view.h", "atom/browser/ui/views/frameless_view.h",
"atom/browser/ui/views/global_menu_bar_x11.cc", "atom/browser/ui/views/global_menu_bar_x11.cc",
"atom/browser/ui/views/global_menu_bar_x11.h", "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.cc",
"atom/browser/ui/views/menu_bar.h", "atom/browser/ui/views/menu_bar.h",
"atom/browser/ui/views/menu_delegate.cc", "atom/browser/ui/views/menu_delegate.cc",

View file

@ -19,6 +19,8 @@ const BLACKLIST = new Set([
['atom', 'browser', 'ui', 'cocoa', 'atom_ns_window_delegate.h'], ['atom', 'browser', 'ui', 'cocoa', 'atom_ns_window_delegate.h'],
['atom', 'browser', 'ui', 'cocoa', 'atom_preview_item.h'], ['atom', 'browser', 'ui', 'cocoa', 'atom_preview_item.h'],
['atom', 'browser', 'ui', 'cocoa', 'atom_touch_bar.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', 'touch_bar_forward_declarations.h'],
['atom', 'browser', 'ui', 'cocoa', 'NSColor+Hex.h'], ['atom', 'browser', 'ui', 'cocoa', 'NSColor+Hex.h'],
['atom', 'browser', 'ui', 'cocoa', 'NSString+ANSI.h'], ['atom', 'browser', 'ui', 'cocoa', 'NSString+ANSI.h'],
@ -27,8 +29,6 @@ const BLACKLIST = new Set([
['atom', 'common', 'common_message_generator.h'], ['atom', 'common', 'common_message_generator.h'],
['atom', 'common', 'node_includes.h'], ['atom', 'common', 'node_includes.h'],
['atom', 'node', 'osfhandle.cc'], ['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'] ['spec', 'static', 'jquery-2.0.3.min.js']
].map(tokens => path.join(SOURCE_ROOT, ...tokens))) ].map(tokens => path.join(SOURCE_ROOT, ...tokens)))