From 51bb3574055653ec43d0970c81729a7bcdb8212d Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Fri, 5 Jun 2015 16:57:17 +0800 Subject: [PATCH] Add DevToolsOpened and DevToolsClosed events --- brightray/browser/inspectable_web_contents_delegate.h | 2 ++ brightray/browser/inspectable_web_contents_impl.cc | 6 ++++++ 2 files changed, 8 insertions(+) diff --git a/brightray/browser/inspectable_web_contents_delegate.h b/brightray/browser/inspectable_web_contents_delegate.h index 531b96e175..b193bd459d 100644 --- a/brightray/browser/inspectable_web_contents_delegate.h +++ b/brightray/browser/inspectable_web_contents_delegate.h @@ -23,6 +23,8 @@ class InspectableWebContentsDelegate { virtual void DevToolsAddFileSystem() {} virtual void DevToolsRemoveFileSystem( const std::string& file_system_path) {} + virtual void DevToolsOpened() {} + virtual void DevToolsClosed() {} #if defined(USE_X11) // Called when creating devtools window. diff --git a/brightray/browser/inspectable_web_contents_impl.cc b/brightray/browser/inspectable_web_contents_impl.cc index 832768a896..e383bc545c 100644 --- a/brightray/browser/inspectable_web_contents_impl.cc +++ b/brightray/browser/inspectable_web_contents_impl.cc @@ -301,6 +301,9 @@ void InspectableWebContentsImpl::LoadCompleted() { // If the devtools can dock, "SetIsDocked" will be called by devtools itself. if (!can_dock_) SetIsDocked(DispatchCallback(), false); + + if (delegate_) + delegate_->DevToolsOpened(); } void InspectableWebContentsImpl::SetInspectedPageBounds(const gfx::Rect& rect) { @@ -506,6 +509,9 @@ void InspectableWebContentsImpl::WebContentsDestroyed() { for (const auto& pair : pending_requests_) delete pair.first; + + if (delegate_) + delegate_->DevToolsClosed(); } bool InspectableWebContentsImpl::AddMessageToConsole(