| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "android_webview/browser/aw_dev_tools_discovery_provider.h" | 5 #include "android_webview/browser/aw_dev_tools_discovery_provider.h" |
| 6 | 6 |
| 7 #include "android_webview/browser/browser_view_renderer.h" | 7 #include "android_webview/browser/browser_view_renderer.h" |
| 8 #include "base/json/json_writer.h" | 8 #include "base/json/json_writer.h" |
| 9 #include "base/memory/ptr_util.h" |
| 9 #include "base/strings/stringprintf.h" | 10 #include "base/strings/stringprintf.h" |
| 10 #include "base/strings/utf_string_conversions.h" | 11 #include "base/strings/utf_string_conversions.h" |
| 11 #include "base/values.h" | 12 #include "base/values.h" |
| 12 #include "components/devtools_discovery/basic_target_descriptor.h" | 13 #include "components/devtools_discovery/basic_target_descriptor.h" |
| 13 #include "components/devtools_discovery/devtools_discovery_manager.h" | 14 #include "components/devtools_discovery/devtools_discovery_manager.h" |
| 14 #include "content/public/browser/devtools_agent_host.h" | 15 #include "content/public/browser/devtools_agent_host.h" |
| 15 #include "content/public/browser/web_contents.h" | 16 #include "content/public/browser/web_contents.h" |
| 16 | 17 |
| 17 using content::DevToolsAgentHost; | 18 using content::DevToolsAgentHost; |
| 18 using content::WebContents; | 19 using content::WebContents; |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 60 | 61 |
| 61 } // namespace | 62 } // namespace |
| 62 | 63 |
| 63 namespace android_webview { | 64 namespace android_webview { |
| 64 | 65 |
| 65 // static | 66 // static |
| 66 void AwDevToolsDiscoveryProvider::Install() { | 67 void AwDevToolsDiscoveryProvider::Install() { |
| 67 devtools_discovery::DevToolsDiscoveryManager* discovery_manager = | 68 devtools_discovery::DevToolsDiscoveryManager* discovery_manager = |
| 68 devtools_discovery::DevToolsDiscoveryManager::GetInstance(); | 69 devtools_discovery::DevToolsDiscoveryManager::GetInstance(); |
| 69 discovery_manager->AddProvider( | 70 discovery_manager->AddProvider( |
| 70 make_scoped_ptr(new AwDevToolsDiscoveryProvider())); | 71 base::WrapUnique(new AwDevToolsDiscoveryProvider())); |
| 71 } | 72 } |
| 72 | 73 |
| 73 AwDevToolsDiscoveryProvider::AwDevToolsDiscoveryProvider() { | 74 AwDevToolsDiscoveryProvider::AwDevToolsDiscoveryProvider() { |
| 74 } | 75 } |
| 75 | 76 |
| 76 AwDevToolsDiscoveryProvider::~AwDevToolsDiscoveryProvider() { | 77 AwDevToolsDiscoveryProvider::~AwDevToolsDiscoveryProvider() { |
| 77 } | 78 } |
| 78 | 79 |
| 79 devtools_discovery::DevToolsTargetDescriptor::List | 80 devtools_discovery::DevToolsTargetDescriptor::List |
| 80 AwDevToolsDiscoveryProvider::GetDescriptors() { | 81 AwDevToolsDiscoveryProvider::GetDescriptors() { |
| 81 DevToolsAgentHost::List agent_hosts = DevToolsAgentHost::GetOrCreateAll(); | 82 DevToolsAgentHost::List agent_hosts = DevToolsAgentHost::GetOrCreateAll(); |
| 82 devtools_discovery::DevToolsTargetDescriptor::List result; | 83 devtools_discovery::DevToolsTargetDescriptor::List result; |
| 83 result.reserve(agent_hosts.size()); | 84 result.reserve(agent_hosts.size()); |
| 84 for (const auto& agent_host : agent_hosts) | 85 for (const auto& agent_host : agent_hosts) |
| 85 result.push_back(new TargetDescriptor(agent_host)); | 86 result.push_back(new TargetDescriptor(agent_host)); |
| 86 return result; | 87 return result; |
| 87 } | 88 } |
| 88 | 89 |
| 89 } // namespace android_webview | 90 } // namespace android_webview |
| OLD | NEW |