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 <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 shutdown. Observer implementation | |
|
Daniel Erat
2016/12/16 16:05:44
nit: s/shutdown/shut down/ ("shut down" is the ver
hidehiko
2016/12/16 17:14:17
Good to know about verb v.s. noun. Thank you. Fixe
| |
| 32 // should call clean up ARC related stuff here. One of the typical | |
|
Daniel Erat
2016/12/16 16:05:44
nit: delete "call"?
hidehiko
2016/12/16 17:14:17
Done.
| |
| 33 // use case is calling ArcServiceManager::RemoveObserver(). | |
|
Daniel Erat
2016/12/16 16:05:44
nit: s/case/cases/
hidehiko
2016/12/16 17:14:17
Done.
| |
| 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. | 58 // Returns if the ARC Service Manager instance exists. |
| 54 // DO NOT CALL THIS. This function is a dirty workaround for properly shutting | 59 // 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 | 60 // down chrome/browser/chromeos/extensions/file_manager/event_router.cc, and |
| 56 // will likely be removed in the future. | 61 // will likely be removed in the future. |
| 57 static bool IsInitialized(); | 62 static bool IsInitialized(); |
|
Shuhei Takahashi
2016/12/16 13:36:13
Please remove this declaration.
hidehiko
2016/12/16 17:14:17
Good catch. Done.
| |
| 58 | 63 |
| 59 void AddObserver(Observer* observer); | 64 void AddObserver(Observer* observer); |
| 60 void RemoveObserver(Observer* observer); | 65 void RemoveObserver(Observer* observer); |
| 61 | 66 |
| 62 // Called to shut down all ARC services. | 67 // Called to shut down all ARC services. |
| 63 void Shutdown(); | 68 void Shutdown(); |
| 64 | 69 |
| 65 scoped_refptr<base::TaskRunner> blocking_task_runner() const { | 70 scoped_refptr<base::TaskRunner> blocking_task_runner() const { |
| 66 return blocking_task_runner_; | 71 return blocking_task_runner_; |
| 67 } | 72 } |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 99 scoped_refptr<LocalActivityResolver> activity_resolver_; | 104 scoped_refptr<LocalActivityResolver> activity_resolver_; |
| 100 | 105 |
| 101 base::ObserverList<Observer> observer_list_; | 106 base::ObserverList<Observer> observer_list_; |
| 102 | 107 |
| 103 DISALLOW_COPY_AND_ASSIGN(ArcServiceManager); | 108 DISALLOW_COPY_AND_ASSIGN(ArcServiceManager); |
| 104 }; | 109 }; |
| 105 | 110 |
| 106 } // namespace arc | 111 } // namespace arc |
| 107 | 112 |
| 108 #endif // COMPONENTS_ARC_ARC_SERVICE_MANAGER_H_ | 113 #endif // COMPONENTS_ARC_ARC_SERVICE_MANAGER_H_ |
| OLD | NEW |