Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1182)

Unified Diff: chrome/browser/extensions/api/debugger/debugger_api.cc

Issue 11361034: DevTools: [remote debugging] emit Inspector.detached protocol message upon connectin termination. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Review comment addressed Created 8 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/extensions/api/debugger/debugger_api.cc
diff --git a/chrome/browser/extensions/api/debugger/debugger_api.cc b/chrome/browser/extensions/api/debugger/debugger_api.cc
index bd5b98fc88312fc8057d9bf70103e6278b3809cf..c5a4f982624e2b0423fb4cad81755d178c15bcbc 100644
--- a/chrome/browser/extensions/api/debugger/debugger_api.cc
+++ b/chrome/browser/extensions/api/debugger/debugger_api.cc
@@ -101,14 +101,14 @@ class ExtensionDevToolsClientHost : public DevToolsClientHost,
const std::string& method,
SendCommand::Params::CommandParams* command_params);
- // Mark methods below determine the connection termination reason.
- void MarkAsReplaced();
+ // Marks connection as to-be-terminated by the user.
void MarkAsDismissed();
// DevToolsClientHost interface
virtual void InspectedContentsClosing() OVERRIDE;
virtual void DispatchOnInspectorFrontend(const std::string& message) OVERRIDE;
virtual void ContentsReplaced(WebContents* web_contents) OVERRIDE;
+ virtual void ReplacedWithAnotherClient() OVERRIDE;
virtual void FrameNavigating(const std::string& url) OVERRIDE {}
private:
@@ -152,16 +152,6 @@ class AttachedClientHosts {
client_hosts_.erase(client_host);
}
- ExtensionDevToolsClientHost* AsExtensionDevToolsClientHost(
- DevToolsClientHost* client_host) {
- for (std::set<DevToolsClientHost*>::iterator it = client_hosts_.begin();
- it != client_hosts_.end(); ++it) {
- if (client_host == *it)
- return static_cast<ExtensionDevToolsClientHost*>(*it);
- }
- return NULL;
- }
-
ExtensionDevToolsClientHost* Lookup(WebContents* contents) {
for (std::set<DevToolsClientHost*>::iterator it = client_hosts_.begin();
it != client_hosts_.end(); ++it) {
@@ -251,6 +241,10 @@ void ExtensionDevToolsClientHost::ContentsReplaced(WebContents* web_contents) {
web_contents_ = web_contents;
}
+void ExtensionDevToolsClientHost::ReplacedWithAnotherClient() {
+ detach_reason_ = OnDetach::REASON_REPLACED_WITH_DEVTOOLS;
+}
+
void ExtensionDevToolsClientHost::Close() {
DevToolsManager::GetInstance()->ClientHostClosing(this);
delete this;
@@ -275,10 +269,6 @@ void ExtensionDevToolsClientHost::SendMessageToBackend(
DevToolsManager::GetInstance()->DispatchOnInspectorBackend(this, json_args);
}
-void ExtensionDevToolsClientHost::MarkAsReplaced() {
- detach_reason_ = OnDetach::REASON_REPLACED_WITH_DEVTOOLS;
-}
-
void ExtensionDevToolsClientHost::MarkAsDismissed() {
detach_reason_ = OnDetach::REASON_CANCELED_BY_USER;
}
@@ -545,12 +535,3 @@ void SendCommandDebuggerFunction::SendResponseBody(
results_ = SendCommand::Results::Create(result);
SendResponse(true);
}
-
-// static
-void DebuggerApi::MarkDevToolsClientHostAsReplaced(
- DevToolsClientHost* client_host) {
- ExtensionDevToolsClientHost* host = AttachedClientHosts::GetInstance()->
- AsExtensionDevToolsClientHost(client_host);
- if (host)
- host->MarkAsReplaced();
-}

Powered by Google App Engine
This is Rietveld 408576698