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

Side by Side Diff: components/devtools_discovery/devtools_discovery_manager.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, 7 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
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 "components/devtools_discovery/devtools_discovery_manager.h" 5 #include "components/devtools_discovery/devtools_discovery_manager.h"
6 6
7 #include "base/stl_util.h" 7 #include "base/stl_util.h"
8 #include "components/devtools_discovery/basic_target_descriptor.h" 8 #include "components/devtools_discovery/basic_target_descriptor.h"
9 #include "content/public/browser/devtools_agent_host.h" 9 #include "content/public/browser/devtools_agent_host.h"
10 10
(...skipping 22 matching lines...) Expand all
33 return GetDescriptorsFromProviders(); 33 return GetDescriptorsFromProviders();
34 34
35 DevToolsAgentHost::List agent_hosts = DevToolsAgentHost::GetOrCreateAll(); 35 DevToolsAgentHost::List agent_hosts = DevToolsAgentHost::GetOrCreateAll();
36 DevToolsTargetDescriptor::List result; 36 DevToolsTargetDescriptor::List result;
37 result.reserve(agent_hosts.size()); 37 result.reserve(agent_hosts.size());
38 for (const auto& agent_host : agent_hosts) 38 for (const auto& agent_host : agent_hosts)
39 result.push_back(new BasicTargetDescriptor(agent_host)); 39 result.push_back(new BasicTargetDescriptor(agent_host));
40 return result; 40 return result;
41 } 41 }
42 42
43 void DevToolsDiscoveryManager::SetCreateCallback(
44 const CreateCallback& callback) {
45 create_callback_ = callback;
46 }
47
48 scoped_ptr<DevToolsTargetDescriptor>
49 DevToolsDiscoveryManager::CreateNew(const GURL& url) {
50 if (create_callback_.is_null())
51 return scoped_ptr<DevToolsTargetDescriptor>();
52 return create_callback_.Run(url);
53 }
54
43 DevToolsTargetDescriptor::List 55 DevToolsTargetDescriptor::List
44 DevToolsDiscoveryManager::GetDescriptorsFromProviders() { 56 DevToolsDiscoveryManager::GetDescriptorsFromProviders() {
45 DevToolsTargetDescriptor::List result; 57 DevToolsTargetDescriptor::List result;
46 for (const auto& provider : providers_) { 58 for (const auto& provider : providers_) {
47 DevToolsTargetDescriptor::List partial = provider->GetDescriptors(); 59 DevToolsTargetDescriptor::List partial = provider->GetDescriptors();
48 result.insert(result.begin(), partial.begin(), partial.end()); 60 result.insert(result.begin(), partial.begin(), partial.end());
49 } 61 }
50 return result; 62 return result;
51 } 63 }
52 64
53 } // namespace devtools_discovery 65 } // namespace devtools_discovery
OLDNEW
« no previous file with comments | « components/devtools_discovery/devtools_discovery_manager.h ('k') | content/shell/browser/shell_devtools_manager_delegate.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698