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

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

Issue 349033009: DevTools: Added service workers to chrome://inspect/#devices (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed lifetime again Created 6 years, 5 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 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 RenderViewHost* rvh = (*it)->render_view_host_; 102 RenderViewHost* rvh = (*it)->render_view_host_;
103 if (rvh && rvh->GetDelegate() != delegate) 103 if (rvh && rvh->GetDelegate() != delegate)
104 continue; 104 continue;
105 if ((*it)->IsAttached()) 105 if ((*it)->IsAttached())
106 return true; 106 return true;
107 } 107 }
108 return false; 108 return false;
109 } 109 }
110 110
111 //static 111 //static
112 std::vector<RenderViewHost*> DevToolsAgentHost::GetValidRenderViewHosts() { 112 std::vector<RenderViewHost*> DevToolsAgentHostImpl::GetValidRenderViewHosts() {
113 std::vector<RenderViewHost*> result; 113 std::vector<RenderViewHost*> result;
114 scoped_ptr<RenderWidgetHostIterator> widgets( 114 scoped_ptr<RenderWidgetHostIterator> widgets(
115 RenderWidgetHost::GetRenderWidgetHosts()); 115 RenderWidgetHost::GetRenderWidgetHosts());
116 while (RenderWidgetHost* widget = widgets->GetNextHost()) { 116 while (RenderWidgetHost* widget = widgets->GetNextHost()) {
117 // Ignore processes that don't have a connection, such as crashed contents. 117 // Ignore processes that don't have a connection, such as crashed contents.
118 if (!widget->GetProcess()->HasConnection()) 118 if (!widget->GetProcess()->HasConnection())
119 continue; 119 continue;
120 if (!widget->IsRenderView()) 120 if (!widget->IsRenderView())
121 continue; 121 continue;
122 122
(...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after
410 SetRenderViewHost(rvh); 410 SetRenderViewHost(rvh);
411 if (IsAttached()) 411 if (IsAttached())
412 Reattach(state_); 412 Reattach(state_);
413 } 413 }
414 414
415 void RenderViewDevToolsAgentHost::DisconnectRenderViewHost() { 415 void RenderViewDevToolsAgentHost::DisconnectRenderViewHost() {
416 ClientDetachedFromRenderer(); 416 ClientDetachedFromRenderer();
417 ClearRenderViewHost(); 417 ClearRenderViewHost();
418 } 418 }
419 419
420 GURL RenderViewDevToolsAgentHost::GetURL() {
421 if (render_view_host_) {
422 if (content::RenderFrameHost* rfh = render_view_host_->GetMainFrame()) {
423 if (rfh->IsCrossProcessSubframe())
424 return rfh->GetLastCommittedURL();
425 }
426 if (WebContents* web_contents =
427 WebContents::FromRenderViewHost(render_view_host_)) {
428 return web_contents->GetURL();
429 }
430 }
431 return GURL();
432 }
433
420 void RenderViewDevToolsAgentHost::RenderViewCrashed() { 434 void RenderViewDevToolsAgentHost::RenderViewCrashed() {
421 scoped_refptr<DevToolsProtocol::Notification> notification = 435 scoped_refptr<DevToolsProtocol::Notification> notification =
422 DevToolsProtocol::CreateNotification( 436 DevToolsProtocol::CreateNotification(
423 devtools::Inspector::targetCrashed::kName, NULL); 437 devtools::Inspector::targetCrashed::kName, NULL);
424 DevToolsManagerImpl::GetInstance()-> 438 DevToolsManagerImpl::GetInstance()->
425 DispatchOnInspectorFrontend(this, notification->Serialize()); 439 DispatchOnInspectorFrontend(this, notification->Serialize());
426 } 440 }
427 441
428 bool RenderViewDevToolsAgentHost::DispatchIPCMessage( 442 bool RenderViewDevToolsAgentHost::DispatchIPCMessage(
429 const IPC::Message& msg) { 443 const IPC::Message& msg) {
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
467 481
468 void RenderViewDevToolsAgentHost::OnDispatchOnInspectorFrontend( 482 void RenderViewDevToolsAgentHost::OnDispatchOnInspectorFrontend(
469 const std::string& message) { 483 const std::string& message) {
470 if (!render_view_host_) 484 if (!render_view_host_)
471 return; 485 return;
472 DevToolsManagerImpl::GetInstance()->DispatchOnInspectorFrontend( 486 DevToolsManagerImpl::GetInstance()->DispatchOnInspectorFrontend(
473 this, message); 487 this, message);
474 } 488 }
475 489
476 } // namespace content 490 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/devtools/render_view_devtools_agent_host.h ('k') | content/browser/service_worker/embedded_worker_instance.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698