Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(11)

Side by Side Diff: content/browser/debugger/render_view_devtools_agent_host.cc

Issue 8549022: Define DevTools content API (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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_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.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/devtools/devtools_agent_host_registry.h"
16 #include "content/public/browser/content_browser_client.h" 17 #include "content/public/browser/content_browser_client.h"
17 #include "content/public/browser/notification_service.h" 18 #include "content/public/browser/notification_service.h"
18 #include "content/public/browser/notification_types.h" 19 #include "content/public/browser/notification_types.h"
19 20
20 typedef std::map<RenderViewHost*, RenderViewDevToolsAgentHost*> Instances; 21 typedef std::map<RenderViewHost*, RenderViewDevToolsAgentHost*> Instances;
21 22
22 namespace { 23 namespace {
23 base::LazyInstance<Instances, 24 base::LazyInstance<Instances,
24 base::LeakyLazyInstanceTraits<Instances> > 25 base::LeakyLazyInstanceTraits<Instances> >
25 g_instances = LAZY_INSTANCE_INITIALIZER; 26 g_instances = LAZY_INSTANCE_INITIALIZER;
26 } // namespace 27 } // namespace
27 28
29
30 namespace content {
31
32 // static
33 DevToolsAgentHost* DevToolsAgentHostRegistry::GetDevToolsAgentHost(
34 RenderViewHost* rvh) {
35 return RenderViewDevToolsAgentHost::FindFor(rvh);
36 }
37
38 // static
39 DevToolsAgentHost* DevToolsAgentHostRegistry::FindDevToolsAgentHost(
40 RenderViewHost* rvh) {
41 return GetDevToolsAgentHost(rvh);
42 }
43
44 } // namespace
45
28 DevToolsAgentHost* RenderViewDevToolsAgentHost::FindFor( 46 DevToolsAgentHost* RenderViewDevToolsAgentHost::FindFor(
29 RenderViewHost* rvh) { 47 RenderViewHost* rvh) {
30 Instances::iterator it = g_instances.Get().find(rvh); 48 Instances::iterator it = g_instances.Get().find(rvh);
31 if (it != g_instances.Get().end()) 49 if (it != g_instances.Get().end())
32 return it->second; 50 return it->second;
33 return new RenderViewDevToolsAgentHost(rvh); 51 return new RenderViewDevToolsAgentHost(rvh);
34 } 52 }
35 53
36 bool RenderViewDevToolsAgentHost::IsDebuggerAttached( 54 bool RenderViewDevToolsAgentHost::IsDebuggerAttached(
37 TabContents* tab_contents) { 55 TabContents* tab_contents) {
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 } 127 }
110 128
111 void RenderViewDevToolsAgentHost::OnClearBrowserCache() { 129 void RenderViewDevToolsAgentHost::OnClearBrowserCache() {
112 content::GetContentClient()->browser()->ClearCache(render_view_host_); 130 content::GetContentClient()->browser()->ClearCache(render_view_host_);
113 } 131 }
114 132
115 void RenderViewDevToolsAgentHost::OnClearBrowserCookies() { 133 void RenderViewDevToolsAgentHost::OnClearBrowserCookies() {
116 content::GetContentClient()->browser()->ClearCookies(render_view_host_); 134 content::GetContentClient()->browser()->ClearCookies(render_view_host_);
117 } 135 }
118 136
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698