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 <string> | 9 #include <string> |
| 10 #include <type_traits> | 10 #include <type_traits> |
| 11 #include <unordered_map> | 11 #include <unordered_map> |
| 12 #include <utility> | 12 #include <utility> |
| 13 #include <vector> | 13 #include <vector> |
| 14 | 14 |
| 15 #include "base/macros.h" | 15 #include "base/macros.h" |
| 16 #include "base/memory/ref_counted.h" | 16 #include "base/memory/ref_counted.h" |
| 17 #include "base/task_runner.h" | 17 #include "base/task_runner.h" |
| 18 #include "base/threading/thread_checker.h" | 18 #include "base/threading/thread_checker.h" |
| 19 #include "components/arc/intent_helper/activity_icon_loader.h" | 19 #include "components/arc/arc_service.h" |
|
hidehiko
2017/01/27 16:04:06
Note: this is needed because AddServiceInternal()
| |
| 20 #include "components/arc/intent_helper/local_activity_resolver.h" | 20 #include "components/arc/intent_helper/local_activity_resolver.h" |
| 21 | 21 |
| 22 namespace arc { | 22 namespace arc { |
| 23 | 23 |
| 24 class ArcBridgeService; | 24 class ArcBridgeService; |
| 25 class ArcService; | |
| 26 | 25 |
| 27 namespace internal { | 26 namespace internal { |
| 28 | 27 |
| 29 // If an ArcService is declared with a name, e.g.: | 28 // If an ArcService is declared with a name, e.g.: |
| 30 // | 29 // |
| 31 // class MyArcService : public ArcService { | 30 // class MyArcService : public ArcService { |
| 32 // public: | 31 // public: |
| 33 // static const char kArcServiceName[]; | 32 // static const char kArcServiceName[]; |
| 34 // ... | 33 // ... |
| 35 // }; | 34 // }; |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 100 // called on the thread that this class was created on. | 99 // called on the thread that this class was created on. |
| 101 static ArcServiceManager* Get(); | 100 static ArcServiceManager* Get(); |
| 102 | 101 |
| 103 // Called to shut down all ARC services. | 102 // Called to shut down all ARC services. |
| 104 void Shutdown(); | 103 void Shutdown(); |
| 105 | 104 |
| 106 scoped_refptr<base::TaskRunner> blocking_task_runner() const { | 105 scoped_refptr<base::TaskRunner> blocking_task_runner() const { |
| 107 return blocking_task_runner_; | 106 return blocking_task_runner_; |
| 108 } | 107 } |
| 109 | 108 |
| 110 // Returns the icon loader owned by ArcServiceManager and shared by services. | |
| 111 scoped_refptr<ActivityIconLoader> icon_loader() { return icon_loader_; } | |
| 112 | |
| 113 // Returns the activity resolver owned by ArcServiceManager. | 109 // Returns the activity resolver owned by ArcServiceManager. |
| 114 scoped_refptr<LocalActivityResolver> activity_resolver() { | 110 scoped_refptr<LocalActivityResolver> activity_resolver() { |
| 115 return activity_resolver_; | 111 return activity_resolver_; |
| 116 } | 112 } |
| 117 | 113 |
| 118 private: | 114 private: |
| 119 class IntentHelperObserverImpl; // implemented in arc_service_manager.cc. | 115 class IntentHelperObserverImpl; // implemented in arc_service_manager.cc. |
| 120 | 116 |
| 121 // Helper methods for AddService and GetService. | 117 // Helper methods for AddService and GetService. |
| 122 bool AddServiceInternal(const std::string& name, | 118 bool AddServiceInternal(const std::string& name, |
| 123 std::unique_ptr<ArcService> service); | 119 std::unique_ptr<ArcService> service); |
| 124 ArcService* GetNamedServiceInternal(const std::string& name); | 120 ArcService* GetNamedServiceInternal(const std::string& name); |
| 125 | 121 |
| 126 base::ThreadChecker thread_checker_; | 122 base::ThreadChecker thread_checker_; |
| 127 scoped_refptr<base::TaskRunner> blocking_task_runner_; | 123 scoped_refptr<base::TaskRunner> blocking_task_runner_; |
| 128 | 124 |
| 129 std::unique_ptr<ArcBridgeService> arc_bridge_service_; | 125 std::unique_ptr<ArcBridgeService> arc_bridge_service_; |
| 130 std::unordered_multimap<std::string, std::unique_ptr<ArcService>> services_; | 126 std::unordered_multimap<std::string, std::unique_ptr<ArcService>> services_; |
| 131 scoped_refptr<ActivityIconLoader> icon_loader_; | |
| 132 scoped_refptr<LocalActivityResolver> activity_resolver_; | 127 scoped_refptr<LocalActivityResolver> activity_resolver_; |
| 133 | 128 |
| 134 DISALLOW_COPY_AND_ASSIGN(ArcServiceManager); | 129 DISALLOW_COPY_AND_ASSIGN(ArcServiceManager); |
| 135 }; | 130 }; |
| 136 | 131 |
| 137 } // namespace arc | 132 } // namespace arc |
| 138 | 133 |
| 139 #endif // COMPONENTS_ARC_ARC_SERVICE_MANAGER_H_ | 134 #endif // COMPONENTS_ARC_ARC_SERVICE_MANAGER_H_ |
| OLD | NEW |