From: Cheng Zhao Date: Thu, 25 Jun 2015 04:30:04 +0000 (+0800) Subject: Add InspectableWebContentsViewDelegate X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=afa9f30aacf4a44c611425f520ea72ecec314c0e;p=platform%2Fframework%2Fweb%2Fcrosswalk-tizen.git Add InspectableWebContentsViewDelegate --- diff --git a/atom/browser/native_window.cc b/atom/browser/native_window.cc index 8748388..3e2bbd1 100644 --- a/atom/browser/native_window.cc +++ b/atom/browser/native_window.cc @@ -96,6 +96,8 @@ NativeWindow::NativeWindow( zoom_factor_(1.0), inspectable_web_contents_(inspectable_web_contents), weak_factory_(this) { + inspectable_web_contents->GetView()->SetDelegate(this); + options.Get(switches::kFrame, &has_frame_); options.Get(switches::kTransparent, &transparent_); options.Get(switches::kEnableLargerThanScreen, &enable_larger_than_screen_); @@ -496,6 +498,7 @@ void NativeWindow::RenderViewCreated( } void NativeWindow::CloseContents(content::WebContents* source) { + inspectable_web_contents_->GetView()->SetDelegate(nullptr); inspectable_web_contents_ = nullptr; // When the web contents is gone, close the window immediately, but the @@ -525,6 +528,18 @@ void NativeWindow::RendererResponsive(content::WebContents* source) { FOR_EACH_OBSERVER(NativeWindowObserver, observers_, OnRendererResponsive()); } +void NativeWindow::DevToolsFocused() { + FOR_EACH_OBSERVER(NativeWindowObserver, observers_, OnDevToolsFocus()); +} + +void NativeWindow::DevToolsOpened() { + FOR_EACH_OBSERVER(NativeWindowObserver, observers_, OnDevToolsOpened()); +} + +void NativeWindow::DevToolsClosed() { + FOR_EACH_OBSERVER(NativeWindowObserver, observers_, OnDevToolsClosed()); +} + void NativeWindow::BeforeUnloadDialogCancelled() { WindowList::WindowCloseCancelled(this); diff --git a/atom/browser/native_window.h b/atom/browser/native_window.h index 8fe5143..c52a1e0 100644 --- a/atom/browser/native_window.h +++ b/atom/browser/native_window.h @@ -15,6 +15,7 @@ #include "base/memory/scoped_ptr.h" #include "base/memory/weak_ptr.h" #include "base/observer_list.h" +#include "brightray/browser/inspectable_web_contents_view_delegate.h" #include "content/public/browser/readback_types.h" #include "content/public/browser/web_contents_observer.h" #include "content/public/browser/web_contents_user_data.h" @@ -53,7 +54,8 @@ namespace atom { struct DraggableRegion; -class NativeWindow : public content::WebContentsObserver { +class NativeWindow : public content::WebContentsObserver, + public brightray::InspectableWebContentsViewDelegate { public: typedef base::Callback CapturePageCallback; @@ -228,7 +230,12 @@ class NativeWindow : public content::WebContentsObserver { virtual void UpdateDraggableRegions( const std::vector& regions) = 0; - // Implementations of content::WebContentsObserver. + // brightray::InspectableWebContentsViewDelegate: + void DevToolsFocused() override; + void DevToolsOpened() override; + void DevToolsClosed() override; + + // content::WebContentsObserver: void RenderViewCreated(content::RenderViewHost* render_view_host) override; void BeforeUnloadDialogCancelled() override; void TitleWasSet(content::NavigationEntry* entry, bool explicit_set) override; diff --git a/atom/browser/native_window_views.h b/atom/browser/native_window_views.h index c446d53..fe4e8a8 100644 --- a/atom/browser/native_window_views.h +++ b/atom/browser/native_window_views.h @@ -120,7 +120,7 @@ class NativeWindowViews : public NativeWindow, bool ExecuteWindowsCommand(int command_id) override; #endif - // brightray::InspectableWebContentsDelegate: + // brightray::InspectableWebContentsViewDelegate: gfx::ImageSkia GetDevToolsWindowIcon() override; #if defined(USE_X11) void GetDevToolsWindowWMClass( diff --git a/vendor/brightray b/vendor/brightray index 2087135..b05e019 160000 --- a/vendor/brightray +++ b/vendor/brightray @@ -1 +1 @@ -Subproject commit 20871355cb590e009d7ee394a7d9da0e4666ea0b +Subproject commit b05e019d2f66023fad1ae2f16cc765e3d62ffd5e