diff --git a/brightray/brightray.gyp b/brightray/brightray.gyp index a30281b1fdc2..8f2488feecc8 100644 --- a/brightray/brightray.gyp +++ b/brightray/brightray.gyp @@ -52,6 +52,7 @@ 'browser/download_manager_delegate.h', 'browser/inspectable_web_contents.cc', 'browser/inspectable_web_contents.h', + 'browser/inspectable_web_contents_delegate.cc', 'browser/inspectable_web_contents_delegate.h', 'browser/inspectable_web_contents_impl.cc', 'browser/inspectable_web_contents_impl.h', diff --git a/brightray/browser/inspectable_web_contents.h b/brightray/browser/inspectable_web_contents.h index 313e4ebea2c3..ea0fc8f13b3a 100644 --- a/brightray/browser/inspectable_web_contents.h +++ b/brightray/browser/inspectable_web_contents.h @@ -29,6 +29,7 @@ class InspectableWebContents { // The delegate manages its own life. virtual void SetDelegate(InspectableWebContentsDelegate* delegate) = 0; + virtual InspectableWebContentsDelegate* GetDelegate() const = 0; }; } // namespace brightray diff --git a/brightray/browser/inspectable_web_contents_delegate.cc b/brightray/browser/inspectable_web_contents_delegate.cc new file mode 100644 index 000000000000..81d395b5db37 --- /dev/null +++ b/brightray/browser/inspectable_web_contents_delegate.cc @@ -0,0 +1,9 @@ +#include "browser/inspectable_web_contents_delegate.h" + +namespace brightray { + +gfx::ImageSkia InspectableWebContentsDelegate::GetDevToolsWindowIcon() { + return gfx::ImageSkia(); +} + +} // namespace brightray diff --git a/brightray/browser/inspectable_web_contents_delegate.h b/brightray/browser/inspectable_web_contents_delegate.h index a6dc5e1c78f5..9b9cfa427ec6 100644 --- a/brightray/browser/inspectable_web_contents_delegate.h +++ b/brightray/browser/inspectable_web_contents_delegate.h @@ -3,12 +3,17 @@ #include +#include "ui/gfx/image/image_skia.h" + namespace brightray { class InspectableWebContentsDelegate { public: virtual ~InspectableWebContentsDelegate() {} + // Returns the icon of devtools window. + virtual gfx::ImageSkia GetDevToolsWindowIcon(); + // Requested by WebContents of devtools. virtual void DevToolsSaveToFile( const std::string& url, const std::string& content, bool save_as) {} diff --git a/brightray/browser/inspectable_web_contents_impl.h b/brightray/browser/inspectable_web_contents_impl.h index bae3cf865f1d..4caf9cdac6bf 100644 --- a/brightray/browser/inspectable_web_contents_impl.h +++ b/brightray/browser/inspectable_web_contents_impl.h @@ -54,6 +54,9 @@ class InspectableWebContentsImpl : virtual void SetDelegate(InspectableWebContentsDelegate* delegate) { delegate_ = delegate; } + virtual InspectableWebContentsDelegate* GetDelegate() const { + return delegate_; + } content::WebContents* devtools_web_contents() { return devtools_web_contents_.get(); diff --git a/brightray/browser/views/inspectable_web_contents_view_views.cc b/brightray/browser/views/inspectable_web_contents_view_views.cc index d76e8efafa07..e83c6888daf1 100644 --- a/brightray/browser/views/inspectable_web_contents_view_views.cc +++ b/brightray/browser/views/inspectable_web_contents_view_views.cc @@ -1,5 +1,6 @@ #include "browser/views/inspectable_web_contents_view_views.h" +#include "browser/inspectable_web_contents_delegate.h" #include "browser/inspectable_web_contents_impl.h" #include "base/strings/utf_string_conversions.h" @@ -25,6 +26,10 @@ class DevToolsWindowDelegate : public views::ClientView, title_(base::ASCIIToUTF16("Developer Tools")) { // A WidgetDelegate should be deleted on DeleteDelegate. set_owned_by_client(); + + InspectableWebContentsDelegate* delegate = shell->inspectable_web_contents()->GetDelegate(); + if (delegate) + icon_ = delegate->GetDevToolsWindowIcon(); } virtual ~DevToolsWindowDelegate() {} @@ -34,6 +39,8 @@ class DevToolsWindowDelegate : public views::ClientView, virtual bool CanResize() const OVERRIDE { return true; } virtual bool CanMaximize() const OVERRIDE { return false; } virtual base::string16 GetWindowTitle() const OVERRIDE { return title_; } + virtual gfx::ImageSkia GetWindowAppIcon() OVERRIDE { return GetWindowIcon(); } + virtual gfx::ImageSkia GetWindowIcon() OVERRIDE { return icon_; } virtual views::Widget* GetWidget() OVERRIDE { return widget_; } virtual const views::Widget* GetWidget() const OVERRIDE { return widget_; } virtual views::View* GetContentsView() OVERRIDE { return view_; } @@ -50,6 +57,7 @@ class DevToolsWindowDelegate : public views::ClientView, views::View* view_; views::Widget* widget_; base::string16 title_; + gfx::ImageSkia icon_; DISALLOW_COPY_AND_ASSIGN(DevToolsWindowDelegate); }; @@ -144,6 +152,7 @@ void InspectableWebContentsViewViews::SetIsDocked(bool docked) { params.remove_standard_frame = true; #endif devtools_window_->Init(params); + devtools_window_->UpdateWindowIcon(); } ShowDevTools();