| 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 ArcIntentHelperObserver; | 22 class ArcIntentHelperObserver; |
| 23 class ArcService; | 23 class ArcService; |
| 24 class ArcSessionRunner; |
| 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. |
| 32 virtual void OnIntentFiltersUpdated() = 0; | 33 virtual void OnIntentFiltersUpdated() = 0; |
| 33 | 34 |
| (...skipping 25 matching lines...) Expand all Loading... |
| 59 void AddObserver(Observer* observer); | 60 void AddObserver(Observer* observer); |
| 60 void RemoveObserver(Observer* observer); | 61 void RemoveObserver(Observer* observer); |
| 61 | 62 |
| 62 // Called to shut down all ARC services. | 63 // Called to shut down all ARC services. |
| 63 void Shutdown(); | 64 void Shutdown(); |
| 64 | 65 |
| 65 scoped_refptr<base::TaskRunner> blocking_task_runner() const { | 66 scoped_refptr<base::TaskRunner> blocking_task_runner() const { |
| 66 return blocking_task_runner_; | 67 return blocking_task_runner_; |
| 67 } | 68 } |
| 68 | 69 |
| 69 // Set ArcBridgeService instance for testing. Call before ArcServiceManager | 70 // Set ArcSessionRunner instance for testing. Call before ArcServiceManager |
| 70 // creation. ArcServiceManager owns |arc_bridge_service|. | 71 // creation. ArcServiceManager owns |arc_bridge_service|. |
| 71 static void SetArcBridgeServiceForTesting( | 72 static void SetArcSessionRunnerForTesting( |
| 72 std::unique_ptr<ArcBridgeService> arc_bridge_service); | 73 std::unique_ptr<ArcSessionRunner> arc_session_runner); |
| 73 | 74 |
| 74 // Returns the icon loader owned by ArcServiceManager and shared by services. | 75 // Returns the icon loader owned by ArcServiceManager and shared by services. |
| 75 scoped_refptr<ActivityIconLoader> icon_loader() { return icon_loader_; } | 76 scoped_refptr<ActivityIconLoader> icon_loader() { return icon_loader_; } |
| 76 | 77 |
| 77 // Returns the activity resolver owned by ArcServiceManager. | 78 // Returns the activity resolver owned by ArcServiceManager. |
| 78 scoped_refptr<LocalActivityResolver> activity_resolver() { | 79 scoped_refptr<LocalActivityResolver> activity_resolver() { |
| 79 return activity_resolver_; | 80 return activity_resolver_; |
| 80 } | 81 } |
| 81 | 82 |
| 82 // Returns the IntentHelperObserver instance owned by ArcServiceManager. | 83 // Returns the IntentHelperObserver instance owned by ArcServiceManager. |
| (...skipping 16 matching lines...) Expand all Loading... |
| 99 scoped_refptr<LocalActivityResolver> activity_resolver_; | 100 scoped_refptr<LocalActivityResolver> activity_resolver_; |
| 100 | 101 |
| 101 base::ObserverList<Observer> observer_list_; | 102 base::ObserverList<Observer> observer_list_; |
| 102 | 103 |
| 103 DISALLOW_COPY_AND_ASSIGN(ArcServiceManager); | 104 DISALLOW_COPY_AND_ASSIGN(ArcServiceManager); |
| 104 }; | 105 }; |
| 105 | 106 |
| 106 } // namespace arc | 107 } // namespace arc |
| 107 | 108 |
| 108 #endif // COMPONENTS_ARC_ARC_SERVICE_MANAGER_H_ | 109 #endif // COMPONENTS_ARC_ARC_SERVICE_MANAGER_H_ |
| OLD | NEW |