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:
#if defined(OS_MACOSX)
void OverrideNSWindowContentView(brightray::InspectableWebContents* iwc);
void OverrideNSWindowContentView(InspectableWebContents* iwc);
#endif
// Helpers.

View file

@ -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 @@ std::vector<gfx::Rect> CalculateNonDraggableRegions(
} // namespace
void BrowserWindow::OverrideNSWindowContentView(
brightray::InspectableWebContents* iwc) {
void BrowserWindow::OverrideNSWindowContentView(InspectableWebContents* iwc) {
// Make NativeWindow use a NSView as content view.
static_cast<NativeWindowMac*>(window())->OverrideNSWindowContentView();
// Add webview to contentView.

View file

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

View file

@ -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;
@ -419,10 +416,10 @@ class WebContents : public mate::TrackableObject<WebContents>,
content::WebContentsObserver::MediaStoppedReason reason) override;
void DidChangeThemeColor(SkColor theme_color) override;
// brightray::InspectableWebContentsDelegate:
// InspectableWebContentsDelegate:
void DevToolsReloadPage() override;
// brightray::InspectableWebContentsViewDelegate:
// InspectableWebContentsViewDelegate:
void DevToolsFocused() override;
void DevToolsOpened() 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.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<WebContents> web_contents,
brightray::InspectableWebContents* iwc)
InspectableWebContents* iwc)
#if defined(OS_MACOSX)
: View(new DelayedNativeViewHost(iwc->GetView()->GetNativeView())),
#else

View file

@ -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<WebContents> web_contents,
brightray::InspectableWebContents* iwc);
InspectableWebContents* iwc);
~WebContentsView() override;
// content::WebContentsObserver:

View file

@ -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<std::string>* 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());

View file

@ -111,7 +111,9 @@ class AtomBrowserClient : public brightray::BrowserClient,
bool opener_suppressed,
bool* no_javascript_access) override;
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;
std::unique_ptr<net::ClientCertStore> CreateClientCertStore(
content::ResourceContext* resource_context) override;
@ -125,6 +127,7 @@ class AtomBrowserClient : public brightray::BrowserClient,
std::unique_ptr<base::Value> GetServiceManifestOverlay(
base::StringPiece name) override;
net::NetLog* GetNetLog() override;
content::DevToolsManagerDelegate* GetDevToolsManagerDelegate() override;
content::PlatformNotificationService* GetPlatformNotificationService()
override;

View file

@ -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());

View file

@ -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());

View file

@ -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<ViewsDelegateMac> views_delegate_;
#else
std::unique_ptr<brightray::ViewsDelegate> views_delegate_;
std::unique_ptr<ViewsDelegate> views_delegate_;
#endif
// 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 "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<AtomWebUIControllerFactory>::get();
@ -36,6 +44,9 @@ content::WebUI::TypeID AtomWebUIControllerFactory::GetWebUIType(
return const_cast<AtomWebUIControllerFactory*>(this);
}
#endif // BUILDFLAG(ENABLE_PDF_VIEWER)
if (url.host() == kChromeUIDevToolsBundledHost) {
return const_cast<AtomWebUIControllerFactory*>(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<DevToolsUI>(browser_context, web_ui);
}
return std::unique_ptr<content::WebUIController>();
}

View file

@ -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<AtomBrowserContext> browser_context,
std::unique_ptr<brightray::InspectableWebContents>
web_contents) { web_contents.reset(); },
base::RetainedRef(browser_context_),
std::move(web_contents_)));
base::BindOnce(
[](scoped_refptr<AtomBrowserContext> browser_context,
std::unique_ptr<InspectableWebContents> web_contents) {
web_contents.reset();
},
base::RetainedRef(browser_context_), std::move(web_contents_)));
} else {
web_contents_.reset();
}

View file

