OLD | NEW |
1 // Copyright (c) 2011 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" |
11 #include "content/browser/renderer_host/render_process_host_impl.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_impl.h" | 13 #include "content/browser/site_instance_impl.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/devtools_agent_host_registry.h" | 17 #include "content/public/browser/devtools_agent_host_registry.h" |
18 #include "content/public/browser/notification_service.h" | 18 #include "content/public/browser/notification_service.h" |
19 #include "content/public/browser/notification_types.h" | 19 #include "content/public/browser/notification_types.h" |
20 | 20 |
21 namespace content { | 21 namespace content { |
22 | 22 |
23 typedef std::map<RenderViewHost*, RenderViewDevToolsAgentHost*> Instances; | 23 typedef std::map<RenderViewHost*, RenderViewDevToolsAgentHost*> Instances; |
24 | 24 |
25 namespace { | 25 namespace { |
26 base::LazyInstance<Instances, | 26 base::LazyInstance<Instances>::Leaky g_instances = LAZY_INSTANCE_INITIALIZER; |
27 base::LeakyLazyInstanceTraits<Instances> > | |
28 g_instances = LAZY_INSTANCE_INITIALIZER; | |
29 } // namespace | 27 } // namespace |
30 | 28 |
31 // static | 29 // static |
32 DevToolsAgentHost* DevToolsAgentHostRegistry::GetDevToolsAgentHost( | 30 DevToolsAgentHost* DevToolsAgentHostRegistry::GetDevToolsAgentHost( |
33 RenderViewHost* rvh) { | 31 RenderViewHost* rvh) { |
34 Instances::iterator it = g_instances.Get().find(rvh); | 32 Instances::iterator it = g_instances.Get().find(rvh); |
35 if (it != g_instances.Get().end()) | 33 if (it != g_instances.Get().end()) |
36 return it->second; | 34 return it->second; |
37 return new RenderViewDevToolsAgentHost(rvh); | 35 return new RenderViewDevToolsAgentHost(rvh); |
38 } | 36 } |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
135 | 133 |
136 void RenderViewDevToolsAgentHost::OnClearBrowserCache() { | 134 void RenderViewDevToolsAgentHost::OnClearBrowserCache() { |
137 content::GetContentClient()->browser()->ClearCache(render_view_host_); | 135 content::GetContentClient()->browser()->ClearCache(render_view_host_); |
138 } | 136 } |
139 | 137 |
140 void RenderViewDevToolsAgentHost::OnClearBrowserCookies() { | 138 void RenderViewDevToolsAgentHost::OnClearBrowserCookies() { |
141 content::GetContentClient()->browser()->ClearCookies(render_view_host_); | 139 content::GetContentClient()->browser()->ClearCookies(render_view_host_); |
142 } | 140 } |
143 | 141 |
144 } // namespace content | 142 } // namespace content |
145 | |
OLD | NEW |