| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "chrome/browser/devtools/chrome_devtools_manager_delegate.h" | 5 #include "chrome/browser/devtools/chrome_devtools_manager_delegate.h" |
| 6 | 6 |
| 7 #include "base/strings/utf_string_conversions.h" | 7 #include "base/strings/utf_string_conversions.h" |
| 8 #include "build/build_config.h" | 8 #include "build/build_config.h" |
| 9 #include "chrome/browser/devtools/devtools_network_protocol_handler.h" | 9 #include "chrome/browser/devtools/devtools_network_protocol_handler.h" |
| 10 #include "chrome/browser/devtools/devtools_window.h" | 10 #include "chrome/browser/devtools/devtools_window.h" |
| (...skipping 18 matching lines...) Expand all Loading... |
| 29 char ChromeDevToolsManagerDelegate::kTypeWebView[] = "webview"; | 29 char ChromeDevToolsManagerDelegate::kTypeWebView[] = "webview"; |
| 30 | 30 |
| 31 ChromeDevToolsManagerDelegate::ChromeDevToolsManagerDelegate() | 31 ChromeDevToolsManagerDelegate::ChromeDevToolsManagerDelegate() |
| 32 : network_protocol_handler_(new DevToolsNetworkProtocolHandler()) { | 32 : network_protocol_handler_(new DevToolsNetworkProtocolHandler()) { |
| 33 } | 33 } |
| 34 | 34 |
| 35 ChromeDevToolsManagerDelegate::~ChromeDevToolsManagerDelegate() { | 35 ChromeDevToolsManagerDelegate::~ChromeDevToolsManagerDelegate() { |
| 36 } | 36 } |
| 37 | 37 |
| 38 void ChromeDevToolsManagerDelegate::Inspect( | 38 void ChromeDevToolsManagerDelegate::Inspect( |
| 39 content::DevToolsAgentHost* agent_host) { | 39 content::DevToolsAgentHost* agent_host, |
| 40 content::BrowserContext* context) { |
| 41 content::BrowserContext* default_context = agent_host->GetBrowserContext(); |
| 40 Profile* profile = | 42 Profile* profile = |
| 41 Profile::FromBrowserContext(agent_host->GetBrowserContext()); | 43 Profile::FromBrowserContext(default_context ? default_context : context); |
| 42 if (!profile) | 44 if (!profile) |
| 43 return; | 45 return; |
| 44 std::string type = agent_host->GetType(); | 46 std::string type = agent_host->GetType(); |
| 45 if (type == content::DevToolsAgentHost::kTypeSharedWorker || | 47 if (type == content::DevToolsAgentHost::kTypeSharedWorker || |
| 46 type == content::DevToolsAgentHost::kTypeServiceWorker) { | 48 type == content::DevToolsAgentHost::kTypeServiceWorker) { |
| 47 DevToolsWindow::OpenDevToolsWindowForWorker(profile, agent_host); | 49 DevToolsWindow::OpenDevToolsWindowForWorker(profile, agent_host); |
| 48 return; | 50 return; |
| 49 } | 51 } |
| 50 if (type == content::DevToolsAgentHost::kTypeFrame) { | 52 if (type == content::DevToolsAgentHost::kTypeFrame) { |
| 51 DevToolsWindow::OpenDevToolsWindow(profile, agent_host); | 53 DevToolsWindow::OpenDevToolsWindow(profile, agent_host); |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 144 std::string ChromeDevToolsManagerDelegate::GetFrontendResource( | 146 std::string ChromeDevToolsManagerDelegate::GetFrontendResource( |
| 145 const std::string& path) { | 147 const std::string& path) { |
| 146 return content::DevToolsFrontendHost::GetFrontendResource(path).as_string(); | 148 return content::DevToolsFrontendHost::GetFrontendResource(path).as_string(); |
| 147 } | 149 } |
| 148 | 150 |
| 149 void ChromeDevToolsManagerDelegate::DevToolsAgentStateChanged( | 151 void ChromeDevToolsManagerDelegate::DevToolsAgentStateChanged( |
| 150 content::DevToolsAgentHost* agent_host, | 152 content::DevToolsAgentHost* agent_host, |
| 151 bool attached) { | 153 bool attached) { |
| 152 network_protocol_handler_->DevToolsAgentStateChanged(agent_host, attached); | 154 network_protocol_handler_->DevToolsAgentStateChanged(agent_host, attached); |
| 153 } | 155 } |
| OLD | NEW |