@ -10,10 +10,10 @@
#include <string>
#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 "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();
}
@ -115,7 +114,7 @@ class CommonWebContentsDelegate
void HideAutofillPopup();
#endif
// brightray::InspectableWebContentsDelegate:
// InspectableWebContentsDelegate:
void DevToolsSaveToFile(const std::string& url,
const std::string& content,
bool save_as) override;
@ -134,7 +133,7 @@ class CommonWebContentsDelegate
const std::string& file_system_path,
const std::string& query) override;
// brightray::InspectableWebContentsViewDelegate:
// InspectableWebContentsViewDelegate:
#if defined(TOOLKIT_VIEWS) && !defined(OS_MACOSX)
gfx::ImageSkia GetDevToolsWindowIcon() override;
#endif
@ -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<brightray::InspectableWebContents> web_contents_;
std::unique_ptr<InspectableWebContents> web_contents_;
// Maps url to file path, used by the file requests sent from devtools.
typedef std::map<std::string, base::FilePath> PathsMap;

View file

@ -6,8 +6,8 @@
#import <Cocoa/Cocoa.h>
#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"

View file

@ -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();
}

View file

@ -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<gfx::Rect>& 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);

View file

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

View file

@ -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 @@ const NSAutoresizingMaskOptions kDefaultAutoResizingMask =
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 @@ void NativeBrowserViewMac::UpdateDraggableRegions(
// static
NativeBrowserView* NativeBrowserView::Create(
brightray::InspectableWebContents* inspectable_web_contents) {
InspectableWebContents* inspectable_web_contents) {
return new NativeBrowserViewMac(inspectable_web_contents);
}

View file

@ -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);
}

View file

@ -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_; }

View file

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

View file

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

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>
#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 <NSWindowDelegate> {
@interface AtomInspectableWebContentsView : BaseView <NSWindowDelegate> {
@private
brightray::InspectableWebContentsViewMac* inspectableWebContentsView_;
atom::InspectableWebContentsViewMac* inspectableWebContentsView_;
base::scoped_nsobject<NSView> fake_view_;
base::scoped_nsobject<NSWindow> 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_

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 "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 {

View file

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

View file

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

View file

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

View file

@ -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 <memory>
#include <vector>
@ -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

View file

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

View file

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

View file

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

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_
#define BRIGHTRAY_BROWSER_INSPECTABLE_WEB_CONTENTS_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.
#ifndef ATOM_BROWSER_UI_INSPECTABLE_WEB_CONTENTS_H_
#define ATOM_BROWSER_UI_INSPECTABLE_WEB_CONTENTS_H_
#include <string>
@ -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_

View file

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

View file

@ -6,8 +6,11 @@
#include <memory>
#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 "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

View file

@ -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 <map>
#include <memory>
#include <string>
#include <vector>
#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_

View file

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

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_
#define BRIGHTRAY_BROWSER_INSPECTABLE_WEB_CONTENTS_VIEW_DELEGATE_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.
#ifndef ATOM_BROWSER_UI_INSPECTABLE_WEB_CONTENTS_VIEW_DELEGATE_H_
#define ATOM_BROWSER_UI_INSPECTABLE_WEB_CONTENTS_VIEW_DELEGATE_H_
#include <string>
#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_

View file

@ -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 <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"
@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<BRYInspectableWebContentsView> view_;
base::scoped_nsobject<AtomInspectableWebContentsView> 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_

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 "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 @@ InspectableWebContentsView* CreateInspectableContentsView(
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 @@ void InspectableWebContentsViewMac::SetTitle(const base::string16& 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
// found in the LICENSE-CHROMIUM file.
#include "brightray/browser/views/views_delegate.h"
#include "atom/browser/ui/views/atom_views_delegate.h"
#include <memory>
@ -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

View file

@ -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 <string>
#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_

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

View file

@ -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 <memory>
#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_

View file

@ -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",
]
}

View file

@ -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<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() {
// ~/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();

View file

@ -30,12 +30,7 @@ class BrowserClient : public content::ContentBrowserClient {
content::BrowserMainParts* CreateBrowserMainParts(
const content::MainFunctionParams&) 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;
content::DevToolsManagerDelegate* GetDevToolsManagerDelegate() override;
std::string GetApplicationLocale() override;
protected:

View file

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

View file

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

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 = [
"//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",

View file

@ -401,6 +401,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",
@ -408,6 +416,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",
@ -424,12 +442,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",

View file

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