diff --git a/brightray/browser/inspectable_web_contents.h b/brightray/browser/inspectable_web_contents.h index b436c391ce30..313e4ebea2c3 100644 --- a/brightray/browser/inspectable_web_contents.h +++ b/brightray/browser/inspectable_web_contents.h @@ -23,6 +23,8 @@ class InspectableWebContents { virtual content::WebContents* GetWebContents() const = 0; virtual void ShowDevTools() = 0; + // Close the DevTools completely instead of just hide it. + virtual void CloseDevTools() = 0; virtual bool IsDevToolsViewShowing() = 0; // The delegate manages its own life. diff --git a/brightray/browser/inspectable_web_contents_impl.cc b/brightray/browser/inspectable_web_contents_impl.cc index c4a8f75ef4b5..b22b4a287fbc 100644 --- a/brightray/browser/inspectable_web_contents_impl.cc +++ b/brightray/browser/inspectable_web_contents_impl.cc @@ -101,6 +101,14 @@ void InspectableWebContentsImpl::ShowDevTools() { view_->ShowDevTools(); } +void InspectableWebContentsImpl::CloseDevTools() { + if (IsDevToolsViewShowing()) { + view_->CloseDevTools(); + devtools_web_contents_.reset(); + web_contents_->GetView()->Focus(); + } +} + bool InspectableWebContentsImpl::IsDevToolsViewShowing() { return devtools_web_contents_ && view_->IsDevToolsViewShowing(); } @@ -116,9 +124,7 @@ void InspectableWebContentsImpl::ActivateWindow() { } void InspectableWebContentsImpl::CloseWindow() { - view_->CloseDevTools(); - devtools_web_contents_.reset(); - web_contents_->GetView()->Focus(); + CloseDevTools(); } void InspectableWebContentsImpl::MoveWindow(int x, int y) { diff --git a/brightray/browser/inspectable_web_contents_impl.h b/brightray/browser/inspectable_web_contents_impl.h index f48f0a47bcb5..8581b24ec474 100644 --- a/brightray/browser/inspectable_web_contents_impl.h +++ b/brightray/browser/inspectable_web_contents_impl.h @@ -42,6 +42,7 @@ class InspectableWebContentsImpl : virtual content::WebContents* GetWebContents() const OVERRIDE; virtual void ShowDevTools() OVERRIDE; + virtual void CloseDevTools() OVERRIDE; virtual bool IsDevToolsViewShowing() OVERRIDE; virtual void SetDelegate(InspectableWebContentsDelegate* delegate) { diff --git a/brightray/browser/inspectable_web_contents_view.h b/brightray/browser/inspectable_web_contents_view.h index 87274805f8e0..18fd192a67eb 100644 --- a/brightray/browser/inspectable_web_contents_view.h +++ b/brightray/browser/inspectable_web_contents_view.h @@ -12,6 +12,7 @@ class InspectableWebContentsView { virtual gfx::NativeView GetNativeView() const = 0; virtual void ShowDevTools() = 0; + // Hide the DevTools view. virtual void CloseDevTools() = 0; virtual bool IsDevToolsViewShowing() = 0; virtual bool SetDockSide(const std::string& side) = 0;