| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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.h" | 9 #include "content/browser/debugger/devtools_manager.h" |
| 10 #include "content/browser/debugger/render_view_devtools_agent_host.h" | 10 #include "content/browser/debugger/render_view_devtools_agent_host.h" |
| 11 #include "content/browser/renderer_host/render_process_host.h" | 11 #include "content/browser/renderer_host/render_process_host_impl.h" |
| 12 #include "content/browser/renderer_host/render_view_host.h" | 12 #include "content/browser/renderer_host/render_view_host.h" |
| 13 #include "content/browser/site_instance.h" | 13 #include "content/browser/site_instance.h" |
| 14 #include "content/browser/tab_contents/tab_contents.h" | 14 #include "content/browser/tab_contents/tab_contents.h" |
| 15 #include "content/common/devtools_messages.h" | 15 #include "content/common/devtools_messages.h" |
| 16 #include "content/public/browser/content_browser_client.h" | 16 #include "content/public/browser/content_browser_client.h" |
| 17 #include "content/public/browser/notification_service.h" | 17 #include "content/public/browser/notification_service.h" |
| 18 #include "content/public/browser/notification_types.h" | 18 #include "content/public/browser/notification_types.h" |
| 19 | 19 |
| 20 typedef std::map<RenderViewHost*, RenderViewDevToolsAgentHost*> Instances; | 20 typedef std::map<RenderViewHost*, RenderViewDevToolsAgentHost*> Instances; |
| 21 | 21 |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 57 | 57 |
| 58 void RenderViewDevToolsAgentHost::SendMessageToAgent(IPC::Message* msg) { | 58 void RenderViewDevToolsAgentHost::SendMessageToAgent(IPC::Message* msg) { |
| 59 msg->set_routing_id(render_view_host_->routing_id()); | 59 msg->set_routing_id(render_view_host_->routing_id()); |
| 60 render_view_host_->Send(msg); | 60 render_view_host_->Send(msg); |
| 61 } | 61 } |
| 62 | 62 |
| 63 void RenderViewDevToolsAgentHost::NotifyClientClosing() { | 63 void RenderViewDevToolsAgentHost::NotifyClientClosing() { |
| 64 content::NotificationService::current()->Notify( | 64 content::NotificationService::current()->Notify( |
| 65 content::NOTIFICATION_DEVTOOLS_WINDOW_CLOSING, | 65 content::NOTIFICATION_DEVTOOLS_WINDOW_CLOSING, |
| 66 content::Source<content::BrowserContext>( | 66 content::Source<content::BrowserContext>( |
| 67 render_view_host_->site_instance()->GetProcess()->browser_context()), | 67 render_view_host_->site_instance()->GetProcess()-> |
| 68 GetBrowserContext()), |
| 68 content::Details<RenderViewHost>(render_view_host_)); | 69 content::Details<RenderViewHost>(render_view_host_)); |
| 69 } | 70 } |
| 70 | 71 |
| 71 int RenderViewDevToolsAgentHost::GetRenderProcessId() { | 72 int RenderViewDevToolsAgentHost::GetRenderProcessId() { |
| 72 return render_view_host_->process()->id(); | 73 return render_view_host_->process()->GetID(); |
| 73 } | 74 } |
| 74 | 75 |
| 75 RenderViewDevToolsAgentHost::~RenderViewDevToolsAgentHost() { | 76 RenderViewDevToolsAgentHost::~RenderViewDevToolsAgentHost() { |
| 76 g_instances.Get().erase(render_view_host_); | 77 g_instances.Get().erase(render_view_host_); |
| 77 } | 78 } |
| 78 | 79 |
| 79 void RenderViewDevToolsAgentHost::RenderViewHostDestroyed(RenderViewHost* rvh) { | 80 void RenderViewDevToolsAgentHost::RenderViewHostDestroyed(RenderViewHost* rvh) { |
| 80 NotifyCloseListener(); | 81 NotifyCloseListener(); |
| 81 delete this; | 82 delete this; |
| 82 } | 83 } |
| (...skipping 25 matching lines...) Expand all Loading... |
| 108 } | 109 } |
| 109 | 110 |
| 110 void RenderViewDevToolsAgentHost::OnClearBrowserCache() { | 111 void RenderViewDevToolsAgentHost::OnClearBrowserCache() { |
| 111 content::GetContentClient()->browser()->ClearCache(render_view_host_); | 112 content::GetContentClient()->browser()->ClearCache(render_view_host_); |
| 112 } | 113 } |
| 113 | 114 |
| 114 void RenderViewDevToolsAgentHost::OnClearBrowserCookies() { | 115 void RenderViewDevToolsAgentHost::OnClearBrowserCookies() { |
| 115 content::GetContentClient()->browser()->ClearCookies(render_view_host_); | 116 content::GetContentClient()->browser()->ClearCookies(render_view_host_); |
| 116 } | 117 } |
| 117 | 118 |
| OLD | NEW |