Chromium Code Reviews| Index: components/arc/arc_bridge_service.h |
| diff --git a/components/arc/arc_bridge_service.h b/components/arc/arc_bridge_service.h |
| index 78e8fa8d2bfbdcd08b6c745895975e0a0ac3a3d7..a3c1fe6c8dafc69e5222e84e4636da2d5ecbfd0d 100644 |
| --- a/components/arc/arc_bridge_service.h |
| +++ b/components/arc/arc_bridge_service.h |
| @@ -64,6 +64,7 @@ class ArcBridgeService { |
| STOPPING, |
| }; |
| + // Notifies life cycle events of ArcBridgeService. |
| class Observer { |
| public: |
| // Called whenever the state of the bridge has changed. |
| @@ -79,6 +80,22 @@ class ArcBridgeService { |
| virtual ~Observer() {} |
| }; |
| + // Notifies ARC apps related events. |
| + class AppObserver { |
| + public: |
| + // Called whenever ARC sends information about available apps. |
| + virtual void OnAppListRefreshed(const std::vector<AppInfo>& apps) {} |
| + |
| + // Called whenever ARC sends app icon data for specific scale factor. |
| + virtual void OnAppIcon(const std::string& package, |
| + const std::string& activity, |
| + ScaleFactor scale_factor, |
| + const std::vector<uint8_t>& icon_png_data) {} |
| + |
| + protected: |
| + virtual ~AppObserver() {} |
| + }; |
| + |
| virtual ~ArcBridgeService(); |
| // Creates instance of |ArcBridgeService| for normal use. |
| @@ -113,6 +130,11 @@ class ArcBridgeService { |
| void AddObserver(Observer* observer); |
| void RemoveObserver(Observer* observer); |
| + // Adds or removes ARC app observers. This can only be called on the thread |
| + // that this class was created on. |
| + void AddAppObserver(AppObserver* observer); |
| + void RemoveAppObserver(AppObserver* observer); |
|
dcheng
2015/12/02 18:44:29
Combined with https://codereview.chromium.org/1475
khmel1
2015/12/03 00:14:08
Yes, this bridge is quite complicate by nature. I
|
| + |
| // Gets the current state of the bridge service. |
| State state() const { return state_; } |
| @@ -129,6 +151,18 @@ class ArcBridgeService { |
| const std::string& device_type, |
| base::ScopedFD fd) = 0; |
| + // Requests to refresh an app list. |
| + virtual bool RefreshAppList() = 0; |
| + |
| + // Requests to launch an app. |
| + virtual bool LaunchApp(const std::string& package, |
| + const std::string& activity) = 0; |
| + |
| + // Requests to load an icon of specific scale_factor. |
| + virtual bool RequestAppIcon(const std::string& package, |
| + const std::string& activity, |
| + ScaleFactor scale_factor) = 0; |
| + |
| protected: |
| ArcBridgeService(); |
| @@ -144,11 +178,17 @@ class ArcBridgeService { |
| base::ObserverList<Observer>& observer_list() { return observer_list_; } |
| + base::ObserverList<AppObserver>& app_observer_list() { |
| + return app_observer_list_; |
| + } |
| + |
| private: |
| scoped_refptr<base::SequencedTaskRunner> origin_task_runner_; |
| base::ObserverList<Observer> observer_list_; |
| + base::ObserverList<AppObserver> app_observer_list_; |
| + |
| // If the ARC instance service is available. |
| bool available_; |