| 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 | 19 |
| 20 namespace arc { | 20 namespace arc { |
| 21 | 21 |
| 22 class ArcBridgeService; | 22 class ArcBridgeService; |
| 23 class ArcService; | 23 class ArcService; |
| 24 class ArcUserDataService; |
| 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 |
| (...skipping 28 matching lines...) Expand all Loading... |
| 62 std::unique_ptr<ArcBridgeService> arc_bridge_service); | 63 std::unique_ptr<ArcBridgeService> arc_bridge_service); |
| 63 | 64 |
| 64 // Returns the icon loader owned by ArcServiceManager and shared by services. | 65 // Returns the icon loader owned by ArcServiceManager and shared by services. |
| 65 scoped_refptr<ActivityIconLoader> icon_loader() { return icon_loader_; } | 66 scoped_refptr<ActivityIconLoader> icon_loader() { return icon_loader_; } |
| 66 | 67 |
| 67 // Returns the activity resolver owned by ArcServiceManager. | 68 // Returns the activity resolver owned by ArcServiceManager. |
| 68 scoped_refptr<LocalActivityResolver> activity_resolver() { | 69 scoped_refptr<LocalActivityResolver> activity_resolver() { |
| 69 return activity_resolver_; | 70 return activity_resolver_; |
| 70 } | 71 } |
| 71 | 72 |
| 73 ArcUserDataService* arc_user_data_service() { |
| 74 return arc_user_data_service_.get(); |
| 75 } |
| 76 |
| 72 private: | 77 private: |
| 73 base::ThreadChecker thread_checker_; | 78 base::ThreadChecker thread_checker_; |
| 74 scoped_refptr<base::TaskRunner> blocking_task_runner_; | 79 scoped_refptr<base::TaskRunner> blocking_task_runner_; |
| 75 | 80 |
| 76 std::unique_ptr<ArcBridgeService> arc_bridge_service_; | 81 std::unique_ptr<ArcBridgeService> arc_bridge_service_; |
| 77 std::vector<std::unique_ptr<ArcService>> services_; | 82 std::vector<std::unique_ptr<ArcService>> services_; |
| 78 scoped_refptr<ActivityIconLoader> icon_loader_; | 83 scoped_refptr<ActivityIconLoader> icon_loader_; |
| 79 scoped_refptr<LocalActivityResolver> activity_resolver_; | 84 scoped_refptr<LocalActivityResolver> activity_resolver_; |
| 85 std::unique_ptr<ArcUserDataService> arc_user_data_service_; |
| 80 | 86 |
| 81 // True once the window manager service got added, barring adding any more | 87 // True once the window manager service got added, barring adding any more |
| 82 // of those since OnAshStarted() might be called multiple times. | 88 // of those since OnAshStarted() might be called multiple times. |
| 83 bool on_ash_started_called_ = false; | 89 bool on_ash_started_called_ = false; |
| 84 | 90 |
| 85 DISALLOW_COPY_AND_ASSIGN(ArcServiceManager); | 91 DISALLOW_COPY_AND_ASSIGN(ArcServiceManager); |
| 86 }; | 92 }; |
| 87 | 93 |
| 88 } // namespace arc | 94 } // namespace arc |
| 89 | 95 |
| 90 #endif // COMPONENTS_ARC_ARC_SERVICE_MANAGER_H_ | 96 #endif // COMPONENTS_ARC_ARC_SERVICE_MANAGER_H_ |
| OLD | NEW |