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

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

Issue 2047833002: DevTools: introduce browser domain for basic target discovery. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: review comments addressed Created 4 years, 6 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
Index: content/browser/devtools/devtools_agent_host_impl.cc
diff --git a/content/browser/devtools/devtools_agent_host_impl.cc b/content/browser/devtools/devtools_agent_host_impl.cc
index 033f2f18bd90375c7800e59f529ff51db66ebf56..df95b806e2411bd48d95b616eaaa544ea6df17fa 100644
--- a/content/browser/devtools/devtools_agent_host_impl.cc
+++ b/content/browser/devtools/devtools_agent_host_impl.cc
@@ -102,7 +102,11 @@ scoped_refptr<DevToolsAgentHost> DevToolsAgentHost::Create(
return new ForwardingAgentHost(delegate);
}
-void DevToolsAgentHostImpl::AttachClient(DevToolsAgentHostClient* client) {
+bool DevToolsAgentHostImpl::InnerAttach(DevToolsAgentHostClient* client,
+ bool force) {
+ if (client_ && !force)
+ return false;
+
scoped_refptr<DevToolsAgentHostImpl> protect(this);
++session_id_;
if (client_) {
@@ -111,15 +115,33 @@ void DevToolsAgentHostImpl::AttachClient(DevToolsAgentHostClient* client) {
}
client_ = client;
Attach();
+ return true;
}
-void DevToolsAgentHostImpl::DetachClient() {
- if (!client_)
- return;
+bool DevToolsAgentHostImpl::AttachClient(DevToolsAgentHostClient* client) {
+ return InnerAttach(client, false);
+}
+
+void DevToolsAgentHostImpl::ForceAttachClient(DevToolsAgentHostClient* client) {
+ InnerAttach(client, true);
+}
+
+bool DevToolsAgentHostImpl::DetachClient(DevToolsAgentHostClient* client) {
+ if (!client_ || client_ != client)
+ return false;
scoped_refptr<DevToolsAgentHostImpl> protect(this);
client_ = NULL;
InnerDetach();
+ return true;
+}
+
+bool DevToolsAgentHostImpl::DispatchProtocolMessage(
+ DevToolsAgentHostClient* client,
+ const std::string& message) {
+ if (!client_ || client_ != client)
+ return false;
+ return DispatchProtocolMessage(message);
}
void DevToolsAgentHostImpl::InnerDetach() {
« no previous file with comments | « content/browser/devtools/devtools_agent_host_impl.h ('k') | content/browser/devtools/devtools_manager_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698