| 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 |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 class ArcBridgeService; | 21 class ArcBridgeService; |
| 22 class ArcIntentHelperObserver; | 22 class ArcIntentHelperObserver; |
| 23 class ArcService; | 23 class ArcService; |
| 24 | 24 |
| 25 // Manages creation and destruction of services that communicate with the ARC | 25 // Manages creation and destruction of services that communicate with the ARC |
| 26 // instance via the ArcBridgeService. | 26 // instance via the ArcBridgeService. |
| 27 class ArcServiceManager { | 27 class ArcServiceManager { |
| 28 public: | 28 public: |
| 29 class Observer { | 29 class Observer { |
| 30 public: | 30 public: |
| 31 // Called when ArcServiceManager is being shut down. Observer |
| 32 // implementation should clean up ARC related stuff here. One of the |
| 33 // typical use cases is calling ArcServiceManager::RemoveObserver(). |
| 34 virtual void OnArcShutdown() = 0; |
| 35 |
| 31 // Called when intent filters are added or removed. | 36 // Called when intent filters are added or removed. |
| 32 virtual void OnIntentFiltersUpdated() = 0; | 37 virtual void OnIntentFiltersUpdated() = 0; |
| 33 | 38 |
| 34 protected: | 39 protected: |
| 35 virtual ~Observer() = default; | 40 virtual ~Observer() = default; |
| 36 }; | 41 }; |
| 37 | 42 |
| 38 explicit ArcServiceManager( | 43 explicit ArcServiceManager( |
| 39 scoped_refptr<base::TaskRunner> blocking_task_runner); | 44 scoped_refptr<base::TaskRunner> blocking_task_runner); |
| 40 ~ArcServiceManager(); | 45 ~ArcServiceManager(); |
| 41 | 46 |
| 42 // |arc_bridge_service| can only be accessed on the thread that this | 47 // |arc_bridge_service| can only be accessed on the thread that this |
| 43 // class was created on. | 48 // class was created on. |
| 44 ArcBridgeService* arc_bridge_service(); | 49 ArcBridgeService* arc_bridge_service(); |
| 45 | 50 |
| 46 // Adds a service to the managed services list. | 51 // Adds a service to the managed services list. |
| 47 void AddService(std::unique_ptr<ArcService> service); | 52 void AddService(std::unique_ptr<ArcService> service); |
| 48 | 53 |
| 49 // Gets the global instance of the ARC Service Manager. This can only be | 54 // Gets the global instance of the ARC Service Manager. This can only be |
| 50 // called on the thread that this class was created on. | 55 // called on the thread that this class was created on. |
| 51 static ArcServiceManager* Get(); | 56 static ArcServiceManager* Get(); |
| 52 | 57 |
| 53 // Returns if the ARC Service Manager instance exists. | |
| 54 // DO NOT CALL THIS. This function is a dirty workaround for properly shutting | |
| 55 // down chrome/browser/chromeos/extensions/file_manager/event_router.cc, and | |
| 56 // will likely be removed in the future. | |
| 57 static bool IsInitialized(); | |
| 58 | |
| 59 void AddObserver(Observer* observer); | 58 void AddObserver(Observer* observer); |
| 60 void RemoveObserver(Observer* observer); | 59 void RemoveObserver(Observer* observer); |
| 61 | 60 |
| 62 // Called to shut down all ARC services. | 61 // Called to shut down all ARC services. |
| 63 void Shutdown(); | 62 void Shutdown(); |
| 64 | 63 |
| 65 scoped_refptr<base::TaskRunner> blocking_task_runner() const { | 64 scoped_refptr<base::TaskRunner> blocking_task_runner() const { |
| 66 return blocking_task_runner_; | 65 return blocking_task_runner_; |
| 67 } | 66 } |
| 68 | 67 |
| (...skipping 30 matching lines...) Expand all Loading... |
| 99 scoped_refptr<LocalActivityResolver> activity_resolver_; | 98 scoped_refptr<LocalActivityResolver> activity_resolver_; |
| 100 | 99 |
| 101 base::ObserverList<Observer> observer_list_; | 100 base::ObserverList<Observer> observer_list_; |
| 102 | 101 |
| 103 DISALLOW_COPY_AND_ASSIGN(ArcServiceManager); | 102 DISALLOW_COPY_AND_ASSIGN(ArcServiceManager); |
| 104 }; | 103 }; |
| 105 | 104 |
| 106 } // namespace arc | 105 } // namespace arc |
| 107 | 106 |
| 108 #endif // COMPONENTS_ARC_ARC_SERVICE_MANAGER_H_ | 107 #endif // COMPONENTS_ARC_ARC_SERVICE_MANAGER_H_ |
| OLD | NEW |