Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(12)

Side by Side Diff: android_webview/browser/aw_dev_tools_discovery_provider.cc

Issue 1099243004: [DevTools] Migrate android to devtools_discovery. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « android_webview/browser/aw_dev_tools_discovery_provider.h ('k') | chrome/browser/BUILD.gn » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/strings/stringprintf.h" 9 #include "base/strings/stringprintf.h"
10 #include "base/strings/utf_string_conversions.h" 10 #include "base/strings/utf_string_conversions.h"
(...skipping 30 matching lines...) Expand all
41 41
42 class TargetDescriptor : public devtools_discovery::BasicTargetDescriptor { 42 class TargetDescriptor : public devtools_discovery::BasicTargetDescriptor {
43 public: 43 public:
44 explicit TargetDescriptor(scoped_refptr<DevToolsAgentHost> agent_host); 44 explicit TargetDescriptor(scoped_refptr<DevToolsAgentHost> agent_host);
45 45
46 // devtools_discovery::BasicTargetDescriptor overrides. 46 // devtools_discovery::BasicTargetDescriptor overrides.
47 std::string GetDescription() const override { return description_; } 47 std::string GetDescription() const override { return description_; }
48 48
49 private: 49 private:
50 std::string description_; 50 std::string description_;
51
52 DISALLOW_COPY_AND_ASSIGN(TargetDescriptor);
51 }; 53 };
52 54
53 TargetDescriptor::TargetDescriptor(scoped_refptr<DevToolsAgentHost> agent_host) 55 TargetDescriptor::TargetDescriptor(scoped_refptr<DevToolsAgentHost> agent_host)
54 : BasicTargetDescriptor(agent_host) { 56 : BasicTargetDescriptor(agent_host) {
55 if (WebContents* web_contents = agent_host->GetWebContents()) 57 if (WebContents* web_contents = agent_host->GetWebContents())
56 description_ = GetViewDescription(web_contents); 58 description_ = GetViewDescription(web_contents);
57 } 59 }
58 60
59 } // namespace 61 } // namespace
60 62
61 namespace android_webview { 63 namespace android_webview {
62 64
65 // static
66 void AwDevToolsDiscoveryProvider::Install() {
67 devtools_discovery::DevToolsDiscoveryManager* discovery_manager =
68 devtools_discovery::DevToolsDiscoveryManager::GetInstance();
69 discovery_manager->AddProvider(
70 make_scoped_ptr(new AwDevToolsDiscoveryProvider()));
71 }
72
63 AwDevToolsDiscoveryProvider::AwDevToolsDiscoveryProvider() { 73 AwDevToolsDiscoveryProvider::AwDevToolsDiscoveryProvider() {
64 } 74 }
65 75
66 AwDevToolsDiscoveryProvider::~AwDevToolsDiscoveryProvider() { 76 AwDevToolsDiscoveryProvider::~AwDevToolsDiscoveryProvider() {
67 } 77 }
68 78
69 devtools_discovery::DevToolsTargetDescriptor::List 79 devtools_discovery::DevToolsTargetDescriptor::List
70 AwDevToolsDiscoveryProvider::GetDescriptors() { 80 AwDevToolsDiscoveryProvider::GetDescriptors() {
71 DevToolsAgentHost::List agent_hosts = DevToolsAgentHost::GetOrCreateAll(); 81 DevToolsAgentHost::List agent_hosts = DevToolsAgentHost::GetOrCreateAll();
72 devtools_discovery::DevToolsTargetDescriptor::List result; 82 devtools_discovery::DevToolsTargetDescriptor::List result;
73 result.reserve(agent_hosts.size()); 83 result.reserve(agent_hosts.size());
74 for (const auto& agent_host : agent_hosts) 84 for (const auto& agent_host : agent_hosts)
75 result.push_back(new TargetDescriptor(agent_host)); 85 result.push_back(new TargetDescriptor(agent_host));
76 return result; 86 return result;
77 } 87 }
78 88
79 } // namespace android_webview 89 } // namespace android_webview
OLDNEW
« no previous file with comments | « android_webview/browser/aw_dev_tools_discovery_provider.h ('k') | chrome/browser/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698