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