Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1614)

Unified Diff: components/arc/arc_bridge_service.h

Issue 1475583002: Add IPC messages for ARC notification (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed the comments Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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_;

Powered by Google App Engine
This is Rietveld 408576698