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

Side by Side Diff: content/browser/devtools/render_view_devtools_agent_host.cc

Issue 459403002: DevTools: Added service workers to remote debugging targets (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Android fixes Created 6 years, 4 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 "content/browser/devtools/render_view_devtools_agent_host.h" 5 #include "content/browser/devtools/render_view_devtools_agent_host.h"
6 6
7 #include "base/basictypes.h" 7 #include "base/basictypes.h"
8 #include "base/lazy_instance.h" 8 #include "base/lazy_instance.h"
9 #include "content/browser/child_process_security_policy_impl.h" 9 #include "content/browser/child_process_security_policy_impl.h"
10 #include "content/browser/devtools/devtools_manager_impl.h" 10 #include "content/browser/devtools/devtools_manager_impl.h"
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 return FindAgentHost(web_contents) != NULL; 65 return FindAgentHost(web_contents) != NULL;
66 } 66 }
67 67
68 // static 68 // static
69 bool DevToolsAgentHost::IsDebuggerAttached(WebContents* web_contents) { 69 bool DevToolsAgentHost::IsDebuggerAttached(WebContents* web_contents) {
70 RenderViewDevToolsAgentHost* agent_host = FindAgentHost(web_contents); 70 RenderViewDevToolsAgentHost* agent_host = FindAgentHost(web_contents);
71 return agent_host && agent_host->IsAttached(); 71 return agent_host && agent_host->IsAttached();
72 } 72 }
73 73
74 //static 74 //static
75 std::vector<WebContents*> DevToolsAgentHost::GetInspectableWebContents() { 75 std::vector<WebContents*> DevToolsAgentHostImpl::GetInspectableWebContents() {
76 std::set<WebContents*> set; 76 std::set<WebContents*> set;
77 scoped_ptr<RenderWidgetHostIterator> widgets( 77 scoped_ptr<RenderWidgetHostIterator> widgets(
78 RenderWidgetHost::GetRenderWidgetHosts()); 78 RenderWidgetHost::GetRenderWidgetHosts());
79 while (RenderWidgetHost* widget = widgets->GetNextHost()) { 79 while (RenderWidgetHost* widget = widgets->GetNextHost()) {
80 // Ignore processes that don't have a connection, such as crashed contents. 80 // Ignore processes that don't have a connection, such as crashed contents.
81 if (!widget->GetProcess()->HasConnection()) 81 if (!widget->GetProcess()->HasConnection())
82 continue; 82 continue;
83 if (!widget->IsRenderView()) 83 if (!widget->IsRenderView())
84 continue; 84 continue;
85 85
(...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after
363 } 363 }
364 364
365 void RenderViewDevToolsAgentHost::DisconnectWebContents() { 365 void RenderViewDevToolsAgentHost::DisconnectWebContents() {
366 DisconnectRenderViewHost(); 366 DisconnectRenderViewHost();
367 } 367 }
368 368
369 void RenderViewDevToolsAgentHost::ConnectWebContents(WebContents* wc) { 369 void RenderViewDevToolsAgentHost::ConnectWebContents(WebContents* wc) {
370 ConnectRenderViewHost(wc->GetRenderViewHost()); 370 ConnectRenderViewHost(wc->GetRenderViewHost());
371 } 371 }
372 372
373 GURL RenderViewDevToolsAgentHost::GetURL() {
374 if (render_view_host_) {
375 if (content::RenderFrameHost* rfh = render_view_host_->GetMainFrame()) {
376 if (rfh->IsCrossProcessSubframe())
377 return rfh->GetLastCommittedURL();
378 }
379 if (WebContents* web_contents = GetWebContents())
380 return web_contents->GetURL();
381 }
382 return GURL();
383 }
384
373 void RenderViewDevToolsAgentHost::ConnectRenderViewHost(RenderViewHost* rvh) { 385 void RenderViewDevToolsAgentHost::ConnectRenderViewHost(RenderViewHost* rvh) {
374 SetRenderViewHost(rvh); 386 SetRenderViewHost(rvh);
375 if (IsAttached()) 387 if (IsAttached())
376 Reattach(state_); 388 Reattach(state_);
377 } 389 }
378 390
379 void RenderViewDevToolsAgentHost::DisconnectRenderViewHost() { 391 void RenderViewDevToolsAgentHost::DisconnectRenderViewHost() {
380 ClientDetachedFromRenderer(); 392 ClientDetachedFromRenderer();
381 ClearRenderViewHost(); 393 ClearRenderViewHost();
382 } 394 }
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
443 scoped_refptr<DevToolsProtocol::Notification> notification = 455 scoped_refptr<DevToolsProtocol::Notification> notification =
444 DevToolsProtocol::ParseNotification(message); 456 DevToolsProtocol::ParseNotification(message);
445 457
446 if (notification) { 458 if (notification) {
447 tracing_handler_->HandleNotification(notification); 459 tracing_handler_->HandleNotification(notification);
448 } 460 }
449 SendMessageToClient(message); 461 SendMessageToClient(message);
450 } 462 }
451 463
452 } // namespace content 464 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698