Chromium Code Reviews| 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 <memory> | 8 #include <memory> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "base/macros.h" | 11 #include "base/macros.h" |
| 12 #include "base/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
| 13 #include "base/task_runner.h" | 13 #include "base/task_runner.h" |
| 14 #include "base/threading/thread_checker.h" | 14 #include "base/threading/thread_checker.h" |
| 15 #include "components/arc/intent_helper/activity_icon_loader.h" | 15 #include "components/arc/intent_helper/activity_icon_loader.h" |
| 16 #include "components/arc/intent_helper/local_activity_resolver.h" | 16 #include "components/arc/intent_helper/local_activity_resolver.h" |
| 17 #include "components/prefs/pref_member.h" | 17 #include "components/prefs/pref_member.h" |
| 18 #include "components/signin/core/account_id/account_id.h" | 18 #include "components/signin/core/account_id/account_id.h" |
| 19 #include "content/public/browser/browser_context.h" | |
|
Luis Héctor Chávez
2016/11/23 17:42:09
nit: Can you drop this and just forward-declare co
Sergey Poromov
2016/11/23 18:05:56
Done.
| |
| 19 | 20 |
| 20 namespace arc { | 21 namespace arc { |
| 21 | 22 |
| 22 class ArcBridgeService; | 23 class ArcBridgeService; |
| 23 class ArcService; | 24 class ArcService; |
| 24 | 25 |
| 25 // Manages creation and destruction of services that communicate with the ARC | 26 // Manages creation and destruction of services that communicate with the ARC |
| 26 // instance via the ArcBridgeService. | 27 // instance via the ArcBridgeService. |
| 27 class ArcServiceManager { | 28 class ArcServiceManager { |
| 28 public: | 29 public: |
| 29 explicit ArcServiceManager( | 30 explicit ArcServiceManager( |
| 30 scoped_refptr<base::TaskRunner> blocking_task_runner); | 31 scoped_refptr<base::TaskRunner> blocking_task_runner); |
| 31 virtual ~ArcServiceManager(); | 32 virtual ~ArcServiceManager(); |
| 32 | 33 |
| 33 // |arc_bridge_service| can only be accessed on the thread that this | 34 // |arc_bridge_service| can only be accessed on the thread that this |
| 34 // class was created on. | 35 // class was created on. |
| 35 ArcBridgeService* arc_bridge_service(); | 36 ArcBridgeService* arc_bridge_service(); |
| 36 | 37 |
| 37 // Adds a service to the managed services list. | 38 // Adds a service to the managed services list. |
| 38 void AddService(std::unique_ptr<ArcService> service); | 39 void AddService(std::unique_ptr<ArcService> service); |
| 39 | 40 |
| 40 // Gets the global instance of the ARC Service Manager. This can only be | 41 // Gets the global instance of the ARC Service Manager. This can only be |
| 41 // called on the thread that this class was created on. | 42 // called on the thread that this class was created on. |
| 42 static ArcServiceManager* Get(); | 43 static ArcServiceManager* Get(); |
| 43 | 44 |
| 44 // Called when the main profile is initialized after user logs in. | 45 // Called when the main profile is initialized after user logs in. |
| 45 void OnPrimaryUserProfilePrepared( | 46 void OnPrimaryUserProfilePrepared( |
| 46 const AccountId& account_id, | 47 const AccountId& account_id, |
| 48 content::BrowserContext* browser_context, | |
| 47 std::unique_ptr<BooleanPrefMember> arc_enabled_pref); | 49 std::unique_ptr<BooleanPrefMember> arc_enabled_pref); |
| 48 | 50 |
| 49 // Called to shut down all ARC services. | 51 // Called to shut down all ARC services. |
| 50 void Shutdown(); | 52 void Shutdown(); |
| 51 | 53 |
| 52 scoped_refptr<base::TaskRunner> blocking_task_runner() const { | 54 scoped_refptr<base::TaskRunner> blocking_task_runner() const { |
| 53 return blocking_task_runner_; | 55 return blocking_task_runner_; |
| 54 } | 56 } |
| 55 | 57 |
| 56 // Set ArcBridgeService instance for testing. Call before ArcServiceManager | 58 // Set ArcBridgeService instance for testing. Call before ArcServiceManager |
| (...skipping 17 matching lines...) Expand all Loading... | |
| 74 std::vector<std::unique_ptr<ArcService>> services_; | 76 std::vector<std::unique_ptr<ArcService>> services_; |
| 75 scoped_refptr<ActivityIconLoader> icon_loader_; | 77 scoped_refptr<ActivityIconLoader> icon_loader_; |
| 76 scoped_refptr<LocalActivityResolver> activity_resolver_; | 78 scoped_refptr<LocalActivityResolver> activity_resolver_; |
| 77 | 79 |
| 78 DISALLOW_COPY_AND_ASSIGN(ArcServiceManager); | 80 DISALLOW_COPY_AND_ASSIGN(ArcServiceManager); |
| 79 }; | 81 }; |
| 80 | 82 |
| 81 } // namespace arc | 83 } // namespace arc |
| 82 | 84 |
| 83 #endif // COMPONENTS_ARC_ARC_SERVICE_MANAGER_H_ | 85 #endif // COMPONENTS_ARC_ARC_SERVICE_MANAGER_H_ |
| OLD | NEW |