| 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/memory/ptr_util.h" |
| 10 #include "base/strings/stringprintf.h" | 10 #include "base/strings/stringprintf.h" |
| 11 #include "base/strings/utf_string_conversions.h" | 11 #include "base/strings/utf_string_conversions.h" |
| 12 #include "base/values.h" | 12 #include "base/values.h" |
| 13 #include "components/devtools_discovery/basic_target_descriptor.h" | |
| 14 #include "components/devtools_discovery/devtools_discovery_manager.h" | 13 #include "components/devtools_discovery/devtools_discovery_manager.h" |
| 15 #include "content/public/browser/devtools_agent_host.h" | 14 #include "content/public/browser/devtools_agent_host.h" |
| 16 #include "content/public/browser/web_contents.h" | 15 #include "content/public/browser/web_contents.h" |
| 17 | 16 |
| 18 using content::DevToolsAgentHost; | 17 using content::DevToolsAgentHost; |
| 19 using content::WebContents; | 18 using content::WebContents; |
| 20 | 19 |
| 21 namespace { | 20 namespace { |
| 22 | 21 |
| 23 std::string GetViewDescription(WebContents* web_contents) { | 22 std::string GetViewDescription(WebContents* web_contents) { |
| (...skipping 27 matching lines...) Expand all Loading... |
| 51 discovery_manager->AddProvider( | 50 discovery_manager->AddProvider( |
| 52 base::WrapUnique(new AwDevToolsDiscoveryProvider())); | 51 base::WrapUnique(new AwDevToolsDiscoveryProvider())); |
| 53 } | 52 } |
| 54 | 53 |
| 55 AwDevToolsDiscoveryProvider::AwDevToolsDiscoveryProvider() { | 54 AwDevToolsDiscoveryProvider::AwDevToolsDiscoveryProvider() { |
| 56 } | 55 } |
| 57 | 56 |
| 58 AwDevToolsDiscoveryProvider::~AwDevToolsDiscoveryProvider() { | 57 AwDevToolsDiscoveryProvider::~AwDevToolsDiscoveryProvider() { |
| 59 } | 58 } |
| 60 | 59 |
| 61 devtools_discovery::DevToolsTargetDescriptor::List | 60 content::DevToolsAgentHost::List |
| 62 AwDevToolsDiscoveryProvider::GetDescriptors() { | 61 AwDevToolsDiscoveryProvider::GetDescriptors() { |
| 63 DevToolsAgentHost::List agent_hosts = DevToolsAgentHost::GetOrCreateAll(); | 62 DevToolsAgentHost::List agent_hosts = DevToolsAgentHost::GetOrCreateAll(); |
| 64 devtools_discovery::DevToolsTargetDescriptor::List result; | |
| 65 result.reserve(agent_hosts.size()); | |
| 66 for (auto& agent_host : agent_hosts) { | 63 for (auto& agent_host : agent_hosts) { |
| 67 agent_host->SetDescriptionOverride( | 64 agent_host->SetDescriptionOverride( |
| 68 GetViewDescription(agent_host->GetWebContents())); | 65 GetViewDescription(agent_host->GetWebContents())); |
| 69 result.push_back(new devtools_discovery::BasicTargetDescriptor(agent_host)); | |
| 70 } | 66 } |
| 71 return result; | 67 return agent_hosts; |
| 72 } | 68 } |
| 73 | 69 |
| 74 } // namespace android_webview | 70 } // namespace android_webview |
| OLD | NEW |