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..af9a343656927a94708f3fc207cdfa4529c6b801 100644 |
| --- a/components/arc/arc_bridge_service.h |
| +++ b/components/arc/arc_bridge_service.h |
| @@ -10,6 +10,7 @@ |
| #include "base/memory/scoped_ptr.h" |
| #include "base/observer_list.h" |
| #include "components/arc/common/arc_message_types.h" |
| +#include "components/arc/common/arc_notification_types.h" |
| namespace base { |
| class CommandLine; |
| @@ -79,6 +80,19 @@ class ArcBridgeService { |
| virtual ~Observer() {} |
| }; |
| + class NotificationObserver { |
|
dcheng
2015/12/02 18:26:53
With https://codereview.chromium.org/1475563002, t
yoshiki
2015/12/03 14:17:55
Yes, and we'll have more type of observers, but I
|
| + public: |
| + // Called whenever a notification has been posted on Android side. This |
| + // event is used for both creation and update. |
| + virtual void OnNotificationPostedFromAndroid( |
| + const ArcNotificationData& data) {} |
| + // Called whenever a notification has been removed on Android side. |
| + virtual void OnNotificationRemovedFromAndroid(const std::string& key) {} |
| + |
| + protected: |
| + virtual ~NotificationObserver() {} |
| + }; |
| + |
| virtual ~ArcBridgeService(); |
| // Creates instance of |ArcBridgeService| for normal use. |
| @@ -112,6 +126,8 @@ class ArcBridgeService { |
| // class was created on. |
| void AddObserver(Observer* observer); |
| void RemoveObserver(Observer* observer); |
| + void AddNotificationObserver(NotificationObserver* observer); |
| + void RemoveNotificationObserver(NotificationObserver* observer); |
| // Gets the current state of the bridge service. |
| State state() const { return state_; } |
| @@ -129,6 +145,10 @@ class ArcBridgeService { |
| const std::string& device_type, |
| base::ScopedFD fd) = 0; |
| + // Sends a notification event to Android side. |
| + virtual bool SendNotificationEventToAndroid(const std::string& key, |
| + ArcNotificationEvent event) = 0; |
| + |
| protected: |
| ArcBridgeService(); |
| @@ -143,11 +163,15 @@ class ArcBridgeService { |
| } |
| base::ObserverList<Observer>& observer_list() { return observer_list_; } |
| + base::ObserverList<NotificationObserver>& notification_observer_list() { |
| + return notification_observer_list_; |
| + } |
| private: |
| scoped_refptr<base::SequencedTaskRunner> origin_task_runner_; |
| base::ObserverList<Observer> observer_list_; |
| + base::ObserverList<NotificationObserver> notification_observer_list_; |
| // If the ARC instance service is available. |
| bool available_; |