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/devtools_agent_host_impl.h" | 5 #include "content/browser/devtools/devtools_agent_host_impl.h" |
6 | 6 |
7 #include <map> | 7 #include <map> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
11 #include "base/guid.h" | 11 #include "base/guid.h" |
12 #include "base/lazy_instance.h" | 12 #include "base/lazy_instance.h" |
13 #include "content/browser/devtools/devtools_manager.h" | 13 #include "content/browser/devtools/devtools_manager.h" |
14 #include "content/browser/devtools/embedded_worker_devtools_manager.h" | |
15 #include "content/browser/devtools/forwarding_agent_host.h" | 14 #include "content/browser/devtools/forwarding_agent_host.h" |
| 15 #include "content/browser/devtools/service_worker_devtools_manager.h" |
| 16 #include "content/browser/devtools/shared_worker_devtools_manager.h" |
16 #include "content/public/browser/browser_thread.h" | 17 #include "content/public/browser/browser_thread.h" |
17 #include "content/public/browser/devtools_manager_delegate.h" | 18 #include "content/public/browser/devtools_manager_delegate.h" |
18 | 19 |
19 namespace content { | 20 namespace content { |
20 | 21 |
21 namespace { | 22 namespace { |
22 typedef std::map<std::string, DevToolsAgentHostImpl*> Instances; | 23 typedef std::map<std::string, DevToolsAgentHostImpl*> Instances; |
23 base::LazyInstance<Instances>::Leaky g_instances = LAZY_INSTANCE_INITIALIZER; | 24 base::LazyInstance<Instances>::Leaky g_instances = LAZY_INSTANCE_INITIALIZER; |
24 | 25 |
25 typedef std::vector<const DevToolsAgentHost::AgentStateCallback*> | 26 typedef std::vector<const DevToolsAgentHost::AgentStateCallback*> |
26 AgentStateCallbacks; | 27 AgentStateCallbacks; |
27 base::LazyInstance<AgentStateCallbacks>::Leaky g_callbacks = | 28 base::LazyInstance<AgentStateCallbacks>::Leaky g_callbacks = |
28 LAZY_INSTANCE_INITIALIZER; | 29 LAZY_INSTANCE_INITIALIZER; |
29 } // namespace | 30 } // namespace |
30 | 31 |
31 // static | 32 // static |
32 DevToolsAgentHost::List DevToolsAgentHost::GetOrCreateAll() { | 33 DevToolsAgentHost::List DevToolsAgentHost::GetOrCreateAll() { |
33 List result = EmbeddedWorkerDevToolsManager::GetInstance() | 34 List result; |
34 ->GetOrCreateAllAgentHosts(); | 35 SharedWorkerDevToolsManager::GetInstance()->AddAllAgentHosts(&result); |
| 36 ServiceWorkerDevToolsManager::GetInstance()->AddAllAgentHosts(&result); |
35 std::vector<WebContents*> wc_list = | 37 std::vector<WebContents*> wc_list = |
36 DevToolsAgentHostImpl::GetInspectableWebContents(); | 38 DevToolsAgentHostImpl::GetInspectableWebContents(); |
37 for (std::vector<WebContents*>::iterator it = wc_list.begin(); | 39 for (std::vector<WebContents*>::iterator it = wc_list.begin(); |
38 it != wc_list.end(); ++it) { | 40 it != wc_list.end(); ++it) { |
39 result.push_back(GetOrCreateFor(*it)); | 41 result.push_back(GetOrCreateFor(*it)); |
40 } | 42 } |
41 return result; | 43 return result; |
42 } | 44 } |
43 | 45 |
44 DevToolsAgentHostImpl::DevToolsAgentHostImpl() | 46 DevToolsAgentHostImpl::DevToolsAgentHostImpl() |
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
190 (*it)->Run(agent_host, attached); | 192 (*it)->Run(agent_host, attached); |
191 } | 193 } |
192 | 194 |
193 void DevToolsAgentHostImpl::Inspect(BrowserContext* browser_context) { | 195 void DevToolsAgentHostImpl::Inspect(BrowserContext* browser_context) { |
194 DevToolsManager* manager = DevToolsManager::GetInstance(); | 196 DevToolsManager* manager = DevToolsManager::GetInstance(); |
195 if (manager->delegate()) | 197 if (manager->delegate()) |
196 manager->delegate()->Inspect(browser_context, this); | 198 manager->delegate()->Inspect(browser_context, this); |
197 } | 199 } |
198 | 200 |
199 } // namespace content | 201 } // namespace content |
OLD | NEW |