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

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

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

Powered by Google App Engine
This is Rietveld 408576698