| 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/debugger/render_view_devtools_agent_host.h" | 5 #include "content/browser/debugger/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/debugger/devtools_manager_impl.h" | 9 #include "content/browser/debugger/devtools_manager_impl.h" |
| 10 #include "content/browser/debugger/render_view_devtools_agent_host.h" | 10 #include "content/browser/debugger/render_view_devtools_agent_host.h" |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 70 return true; | 70 return true; |
| 71 } | 71 } |
| 72 return false; | 72 return false; |
| 73 } | 73 } |
| 74 | 74 |
| 75 RenderViewDevToolsAgentHost::RenderViewDevToolsAgentHost( | 75 RenderViewDevToolsAgentHost::RenderViewDevToolsAgentHost( |
| 76 RenderViewHost* rvh) | 76 RenderViewHost* rvh) |
| 77 : content::RenderViewHostObserver(rvh), | 77 : content::RenderViewHostObserver(rvh), |
| 78 render_view_host_(rvh) { | 78 render_view_host_(rvh) { |
| 79 g_instances.Get()[rvh] = this; | 79 g_instances.Get()[rvh] = this; |
| 80 | |
| 81 // Notify that the view is being opened. This allows any views being debugged | |
| 82 // to do anything special they need to do to support debugging. | |
| 83 content::NotificationService::current()->Notify( | |
| 84 content::NOTIFICATION_DEVTOOLS_WINDOW_OPENING, | |
| 85 content::Source<content::BrowserContext>( | |
| 86 render_view_host_->GetSiteInstance()->GetProcess()-> | |
| 87 GetBrowserContext()), | |
| 88 content::Details<RenderViewHost>(render_view_host_)); | |
| 89 } | 80 } |
| 90 | 81 |
| 91 void RenderViewDevToolsAgentHost::SendMessageToAgent(IPC::Message* msg) { | 82 void RenderViewDevToolsAgentHost::SendMessageToAgent(IPC::Message* msg) { |
| 92 msg->set_routing_id(render_view_host_->GetRoutingID()); | 83 msg->set_routing_id(render_view_host_->GetRoutingID()); |
| 93 render_view_host_->Send(msg); | 84 render_view_host_->Send(msg); |
| 94 } | 85 } |
| 95 | 86 |
| 96 void RenderViewDevToolsAgentHost::NotifyClientClosing() { | 87 void RenderViewDevToolsAgentHost::NotifyClientAttaching() { |
| 97 content::NotificationService::current()->Notify( | 88 content::NotificationService::current()->Notify( |
| 98 content::NOTIFICATION_DEVTOOLS_WINDOW_CLOSING, | 89 content::NOTIFICATION_DEVTOOLS_AGENT_ATTACHED, |
| 99 content::Source<content::BrowserContext>( | 90 content::Source<content::BrowserContext>( |
| 100 render_view_host_->GetSiteInstance()->GetProcess()-> | 91 render_view_host_->GetSiteInstance()->GetProcess()-> |
| 101 GetBrowserContext()), | 92 GetBrowserContext()), |
| 93 content::Details<RenderViewHost>(render_view_host_)); |
| 94 } |
| 95 |
| 96 void RenderViewDevToolsAgentHost::NotifyClientDetaching() { |
| 97 content::NotificationService::current()->Notify( |
| 98 content::NOTIFICATION_DEVTOOLS_AGENT_DETACHED, |
| 99 content::Source<content::BrowserContext>( |
| 100 render_view_host_->GetSiteInstance()->GetProcess()-> |
| 101 GetBrowserContext()), |
| 102 content::Details<RenderViewHost>(render_view_host_)); | 102 content::Details<RenderViewHost>(render_view_host_)); |
| 103 } | 103 } |
| 104 | 104 |
| 105 int RenderViewDevToolsAgentHost::GetRenderProcessId() { | 105 int RenderViewDevToolsAgentHost::GetRenderProcessId() { |
| 106 return render_view_host_->GetProcess()->GetID(); | 106 return render_view_host_->GetProcess()->GetID(); |
| 107 } | 107 } |
| 108 | 108 |
| 109 RenderViewDevToolsAgentHost::~RenderViewDevToolsAgentHost() { | 109 RenderViewDevToolsAgentHost::~RenderViewDevToolsAgentHost() { |
| 110 g_instances.Get().erase(render_view_host_); | 110 g_instances.Get().erase(render_view_host_); |
| 111 } | 111 } |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 145 | 145 |
| 146 void RenderViewDevToolsAgentHost::OnClearBrowserCache() { | 146 void RenderViewDevToolsAgentHost::OnClearBrowserCache() { |
| 147 content::GetContentClient()->browser()->ClearCache(render_view_host_); | 147 content::GetContentClient()->browser()->ClearCache(render_view_host_); |
| 148 } | 148 } |
| 149 | 149 |
| 150 void RenderViewDevToolsAgentHost::OnClearBrowserCookies() { | 150 void RenderViewDevToolsAgentHost::OnClearBrowserCookies() { |
| 151 content::GetContentClient()->browser()->ClearCookies(render_view_host_); | 151 content::GetContentClient()->browser()->ClearCookies(render_view_host_); |
| 152 } | 152 } |
| 153 | 153 |
| 154 } // namespace content | 154 } // namespace content |
| OLD | NEW |