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

Side by Side Diff: components/devtools_discovery/devtools_discovery_manager.h

Issue 1114503002: [DevTools] Cleanup DevToolsTarget and DevToolsManagerDelegate after moving to devtools_discovery. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@devtools-discovery-chrome
Patch Set: 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 #ifndef COMPONENTS_DEVTOOLS_DISCOVERY_DEVTOOLS_DISCOVERY_MANAGER_H_ 5 #ifndef COMPONENTS_DEVTOOLS_DISCOVERY_DEVTOOLS_DISCOVERY_MANAGER_H_
6 #define COMPONENTS_DEVTOOLS_DISCOVERY_DEVTOOLS_DISCOVERY_MANAGER_H_ 6 #define COMPONENTS_DEVTOOLS_DISCOVERY_DEVTOOLS_DISCOVERY_MANAGER_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
11 #include "base/memory/singleton.h" 11 #include "base/memory/singleton.h"
12 #include "components/devtools_discovery/devtools_target_descriptor.h" 12 #include "components/devtools_discovery/devtools_target_descriptor.h"
13 13
14 namespace devtools_discovery { 14 namespace devtools_discovery {
15 15
16 class DevToolsDiscoveryManager { 16 class DevToolsDiscoveryManager {
17 public: 17 public:
18 class Provider { 18 class Provider {
19 public: 19 public:
20 virtual ~Provider() {} 20 virtual ~Provider() {}
21
22 // Caller takes ownership of created descriptors.
21 virtual DevToolsTargetDescriptor::List GetDescriptors() = 0; 23 virtual DevToolsTargetDescriptor::List GetDescriptors() = 0;
22 }; 24 };
23 25
24 using CreateCallback = base::Callback< 26 using CreateCallback = base::Callback<
25 scoped_ptr<DevToolsTargetDescriptor>(const GURL& url)>; 27 scoped_ptr<DevToolsTargetDescriptor>(const GURL& url)>;
26 28
27 // Returns single instance of this class. The instance is destroyed on the 29 // Returns single instance of this class. The instance is destroyed on the
28 // browser main loop exit so this method MUST NOT be called after that point. 30 // browser main loop exit so this method MUST NOT be called after that point.
29 static DevToolsDiscoveryManager* GetInstance(); 31 static DevToolsDiscoveryManager* GetInstance();
30 32
31 void AddProvider(scoped_ptr<Provider> provider); 33 void AddProvider(scoped_ptr<Provider> provider);
32 void SetCreateCallback(const CreateCallback& callback); 34 void SetCreateCallback(const CreateCallback& callback);
33 35
36 // Caller takes ownership of created descriptors.
34 DevToolsTargetDescriptor::List GetDescriptors(); 37 DevToolsTargetDescriptor::List GetDescriptors();
35 scoped_ptr<DevToolsTargetDescriptor> CreateNew(const GURL& url); 38 scoped_ptr<DevToolsTargetDescriptor> CreateNew(const GURL& url);
36 39
37 private: 40 private:
38 friend struct DefaultSingletonTraits<DevToolsDiscoveryManager>; 41 friend struct DefaultSingletonTraits<DevToolsDiscoveryManager>;
39 42
40 DevToolsDiscoveryManager(); 43 DevToolsDiscoveryManager();
41 ~DevToolsDiscoveryManager(); 44 ~DevToolsDiscoveryManager();
42 DevToolsTargetDescriptor::List GetDescriptorsFromProviders(); 45 DevToolsTargetDescriptor::List GetDescriptorsFromProviders();
43 46
44 std::vector<Provider*> providers_; 47 std::vector<Provider*> providers_;
45 CreateCallback create_callback_; 48 CreateCallback create_callback_;
46 49
47 DISALLOW_COPY_AND_ASSIGN(DevToolsDiscoveryManager); 50 DISALLOW_COPY_AND_ASSIGN(DevToolsDiscoveryManager);
48 }; 51 };
49 52
50 } // namespace devtools_discovery 53 } // namespace devtools_discovery
51 54
52 #endif // COMPONENTS_DEVTOOLS_DISCOVERY_DEVTOOLS_DISCOVERY_MANAGER_H_ 55 #endif // COMPONENTS_DEVTOOLS_DISCOVERY_DEVTOOLS_DISCOVERY_MANAGER_H_
OLDNEW
« no previous file with comments | « chromecast/browser/devtools/remote_debugging_server.cc ('k') | components/devtools_discovery/devtools_target_descriptor.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698