summaryrefslogtreecommitdiffstats
path: root/chrome/browser/debugger
diff options
context:
space:
mode:
authorpfeldman@chromium.org <pfeldman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-04-07 07:52:31 +0000
committerpfeldman@chromium.org <pfeldman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-04-07 07:52:31 +0000
commit86fd92283a371973f175b34f39ba8dd6ef86d7bc (patch)
tree2bd5a71a4bd41f4efdc812600478b5bbb547c932 /chrome/browser/debugger
parent75896d770eb0108301fd279f40f823bbaecadd73 (diff)
downloadchromium_src-86fd92283a371973f175b34f39ba8dd6ef86d7bc.zip
chromium_src-86fd92283a371973f175b34f39ba8dd6ef86d7bc.tar.gz
chromium_src-86fd92283a371973f175b34f39ba8dd6ef86d7bc.tar.bz2
DevTools: tell agent it has client attached early (prior to the navigation).
Review URL: http://codereview.chromium.org/60115 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@13237 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/debugger')
-rw-r--r--chrome/browser/debugger/devtools_manager.cc21
-rw-r--r--chrome/browser/debugger/devtools_manager.h9
2 files changed, 12 insertions, 18 deletions
diff --git a/chrome/browser/debugger/devtools_manager.cc b/chrome/browser/debugger/devtools_manager.cc
index 24ba280..5bcb193 100644
--- a/chrome/browser/debugger/devtools_manager.cc
+++ b/chrome/browser/debugger/devtools_manager.cc
@@ -26,8 +26,7 @@ DevToolsManager::~DevToolsManager() {
void DevToolsManager::Observe(NotificationType type,
const NotificationSource& source,
const NotificationDetails& details) {
- DCHECK(type == NotificationType::WEB_CONTENTS_DISCONNECTED ||
- type == NotificationType::WEB_CONTENTS_SWAPPED);
+ DCHECK(type == NotificationType::WEB_CONTENTS_DISCONNECTED);
if (type == NotificationType::WEB_CONTENTS_DISCONNECTED) {
Source<WebContents> src(source);
@@ -44,12 +43,6 @@ void DevToolsManager::Observe(NotificationType type,
client_host->InspectedTabClosing();
UnregisterDevToolsClientHost(client_host, controller);
}
- } else if (type == NotificationType::WEB_CONTENTS_SWAPPED) {
- Source<WebContents> src(source);
- DevToolsClientHost* client_host = GetDevToolsClientHostFor(*src.ptr());
- if (client_host) {
- SendAttachToAgent(*src.ptr());
- }
}
}
@@ -75,7 +68,7 @@ void DevToolsManager::RegisterDevToolsClientHostFor(
client_host->set_close_listener(this);
StartListening(navigation_controller);
- SendAttachToAgent(web_contents);
+ SendAttachToAgent(web_contents, web_contents.render_view_host());
}
void DevToolsManager::ForwardToDevToolsAgent(
@@ -207,10 +200,6 @@ void DevToolsManager::StartListening(
this,
NotificationType::WEB_CONTENTS_DISCONNECTED,
NotificationService::AllSources());
- web_contents_listeners_->Add(
- this,
- NotificationType::WEB_CONTENTS_SWAPPED,
- NotificationService::AllSources());
}
}
@@ -223,9 +212,9 @@ void DevToolsManager::StopListening(
}
}
-void DevToolsManager::SendAttachToAgent(const WebContents& wc) {
- RenderViewHost* target_host = wc.render_view_host();
- if (target_host) {
+void DevToolsManager::SendAttachToAgent(const WebContents& wc,
+ RenderViewHost* target_host) {
+ if (GetDevToolsClientHostFor(wc) && target_host) {
IPC::Message* m = new DevToolsAgentMsg_Attach();
m->set_routing_id(target_host->routing_id());
target_host->Send(m);
diff --git a/chrome/browser/debugger/devtools_manager.h b/chrome/browser/debugger/devtools_manager.h
index 48c887c..fe6fc4f 100644
--- a/chrome/browser/debugger/devtools_manager.h
+++ b/chrome/browser/debugger/devtools_manager.h
@@ -53,7 +53,13 @@ class DevToolsManager : public NotificationObserver,
// exists.
void InspectElement(WebContents* web_contents, int x, int y);
- private:
+ // Sends 'Attach' message to the agent using |target_host| in case
+ // there is a DevToolsClientHost registered for the |web_contents|.
+ void SendAttachToAgent(
+ const WebContents& web_contents,
+ RenderViewHost* target_host);
+
+private:
// NotificationObserver override.
virtual void Observe(NotificationType type,
const NotificationSource& source,
@@ -75,7 +81,6 @@ class DevToolsManager : public NotificationObserver,
NavigationController* navigation_controller);
void StartListening(NavigationController* navigation_controller);
void StopListening(NavigationController* navigation_controller);
- void SendAttachToAgent(const WebContents& web_contents);
void SendDetachToAgent(const WebContents& web_contents);
// This object is not NULL iff there is at least one registered