OLD | NEW |
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 <vector> |
| 9 |
8 #include "base/macros.h" | 10 #include "base/macros.h" |
9 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
10 #include "base/threading/thread_checker.h" | 12 #include "base/threading/thread_checker.h" |
11 #include "components/signin/core/account_id/account_id.h" | 13 #include "components/signin/core/account_id/account_id.h" |
12 | 14 |
13 namespace arc { | 15 namespace arc { |
14 | 16 |
15 class ArcAuthService; | |
16 class ArcBridgeService; | 17 class ArcBridgeService; |
17 class ArcClipboardBridge; | 18 class ArcService; |
18 class ArcImeBridge; | |
19 class ArcInputBridge; | |
20 class ArcIntentHelperBridge; | |
21 class ArcNotificationManager; | |
22 class ArcPowerBridge; | |
23 class ArcSettingsBridge; | |
24 class ArcVideoBridge; | |
25 | 19 |
26 // Manages creation and destruction of services that communicate with the ARC | 20 // Manages creation and destruction of services that communicate with the ARC |
27 // instance via the ArcBridgeService. | 21 // instance via the ArcBridgeService. |
28 class ArcServiceManager { | 22 class ArcServiceManager { |
29 public: | 23 public: |
30 ArcServiceManager(scoped_ptr<ArcAuthService> auth_service, | 24 ArcServiceManager(); |
31 scoped_ptr<ArcIntentHelperBridge> intent_helper_bridge, | |
32 scoped_ptr<ArcSettingsBridge> settings_bridge, | |
33 scoped_ptr<ArcVideoBridge> video_bridge); | |
34 virtual ~ArcServiceManager(); | 25 virtual ~ArcServiceManager(); |
35 | 26 |
36 // |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 |
37 // class was created on. | 28 // class was created on. |
38 ArcBridgeService* arc_bridge_service(); | 29 ArcBridgeService* arc_bridge_service(); |
39 | 30 |
| 31 // Adds a service to the managed services list. |
| 32 void AddService(scoped_ptr<ArcService> service); |
| 33 |
40 // 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 |
41 // called on the thread that this class was created on. | 35 // called on the thread that this class was created on. |
42 static ArcServiceManager* Get(); | 36 static ArcServiceManager* Get(); |
43 | 37 |
44 // Called when the main profile is initialized after user logs in. | 38 // Called when the main profile is initialized after user logs in. |
45 void OnPrimaryUserProfilePrepared(const AccountId& account_id); | 39 void OnPrimaryUserProfilePrepared(const AccountId& account_id); |
46 | 40 |
47 private: | 41 private: |
48 base::ThreadChecker thread_checker_; | 42 base::ThreadChecker thread_checker_; |
49 scoped_ptr<ArcBridgeService> arc_bridge_service_; | 43 scoped_ptr<ArcBridgeService> arc_bridge_service_; |
50 | 44 std::vector<scoped_ptr<ArcService>> services_; |
51 // Individual services | |
52 scoped_ptr<ArcAuthService> arc_auth_service_; | |
53 scoped_ptr<ArcClipboardBridge> arc_clipboard_bridge_; | |
54 scoped_ptr<ArcImeBridge> arc_ime_bridge_; | |
55 scoped_ptr<ArcInputBridge> arc_input_bridge_; | |
56 scoped_ptr<ArcIntentHelperBridge> arc_intent_helper_bridge_; | |
57 scoped_ptr<ArcNotificationManager> arc_notification_manager_; | |
58 scoped_ptr<ArcSettingsBridge> arc_settings_bridge_; | |
59 scoped_ptr<ArcPowerBridge> arc_power_bridge_; | |
60 scoped_ptr<ArcVideoBridge> arc_video_bridge_; | |
61 | 45 |
62 DISALLOW_COPY_AND_ASSIGN(ArcServiceManager); | 46 DISALLOW_COPY_AND_ASSIGN(ArcServiceManager); |
63 }; | 47 }; |
64 | 48 |
65 } // namespace arc | 49 } // namespace arc |
66 | 50 |
67 #endif // COMPONENTS_ARC_ARC_SERVICE_MANAGER_H_ | 51 #endif // COMPONENTS_ARC_ARC_SERVICE_MANAGER_H_ |
OLD | NEW |