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 "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 399 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 Loading... |
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 |
OLD | NEW |