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

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

Issue 1003263002: DevTools: support scopes and iframes when debugging service workers. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 9 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_frame_devtools_agent_host.h" 5 #include "content/browser/devtools/render_frame_devtools_agent_host.h"
6 6
7 #include "base/basictypes.h" 7 #include "base/basictypes.h"
8 #include "base/json/json_writer.h" 8 #include "base/json/json_writer.h"
9 #include "base/lazy_instance.h" 9 #include "base/lazy_instance.h"
10 #include "base/strings/utf_string_conversions.h" 10 #include "base/strings/utf_string_conversions.h"
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
152 DevToolsProtocolDispatcher* dispatcher = protocol_handler_->dispatcher(); 152 DevToolsProtocolDispatcher* dispatcher = protocol_handler_->dispatcher();
153 dispatcher->SetDOMHandler(dom_handler_.get()); 153 dispatcher->SetDOMHandler(dom_handler_.get());
154 dispatcher->SetInputHandler(input_handler_.get()); 154 dispatcher->SetInputHandler(input_handler_.get());
155 dispatcher->SetInspectorHandler(inspector_handler_.get()); 155 dispatcher->SetInspectorHandler(inspector_handler_.get());
156 dispatcher->SetNetworkHandler(network_handler_.get()); 156 dispatcher->SetNetworkHandler(network_handler_.get());
157 dispatcher->SetPageHandler(page_handler_.get()); 157 dispatcher->SetPageHandler(page_handler_.get());
158 dispatcher->SetPowerHandler(power_handler_.get()); 158 dispatcher->SetPowerHandler(power_handler_.get());
159 dispatcher->SetServiceWorkerHandler(service_worker_handler_.get()); 159 dispatcher->SetServiceWorkerHandler(service_worker_handler_.get());
160 dispatcher->SetTracingHandler(tracing_handler_.get()); 160 dispatcher->SetTracingHandler(tracing_handler_.get());
161 SetRenderFrameHost(rfh); 161 SetRenderFrameHost(rfh);
162 service_worker_handler_->SetURL(rfh->GetLastCommittedURL());
163 g_instances.Get().push_back(this); 162 g_instances.Get().push_back(this);
164 AddRef(); // Balanced in RenderFrameHostDestroyed. 163 AddRef(); // Balanced in RenderFrameHostDestroyed.
165 DevToolsManager::GetInstance()->AgentHostChanged(this); 164 DevToolsManager::GetInstance()->AgentHostChanged(this);
166 } 165 }
167 166
168 BrowserContext* RenderFrameDevToolsAgentHost::GetBrowserContext() { 167 BrowserContext* RenderFrameDevToolsAgentHost::GetBrowserContext() {
169 WebContents* contents = web_contents(); 168 WebContents* contents = web_contents();
170 return contents ? contents->GetBrowserContext() : nullptr; 169 return contents ? contents->GetBrowserContext() : nullptr;
171 } 170 }
172 171
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after
403 402
404 void RenderFrameDevToolsAgentHost::NavigationEntryCommitted( 403 void RenderFrameDevToolsAgentHost::NavigationEntryCommitted(
405 const LoadCommittedDetails& load_details) { 404 const LoadCommittedDetails& load_details) {
406 DevToolsManager::GetInstance()->AgentHostChanged(this); 405 DevToolsManager::GetInstance()->AgentHostChanged(this);
407 } 406 }
408 407
409 void RenderFrameDevToolsAgentHost::DidCommitProvisionalLoadForFrame( 408 void RenderFrameDevToolsAgentHost::DidCommitProvisionalLoadForFrame(
410 RenderFrameHost* render_frame_host, 409 RenderFrameHost* render_frame_host,
411 const GURL& url, 410 const GURL& url,
412 ui::PageTransition transition_type) { 411 ui::PageTransition transition_type) {
413 if (render_frame_host_ == render_frame_host) 412 service_worker_handler_->UpdateURLs();
414 service_worker_handler_->SetURL(url);
415 } 413 }
416 414
417 void RenderFrameDevToolsAgentHost::Observe(int type, 415 void RenderFrameDevToolsAgentHost::Observe(int type,
418 const NotificationSource& source, 416 const NotificationSource& source,
419 const NotificationDetails& details) { 417 const NotificationDetails& details) {
420 if (type == content::NOTIFICATION_RENDER_WIDGET_VISIBILITY_CHANGED) { 418 if (type == content::NOTIFICATION_RENDER_WIDGET_VISIBILITY_CHANGED) {
421 bool visible = *Details<bool>(details).ptr(); 419 bool visible = *Details<bool>(details).ptr();
422 page_handler_->OnVisibilityChanged(visible); 420 page_handler_->OnVisibilityChanged(visible);
423 } 421 }
424 } 422 }
425 423
426 void RenderFrameDevToolsAgentHost::SetRenderFrameHost(RenderFrameHost* rfh) { 424 void RenderFrameDevToolsAgentHost::SetRenderFrameHost(RenderFrameHost* rfh) {
427 DCHECK(!render_frame_host_); 425 DCHECK(!render_frame_host_);
428 render_frame_host_ = static_cast<RenderFrameHostImpl*>(rfh); 426 render_frame_host_ = static_cast<RenderFrameHostImpl*>(rfh);
429 // TODO(dgozman): here we should DCHECK that frame host is either root or 427 // TODO(dgozman): here we should DCHECK that frame host is either root or
430 // cross process subframe, but this requires handling cross-process 428 // cross process subframe, but this requires handling cross-process
431 // navigation. See http://crbug.com/464993. 429 // navigation. See http://crbug.com/464993.
432 430
433 WebContentsObserver::Observe(WebContents::FromRenderFrameHost(rfh)); 431 WebContentsObserver::Observe(WebContents::FromRenderFrameHost(rfh));
434 RenderViewHostImpl* rvh = static_cast<RenderViewHostImpl*>( 432 RenderViewHostImpl* rvh = static_cast<RenderViewHostImpl*>(
435 rfh->GetRenderViewHost()); 433 rfh->GetRenderViewHost());
436 dom_handler_->SetRenderViewHost(rvh); 434 dom_handler_->SetRenderViewHost(rvh);
437 input_handler_->SetRenderViewHost(rvh); 435 input_handler_->SetRenderViewHost(rvh);
438 network_handler_->SetRenderViewHost(rvh); 436 network_handler_->SetRenderViewHost(rvh);
439 page_handler_->SetRenderViewHost(rvh); 437 page_handler_->SetRenderViewHost(rvh);
440 service_worker_handler_->SetRenderFrameHost(rfh); 438 service_worker_handler_->SetRenderFrameHost(render_frame_host_);
441 439
442 registrar_.Add( 440 registrar_.Add(
443 this, 441 this,
444 content::NOTIFICATION_RENDER_WIDGET_VISIBILITY_CHANGED, 442 content::NOTIFICATION_RENDER_WIDGET_VISIBILITY_CHANGED,
445 content::Source<RenderWidgetHost>(rvh)); 443 content::Source<RenderWidgetHost>(rvh));
446 } 444 }
447 445
448 void RenderFrameDevToolsAgentHost::ClearRenderFrameHost() { 446 void RenderFrameDevToolsAgentHost::ClearRenderFrameHost() {
449 DCHECK(render_frame_host_); 447 DCHECK(render_frame_host_);
450 RenderViewHostImpl* rvh = static_cast<RenderViewHostImpl*>( 448 RenderViewHostImpl* rvh = static_cast<RenderViewHostImpl*>(
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
557 if (!IsAttached() || !render_frame_host_) 555 if (!IsAttached() || !render_frame_host_)
558 return; 556 return;
559 SendMessageToClient(message); 557 SendMessageToClient(message);
560 } 558 }
561 559
562 bool RenderFrameDevToolsAgentHost::IsChildFrame() { 560 bool RenderFrameDevToolsAgentHost::IsChildFrame() {
563 return render_frame_host_ && render_frame_host_->GetParent(); 561 return render_frame_host_ && render_frame_host_->GetParent();
564 } 562 }
565 563
566 } // namespace content 564 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698