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

Unified Diff: content/browser/devtools/forwarding_agent_host.cc

Issue 906223003: [DevTools] Preserve DevTools window when remote connection is lost. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 10 months 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/devtools/forwarding_agent_host.cc
diff --git a/content/browser/devtools/forwarding_agent_host.cc b/content/browser/devtools/forwarding_agent_host.cc
index 4d3e4fff0b045cc782867513a8c570c9138b15ed..db8af96a2b1f5df3a82b20eaade3dea4aaca62d9 100644
--- a/content/browser/devtools/forwarding_agent_host.cc
+++ b/content/browser/devtools/forwarding_agent_host.cc
@@ -4,6 +4,9 @@
#include "content/browser/devtools/forwarding_agent_host.h"
+#include "base/bind.h"
+#include "content/browser/devtools/protocol/inspector_handler.h"
+
namespace content {
ForwardingAgentHost::ForwardingAgentHost(
@@ -19,20 +22,28 @@ void ForwardingAgentHost::DispatchOnClientHost(const std::string& message) {
}
void ForwardingAgentHost::ConnectionClosed() {
- HostClosed();
+ devtools::inspector::Client inspector(
+ base::Bind(&ForwardingAgentHost::DispatchOnClientHost,
+ base::Unretained(this)));
+ inspector.Detached(devtools::inspector::DetachedParams::Create()
+ ->set_reason("Connection lost."));
+ delegate_.reset();
}
void ForwardingAgentHost::Attach() {
- delegate_->Attach(this);
+ if (delegate_)
+ delegate_->Attach(this);
}
void ForwardingAgentHost::Detach() {
- delegate_->Detach();
+ if (delegate_)
+ delegate_->Detach();
}
void ForwardingAgentHost::DispatchProtocolMessage(
const std::string& message) {
- delegate_->SendMessageToBackend(message);
+ if (delegate_)
+ delegate_->SendMessageToBackend(message);
}
DevToolsAgentHost::Type ForwardingAgentHost::GetType() {
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698