diff --git a/brightray/browser/inspectable_web_contents_delegate.h b/brightray/browser/inspectable_web_contents_delegate.h index 531b96e1755..b193bd459dd 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 832768a8967..e383bc545c0 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(