| 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_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 "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
| 10 #include "content/browser/child_process_security_policy_impl.h" | 10 #include "content/browser/child_process_security_policy_impl.h" |
| (...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 179 return; | 179 return; |
| 180 } | 180 } |
| 181 } | 181 } |
| 182 | 182 |
| 183 IPCDevToolsAgentHost::DispatchProtocolMessage(message); | 183 IPCDevToolsAgentHost::DispatchProtocolMessage(message); |
| 184 } | 184 } |
| 185 | 185 |
| 186 void RenderViewDevToolsAgentHost::SendMessageToAgent(IPC::Message* msg) { | 186 void RenderViewDevToolsAgentHost::SendMessageToAgent(IPC::Message* msg) { |
| 187 if (!render_view_host_) | 187 if (!render_view_host_) |
| 188 return; | 188 return; |
| 189 msg->set_routing_id(render_view_host_->GetRoutingID()); | 189 RenderFrameHost* main_frame_host = render_view_host_->GetMainFrame(); |
| 190 render_view_host_->Send(msg); | 190 msg->set_routing_id(main_frame_host->GetRoutingID()); |
| 191 main_frame_host->Send(msg); |
| 191 } | 192 } |
| 192 | 193 |
| 193 void RenderViewDevToolsAgentHost::OnClientAttached() { | 194 void RenderViewDevToolsAgentHost::OnClientAttached() { |
| 194 if (!render_view_host_) | 195 if (!render_view_host_) |
| 195 return; | 196 return; |
| 196 | 197 |
| 197 InnerOnClientAttached(); | 198 InnerOnClientAttached(); |
| 198 | 199 |
| 199 // TODO(kaznacheev): Move this call back to DevToolsManager when | 200 // TODO(kaznacheev): Move this call back to DevToolsManager when |
| 200 // extensions::ProcessManager no longer relies on this notification. | 201 // extensions::ProcessManager no longer relies on this notification. |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 327 RenderViewCrashed(); | 328 RenderViewCrashed(); |
| 328 break; | 329 break; |
| 329 default: | 330 default: |
| 330 break; | 331 break; |
| 331 } | 332 } |
| 332 } | 333 } |
| 333 | 334 |
| 334 bool RenderViewDevToolsAgentHost::OnMessageReceived( | 335 bool RenderViewDevToolsAgentHost::OnMessageReceived( |
| 335 const IPC::Message& message, | 336 const IPC::Message& message, |
| 336 RenderFrameHost* render_frame_host) { | 337 RenderFrameHost* render_frame_host) { |
| 338 if (!render_view_host_) |
| 339 return false; |
| 340 if (render_frame_host != render_view_host_->GetMainFrame()) { |
| 341 return false; |
| 342 } |
| 337 return DispatchIPCMessage(message); | 343 return DispatchIPCMessage(message); |
| 338 } | 344 } |
| 339 | 345 |
| 340 bool RenderViewDevToolsAgentHost::OnMessageReceived( | |
| 341 const IPC::Message& message) { | |
| 342 return DispatchIPCMessage(message); | |
| 343 } | |
| 344 | |
| 345 void RenderViewDevToolsAgentHost::DidAttachInterstitialPage() { | 346 void RenderViewDevToolsAgentHost::DidAttachInterstitialPage() { |
| 346 page_handler_->DidAttachInterstitialPage(); | 347 page_handler_->DidAttachInterstitialPage(); |
| 347 | 348 |
| 348 if (!render_view_host_) | 349 if (!render_view_host_) |
| 349 return; | 350 return; |
| 350 // The rvh set in AboutToNavigateRenderFrame turned out to be interstitial. | 351 // The rvh set in AboutToNavigateRenderFrame turned out to be interstitial. |
| 351 // Connect back to the real one. | 352 // Connect back to the real one. |
| 352 WebContents* web_contents = | 353 WebContents* web_contents = |
| 353 WebContents::FromRenderViewHost(render_view_host_); | 354 WebContents::FromRenderViewHost(render_view_host_); |
| 354 if (!web_contents) | 355 if (!web_contents) |
| (...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 514 } | 515 } |
| 515 | 516 |
| 516 void RenderViewDevToolsAgentHost::DispatchOnInspectorFrontend( | 517 void RenderViewDevToolsAgentHost::DispatchOnInspectorFrontend( |
| 517 const std::string& message) { | 518 const std::string& message) { |
| 518 if (!IsAttached() || !render_view_host_) | 519 if (!IsAttached() || !render_view_host_) |
| 519 return; | 520 return; |
| 520 SendMessageToClient(message); | 521 SendMessageToClient(message); |
| 521 } | 522 } |
| 522 | 523 |
| 523 } // namespace content | 524 } // namespace content |
| OLD | NEW |