Add DevToolsOpened and DevToolsClosed events

This commit is contained in:
Cheng Zhao 2015-06-05 16:57:17 +08:00
parent d1e70e7826
commit 51bb357405
2 changed files with 8 additions and 0 deletions

View file

@ -23,6 +23,8 @@ class InspectableWebContentsDelegate {
virtual void DevToolsAddFileSystem() {} virtual void DevToolsAddFileSystem() {}
virtual void DevToolsRemoveFileSystem( virtual void DevToolsRemoveFileSystem(
const std::string& file_system_path) {} const std::string& file_system_path) {}
virtual void DevToolsOpened() {}
virtual void DevToolsClosed() {}
#if defined(USE_X11) #if defined(USE_X11)
// Called when creating devtools window. // Called when creating devtools window.

View file

@ -301,6 +301,9 @@ void InspectableWebContentsImpl::LoadCompleted() {
// If the devtools can dock, "SetIsDocked" will be called by devtools itself. // If the devtools can dock, "SetIsDocked" will be called by devtools itself.
if (!can_dock_) if (!can_dock_)
SetIsDocked(DispatchCallback(), false); SetIsDocked(DispatchCallback(), false);
if (delegate_)
delegate_->DevToolsOpened();
} }
void InspectableWebContentsImpl::SetInspectedPageBounds(const gfx::Rect& rect) { void InspectableWebContentsImpl::SetInspectedPageBounds(const gfx::Rect& rect) {
@ -506,6 +509,9 @@ void InspectableWebContentsImpl::WebContentsDestroyed() {
for (const auto& pair : pending_requests_) for (const auto& pair : pending_requests_)
delete pair.first; delete pair.first;
if (delegate_)
delegate_->DevToolsClosed();
} }
bool InspectableWebContentsImpl::AddMessageToConsole( bool InspectableWebContentsImpl::AddMessageToConsole(