diff --git a/brightray/browser/inspectable_web_contents_impl.cc b/brightray/browser/inspectable_web_contents_impl.cc index 1648bee7049..71c981bb409 100644 --- a/brightray/browser/inspectable_web_contents_impl.cc +++ b/brightray/browser/inspectable_web_contents_impl.cc @@ -370,7 +370,7 @@ void InspectableWebContentsImpl::LoadCompleted() { SetIsDocked(DispatchCallback(), false); if (view_->GetDelegate()) - view_->GetDelegate()->DevToolsLoaded(); + view_->GetDelegate()->DevToolsOpened(); } void InspectableWebContentsImpl::SetInspectedPageBounds(const gfx::Rect& rect) { @@ -621,6 +621,9 @@ void InspectableWebContentsImpl::WebContentsDestroyed() { for (const auto& pair : pending_requests_) delete pair.first; + + if (view_ && view_->GetDelegate()) + view_->GetDelegate()->DevToolsClosed(); } bool InspectableWebContentsImpl::AddMessageToConsole( diff --git a/brightray/browser/inspectable_web_contents_view_delegate.h b/brightray/browser/inspectable_web_contents_view_delegate.h index ce1b6e721b6..900857c7a10 100644 --- a/brightray/browser/inspectable_web_contents_view_delegate.h +++ b/brightray/browser/inspectable_web_contents_view_delegate.h @@ -12,7 +12,6 @@ class InspectableWebContentsViewDelegate { virtual void DevToolsFocused() {} virtual void DevToolsOpened() {} virtual void DevToolsClosed() {} - virtual void DevToolsLoaded() {} // Returns the icon of devtools window. virtual gfx::ImageSkia GetDevToolsWindowIcon(); diff --git a/brightray/browser/inspectable_web_contents_view_mac.mm b/brightray/browser/inspectable_web_contents_view_mac.mm index f4c1cd5cb8b..e708a686802 100644 --- a/brightray/browser/inspectable_web_contents_view_mac.mm +++ b/brightray/browser/inspectable_web_contents_view_mac.mm @@ -29,14 +29,10 @@ gfx::NativeView InspectableWebContentsViewMac::GetNativeView() const { void InspectableWebContentsViewMac::ShowDevTools() { [view_ setDevToolsVisible:YES]; - if (GetDelegate()) - GetDelegate()->DevToolsOpened(); } void InspectableWebContentsViewMac::CloseDevTools() { [view_ setDevToolsVisible:NO]; - if (GetDelegate()) - GetDelegate()->DevToolsClosed(); } bool InspectableWebContentsViewMac::IsDevToolsViewShowing() { diff --git a/brightray/browser/views/inspectable_web_contents_view_views.cc b/brightray/browser/views/inspectable_web_contents_view_views.cc index 79fcc103796..09c9ab6f801 100644 --- a/brightray/browser/views/inspectable_web_contents_view_views.cc +++ b/brightray/browser/views/inspectable_web_contents_view_views.cc @@ -118,8 +118,6 @@ void InspectableWebContentsViewViews::ShowDevTools() { devtools_web_view_->RequestFocus(); Layout(); } - if (GetDelegate()) - GetDelegate()->DevToolsOpened(); } void InspectableWebContentsViewViews::CloseDevTools() { @@ -137,8 +135,6 @@ void InspectableWebContentsViewViews::CloseDevTools() { devtools_web_view_->SetWebContents(NULL); Layout(); } - if (GetDelegate()) - GetDelegate()->DevToolsClosed(); } bool InspectableWebContentsViewViews::IsDevToolsViewShowing() {