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/observer_list.h" | 13 #include "base/observer_list.h" |
14 #include "base/task_runner.h" | 14 #include "base/task_runner.h" |
15 #include "base/threading/thread_checker.h" | 15 #include "base/threading/thread_checker.h" |
16 #include "components/arc/intent_helper/activity_icon_loader.h" | 16 #include "components/arc/intent_helper/activity_icon_loader.h" |
17 #include "components/arc/intent_helper/local_activity_resolver.h" | 17 #include "components/arc/intent_helper/local_activity_resolver.h" |
18 | 18 |
19 namespace arc { | 19 namespace arc { |
20 | 20 |
21 class ArcBridgeService; | 21 class ArcBridgeService; |
22 class ArcFileSystemService; | |
22 class ArcIntentHelperObserver; | 23 class ArcIntentHelperObserver; |
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 class Observer { | 30 class Observer { |
30 public: | 31 public: |
31 // Called when intent filters are added or removed. | 32 // Called when intent filters are added or removed. |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
67 } | 68 } |
68 | 69 |
69 // Returns the icon loader owned by ArcServiceManager and shared by services. | 70 // Returns the icon loader owned by ArcServiceManager and shared by services. |
70 scoped_refptr<ActivityIconLoader> icon_loader() { return icon_loader_; } | 71 scoped_refptr<ActivityIconLoader> icon_loader() { return icon_loader_; } |
71 | 72 |
72 // Returns the activity resolver owned by ArcServiceManager. | 73 // Returns the activity resolver owned by ArcServiceManager. |
73 scoped_refptr<LocalActivityResolver> activity_resolver() { | 74 scoped_refptr<LocalActivityResolver> activity_resolver() { |
74 return activity_resolver_; | 75 return activity_resolver_; |
75 } | 76 } |
76 | 77 |
77 // Returns the IntentHelperObserver instance owned by ArcServiceManager. | 78 // Returns the ArcIntentHelperObserver instance owned by ArcServiceManager. |
78 ArcIntentHelperObserver* intent_helper_observer() { | 79 ArcIntentHelperObserver* intent_helper_observer() { |
79 return intent_helper_observer_.get(); | 80 return intent_helper_observer_.get(); |
80 } | 81 } |
81 | 82 |
83 // TODO(crbug.com/672840): Implement a generic getter to avoid boilerplates. | |
84 void set_file_system_service(ArcFileSystemService* file_system_service) { | |
Luis Héctor Chávez
2017/01/11 17:10:45
FYI the support for the generic getter has landed,
Shuhei Takahashi
2017/01/12 08:52:13
Thanks, I've updated the patch to use the brand ne
| |
85 file_system_service_ = file_system_service; | |
86 } | |
87 ArcFileSystemService* file_system_service() const { | |
88 return file_system_service_; | |
89 } | |
90 | |
82 private: | 91 private: |
83 class IntentHelperObserverImpl; // implemented in arc_service_manager.cc. | 92 class IntentHelperObserverImpl; // implemented in arc_service_manager.cc. |
84 | 93 |
85 base::ThreadChecker thread_checker_; | 94 base::ThreadChecker thread_checker_; |
86 scoped_refptr<base::TaskRunner> blocking_task_runner_; | 95 scoped_refptr<base::TaskRunner> blocking_task_runner_; |
87 | 96 |
88 // An object for observing the ArcIntentHelper instance in |services_|. | 97 // An object for observing the ArcIntentHelper instance in |services_|. |
89 std::unique_ptr<ArcIntentHelperObserver> intent_helper_observer_; | 98 std::unique_ptr<ArcIntentHelperObserver> intent_helper_observer_; |
90 | 99 |
91 std::unique_ptr<ArcBridgeService> arc_bridge_service_; | 100 std::unique_ptr<ArcBridgeService> arc_bridge_service_; |
92 std::vector<std::unique_ptr<ArcService>> services_; | 101 std::vector<std::unique_ptr<ArcService>> services_; |
93 scoped_refptr<ActivityIconLoader> icon_loader_; | 102 scoped_refptr<ActivityIconLoader> icon_loader_; |
94 scoped_refptr<LocalActivityResolver> activity_resolver_; | 103 scoped_refptr<LocalActivityResolver> activity_resolver_; |
95 | 104 |
105 // Owned by |services_|. | |
106 ArcFileSystemService* file_system_service_ = nullptr; | |
107 | |
96 base::ObserverList<Observer> observer_list_; | 108 base::ObserverList<Observer> observer_list_; |
97 | 109 |
98 DISALLOW_COPY_AND_ASSIGN(ArcServiceManager); | 110 DISALLOW_COPY_AND_ASSIGN(ArcServiceManager); |
99 }; | 111 }; |
100 | 112 |
101 } // namespace arc | 113 } // namespace arc |
102 | 114 |
103 #endif // COMPONENTS_ARC_ARC_SERVICE_MANAGER_H_ | 115 #endif // COMPONENTS_ARC_ARC_SERVICE_MANAGER_H_ |
OLD | NEW |