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

Side by Side Diff: components/devtools_http_handler/devtools_http_handler.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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include <stddef.h> 5 #include <stddef.h>
6 #include <stdint.h> 6 #include <stdint.h>
7 7
8 #include <algorithm> 8 #include <algorithm>
9 #include <utility> 9 #include <utility>
10 10
(...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after
270 server_wrapper_(server_wrapper), 270 server_wrapper_(server_wrapper),
271 connection_id_(connection_id), 271 connection_id_(connection_id),
272 agent_host_(agent_host) { 272 agent_host_(agent_host) {
273 DCHECK_CURRENTLY_ON(BrowserThread::UI); 273 DCHECK_CURRENTLY_ON(BrowserThread::UI);
274 agent_host_->AttachClient(this); 274 agent_host_->AttachClient(this);
275 } 275 }
276 276
277 ~DevToolsAgentHostClientImpl() override { 277 ~DevToolsAgentHostClientImpl() override {
278 DCHECK_CURRENTLY_ON(BrowserThread::UI); 278 DCHECK_CURRENTLY_ON(BrowserThread::UI);
279 if (agent_host_.get()) 279 if (agent_host_.get())
280 agent_host_->DetachClient(); 280 agent_host_->DetachClient(this);
281 } 281 }
282 282
283 void AgentHostClosed(DevToolsAgentHost* agent_host, 283 void AgentHostClosed(DevToolsAgentHost* agent_host,
284 bool replaced_with_another_client) override { 284 bool replaced_with_another_client) override {
285 DCHECK_CURRENTLY_ON(BrowserThread::UI); 285 DCHECK_CURRENTLY_ON(BrowserThread::UI);
286 DCHECK(agent_host == agent_host_.get()); 286 DCHECK(agent_host == agent_host_.get());
287 287
288 std::string message = base::StringPrintf( 288 std::string message = base::StringPrintf(
289 "{ \"method\": \"Inspector.detached\", " 289 "{ \"method\": \"Inspector.detached\", "
290 "\"params\": { \"reason\": \"%s\"} }", 290 "\"params\": { \"reason\": \"%s\"} }",
(...skipping 14 matching lines...) Expand all
305 DCHECK(agent_host == agent_host_.get()); 305 DCHECK(agent_host == agent_host_.get());
306 message_loop_->task_runner()->PostTask( 306 message_loop_->task_runner()->PostTask(
307 FROM_HERE, 307 FROM_HERE,
308 base::Bind(&ServerWrapper::SendOverWebSocket, 308 base::Bind(&ServerWrapper::SendOverWebSocket,
309 base::Unretained(server_wrapper_), connection_id_, message)); 309 base::Unretained(server_wrapper_), connection_id_, message));
310 } 310 }
311 311
312 void OnMessage(const std::string& message) { 312 void OnMessage(const std::string& message) {
313 DCHECK_CURRENTLY_ON(BrowserThread::UI); 313 DCHECK_CURRENTLY_ON(BrowserThread::UI);
314 if (agent_host_.get()) 314 if (agent_host_.get())
315 agent_host_->DispatchProtocolMessage(message); 315 agent_host_->DispatchProtocolMessage(this, message);
316 } 316 }
317 317
318 private: 318 private:
319 base::MessageLoop* const message_loop_; 319 base::MessageLoop* const message_loop_;
320 ServerWrapper* const server_wrapper_; 320 ServerWrapper* const server_wrapper_;
321 const int connection_id_; 321 const int connection_id_;
322 scoped_refptr<DevToolsAgentHost> agent_host_; 322 scoped_refptr<DevToolsAgentHost> agent_host_;
323 }; 323 };
324 324
325 static bool TimeComparator(const DevToolsTargetDescriptor* desc1, 325 static bool TimeComparator(const DevToolsTargetDescriptor* desc1,
(...skipping 604 matching lines...) Expand 10 before | Expand all | Expand 10 after
930 id.c_str(), 930 id.c_str(),
931 host); 931 host);
932 dictionary->SetString( 932 dictionary->SetString(
933 kTargetDevtoolsFrontendUrlField, devtools_frontend_url); 933 kTargetDevtoolsFrontendUrlField, devtools_frontend_url);
934 } 934 }
935 935
936 return dictionary; 936 return dictionary;
937 } 937 }
938 938
939 } // namespace devtools_http_handler 939 } // namespace devtools_http_handler
OLDNEW
« no previous file with comments | « chrome/browser/prerender/prerender_browsertest.cc ('k') | content/browser/devtools/browser_devtools_agent_host.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698