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

Side by Side Diff: components/arc/arc_service_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
« no previous file with comments | « components/arc/arc_bridge_service_unittest.cc ('k') | components/arc/arc_service_manager.cc » ('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 #ifndef COMPONENTS_ARC_ARC_SERVICE_MANAGER_H_ 5 #ifndef COMPONENTS_ARC_ARC_SERVICE_MANAGER_H_
6 #define COMPONENTS_ARC_ARC_SERVICE_MANAGER_H_ 6 #define COMPONENTS_ARC_ARC_SERVICE_MANAGER_H_
7 7
8 #include <memory>
8 #include <vector> 9 #include <vector>
9 10
10 #include "base/macros.h" 11 #include "base/macros.h"
11 #include "base/memory/scoped_ptr.h"
12 #include "base/threading/thread_checker.h" 12 #include "base/threading/thread_checker.h"
13 #include "components/signin/core/account_id/account_id.h" 13 #include "components/signin/core/account_id/account_id.h"
14 14
15 namespace arc { 15 namespace arc {
16 16
17 class ArcBridgeService; 17 class ArcBridgeService;
18 class ArcService; 18 class ArcService;
19 19
20 // Manages creation and destruction of services that communicate with the ARC 20 // Manages creation and destruction of services that communicate with the ARC
21 // instance via the ArcBridgeService. 21 // instance via the ArcBridgeService.
22 class ArcServiceManager { 22 class ArcServiceManager {
23 public: 23 public:
24 ArcServiceManager(); 24 ArcServiceManager();
25 virtual ~ArcServiceManager(); 25 virtual ~ArcServiceManager();
26 26
27 // |arc_bridge_service| can only be accessed on the thread that this 27 // |arc_bridge_service| can only be accessed on the thread that this
28 // class was created on. 28 // class was created on.
29 ArcBridgeService* arc_bridge_service(); 29 ArcBridgeService* arc_bridge_service();
30 30
31 // Adds a service to the managed services list. 31 // Adds a service to the managed services list.
32 void AddService(scoped_ptr<ArcService> service); 32 void AddService(std::unique_ptr<ArcService> service);
33 33
34 // Gets the global instance of the ARC Service Manager. This can only be 34 // Gets the global instance of the ARC Service Manager. This can only be
35 // called on the thread that this class was created on. 35 // called on the thread that this class was created on.
36 static ArcServiceManager* Get(); 36 static ArcServiceManager* Get();
37 37
38 // Called when the main profile is initialized after user logs in. 38 // Called when the main profile is initialized after user logs in.
39 void OnPrimaryUserProfilePrepared(const AccountId& account_id); 39 void OnPrimaryUserProfilePrepared(const AccountId& account_id);
40 40
41 // Called to shut down all ARC services. 41 // Called to shut down all ARC services.
42 void Shutdown(); 42 void Shutdown();
43 43
44 // Set ArcBridgeService instance for testing. Call before ArcServiceManager 44 // Set ArcBridgeService instance for testing. Call before ArcServiceManager
45 // creation. ArcServiceManager owns |arc_bridge_service|. 45 // creation. ArcServiceManager owns |arc_bridge_service|.
46 static void SetArcBridgeServiceForTesting( 46 static void SetArcBridgeServiceForTesting(
47 scoped_ptr<ArcBridgeService> arc_bridge_service); 47 std::unique_ptr<ArcBridgeService> arc_bridge_service);
48 48
49 private: 49 private:
50 base::ThreadChecker thread_checker_; 50 base::ThreadChecker thread_checker_;
51 scoped_ptr<ArcBridgeService> arc_bridge_service_; 51 std::unique_ptr<ArcBridgeService> arc_bridge_service_;
52 std::vector<scoped_ptr<ArcService>> services_; 52 std::vector<std::unique_ptr<ArcService>> services_;
53 53
54 DISALLOW_COPY_AND_ASSIGN(ArcServiceManager); 54 DISALLOW_COPY_AND_ASSIGN(ArcServiceManager);
55 }; 55 };
56 56
57 } // namespace arc 57 } // namespace arc
58 58
59 #endif // COMPONENTS_ARC_ARC_SERVICE_MANAGER_H_ 59 #endif // COMPONENTS_ARC_ARC_SERVICE_MANAGER_H_
OLDNEW
« no previous file with comments | « components/arc/arc_bridge_service_unittest.cc ('k') | components/arc/arc_service_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698