| 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_manager_impl.h" | 5 #include "content/browser/devtools/devtools_manager_impl.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
| 11 #include "content/browser/devtools/devtools_netlog_observer.h" | 11 #include "content/browser/devtools/devtools_netlog_observer.h" |
| 12 #include "content/browser/devtools/render_view_devtools_agent_host.h" | 12 #include "content/browser/devtools/render_view_devtools_agent_host.h" |
| 13 #include "content/browser/renderer_host/render_view_host_impl.h" | 13 #include "content/browser/renderer_host/render_view_host_impl.h" |
| 14 #include "content/browser/web_contents/web_contents_impl.h" | 14 #include "content/browser/web_contents/web_contents_impl.h" |
| 15 #include "content/public/browser/browser_thread.h" | 15 #include "content/public/browser/browser_thread.h" |
| 16 #include "content/public/browser/content_browser_client.h" |
| 16 #include "content/public/browser/devtools_client_host.h" | 17 #include "content/public/browser/devtools_client_host.h" |
| 18 #include "content/public/browser/devtools_manager_delegate.h" |
| 17 | 19 |
| 18 namespace content { | 20 namespace content { |
| 19 | 21 |
| 20 // static | 22 // static |
| 21 DevToolsManager* DevToolsManager::GetInstance() { | 23 DevToolsManager* DevToolsManager::GetInstance() { |
| 22 return DevToolsManagerImpl::GetInstance(); | 24 return DevToolsManagerImpl::GetInstance(); |
| 23 } | 25 } |
| 24 | 26 |
| 25 // static | 27 // static |
| 26 DevToolsManagerImpl* DevToolsManagerImpl::GetInstance() { | 28 DevToolsManagerImpl* DevToolsManagerImpl::GetInstance() { |
| 27 return Singleton<DevToolsManagerImpl>::get(); | 29 return Singleton<DevToolsManagerImpl>::get(); |
| 28 } | 30 } |
| 29 | 31 |
| 30 DevToolsManagerImpl::DevToolsManagerImpl() { | 32 DevToolsManagerImpl::DevToolsManagerImpl() |
| 33 : delegate_(GetContentClient()->browser()->GetDevToolsManagerDelegate()) { |
| 31 } | 34 } |
| 32 | 35 |
| 33 DevToolsManagerImpl::~DevToolsManagerImpl() { | 36 DevToolsManagerImpl::~DevToolsManagerImpl() { |
| 34 DCHECK(agent_to_client_host_.empty()); | 37 DCHECK(agent_to_client_host_.empty()); |
| 35 DCHECK(client_to_agent_host_.empty()); | 38 DCHECK(client_to_agent_host_.empty()); |
| 36 } | 39 } |
| 37 | 40 |
| 41 void DevToolsManagerImpl::Inspect(BrowserContext* browser_context, |
| 42 DevToolsAgentHost* agent_host) { |
| 43 if (delegate_) |
| 44 delegate_->Inspect(browser_context, agent_host); |
| 45 } |
| 46 |
| 38 DevToolsClientHost* DevToolsManagerImpl::GetDevToolsClientHostFor( | 47 DevToolsClientHost* DevToolsManagerImpl::GetDevToolsClientHostFor( |
| 39 DevToolsAgentHostImpl* agent_host_impl) { | 48 DevToolsAgentHostImpl* agent_host_impl) { |
| 40 AgentToClientHostMap::iterator it = | 49 AgentToClientHostMap::iterator it = |
| 41 agent_to_client_host_.find(agent_host_impl); | 50 agent_to_client_host_.find(agent_host_impl); |
| 42 if (it != agent_to_client_host_.end()) | 51 if (it != agent_to_client_host_.end()) |
| 43 return it->second; | 52 return it->second; |
| 44 return NULL; | 53 return NULL; |
| 45 } | 54 } |
| 46 | 55 |
| 47 DevToolsAgentHost* DevToolsManagerImpl::GetDevToolsAgentHostFor( | 56 DevToolsAgentHost* DevToolsManagerImpl::GetDevToolsAgentHostFor( |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 182 } | 191 } |
| 183 | 192 |
| 184 void DevToolsManagerImpl::NotifyObservers(DevToolsAgentHost* agent_host, | 193 void DevToolsManagerImpl::NotifyObservers(DevToolsAgentHost* agent_host, |
| 185 bool attached) { | 194 bool attached) { |
| 186 CallbackContainer copy(callbacks_); | 195 CallbackContainer copy(callbacks_); |
| 187 for (CallbackContainer::iterator it = copy.begin(); it != copy.end(); ++it) | 196 for (CallbackContainer::iterator it = copy.begin(); it != copy.end(); ++it) |
| 188 (*it)->Run(agent_host, attached); | 197 (*it)->Run(agent_host, attached); |
| 189 } | 198 } |
| 190 | 199 |
| 191 } // namespace content | 200 } // namespace content |
| OLD | NEW |