| OLD | NEW |
| 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 419 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 430 // cross process subframe, but this requires handling cross-process | 430 // cross process subframe, but this requires handling cross-process |
| 431 // navigation. See http://crbug.com/464993. | 431 // navigation. See http://crbug.com/464993. |
| 432 | 432 |
| 433 WebContentsObserver::Observe(WebContents::FromRenderFrameHost(rfh)); | 433 WebContentsObserver::Observe(WebContents::FromRenderFrameHost(rfh)); |
| 434 RenderViewHostImpl* rvh = static_cast<RenderViewHostImpl*>( | 434 RenderViewHostImpl* rvh = static_cast<RenderViewHostImpl*>( |
| 435 rfh->GetRenderViewHost()); | 435 rfh->GetRenderViewHost()); |
| 436 dom_handler_->SetRenderViewHost(rvh); | 436 dom_handler_->SetRenderViewHost(rvh); |
| 437 input_handler_->SetRenderViewHost(rvh); | 437 input_handler_->SetRenderViewHost(rvh); |
| 438 network_handler_->SetRenderViewHost(rvh); | 438 network_handler_->SetRenderViewHost(rvh); |
| 439 page_handler_->SetRenderViewHost(rvh); | 439 page_handler_->SetRenderViewHost(rvh); |
| 440 service_worker_handler_->SetRenderFrameHost(rfh); |
| 440 | 441 |
| 441 registrar_.Add( | 442 registrar_.Add( |
| 442 this, | 443 this, |
| 443 content::NOTIFICATION_RENDER_WIDGET_VISIBILITY_CHANGED, | 444 content::NOTIFICATION_RENDER_WIDGET_VISIBILITY_CHANGED, |
| 444 content::Source<RenderWidgetHost>(rvh)); | 445 content::Source<RenderWidgetHost>(rvh)); |
| 445 } | 446 } |
| 446 | 447 |
| 447 void RenderFrameDevToolsAgentHost::ClearRenderFrameHost() { | 448 void RenderFrameDevToolsAgentHost::ClearRenderFrameHost() { |
| 448 DCHECK(render_frame_host_); | 449 DCHECK(render_frame_host_); |
| 449 RenderViewHostImpl* rvh = static_cast<RenderViewHostImpl*>( | 450 RenderViewHostImpl* rvh = static_cast<RenderViewHostImpl*>( |
| 450 render_frame_host_->GetRenderViewHost()); | 451 render_frame_host_->GetRenderViewHost()); |
| 451 registrar_.Remove( | 452 registrar_.Remove( |
| 452 this, | 453 this, |
| 453 content::NOTIFICATION_RENDER_WIDGET_VISIBILITY_CHANGED, | 454 content::NOTIFICATION_RENDER_WIDGET_VISIBILITY_CHANGED, |
| 454 content::Source<RenderWidgetHost>(rvh)); | 455 content::Source<RenderWidgetHost>(rvh)); |
| 455 render_frame_host_ = nullptr; | 456 render_frame_host_ = nullptr; |
| 456 dom_handler_->SetRenderViewHost(nullptr); | 457 dom_handler_->SetRenderViewHost(nullptr); |
| 457 input_handler_->SetRenderViewHost(nullptr); | 458 input_handler_->SetRenderViewHost(nullptr); |
| 458 network_handler_->SetRenderViewHost(nullptr); | 459 network_handler_->SetRenderViewHost(nullptr); |
| 459 page_handler_->SetRenderViewHost(nullptr); | 460 page_handler_->SetRenderViewHost(nullptr); |
| 461 service_worker_handler_->SetRenderFrameHost(nullptr); |
| 460 } | 462 } |
| 461 | 463 |
| 462 void RenderFrameDevToolsAgentHost::DisconnectWebContents() { | 464 void RenderFrameDevToolsAgentHost::DisconnectWebContents() { |
| 463 DisconnectRenderFrameHost(); | 465 DisconnectRenderFrameHost(); |
| 464 } | 466 } |
| 465 | 467 |
| 466 void RenderFrameDevToolsAgentHost::ConnectWebContents(WebContents* wc) { | 468 void RenderFrameDevToolsAgentHost::ConnectWebContents(WebContents* wc) { |
| 467 ConnectRenderFrameHost(wc->GetMainFrame()); | 469 ConnectRenderFrameHost(wc->GetMainFrame()); |
| 468 } | 470 } |
| 469 | 471 |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 555 if (!IsAttached() || !render_frame_host_) | 557 if (!IsAttached() || !render_frame_host_) |
| 556 return; | 558 return; |
| 557 SendMessageToClient(message); | 559 SendMessageToClient(message); |
| 558 } | 560 } |
| 559 | 561 |
| 560 bool RenderFrameDevToolsAgentHost::IsChildFrame() { | 562 bool RenderFrameDevToolsAgentHost::IsChildFrame() { |
| 561 return render_frame_host_ && render_frame_host_->GetParent(); | 563 return render_frame_host_ && render_frame_host_->GetParent(); |
| 562 } | 564 } |
| 563 | 565 |
| 564 } // namespace content | 566 } // namespace content |
| OLD | NEW |