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

Unified Diff: components/arc/arc_bridge_service_impl.cc

Issue 1475583002: Add IPC messages for ARC notification (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased 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
« no previous file with comments | « components/arc/arc_bridge_service_impl.h ('k') | components/arc/common/arc_host_messages.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/arc/arc_bridge_service_impl.cc
diff --git a/components/arc/arc_bridge_service_impl.cc b/components/arc/arc_bridge_service_impl.cc
index b5611b7244c9db2002d76e8f2b60eda48d5b424f..df66d7cd5c41897167f129baa05e035474bd1d45 100644
--- a/components/arc/arc_bridge_service_impl.cc
+++ b/components/arc/arc_bridge_service_impl.cc
@@ -108,6 +108,22 @@ bool ArcBridgeServiceImpl::RegisterInputDevice(const std::string& name,
name, device_type, base::FileDescriptor(fd.Pass())));
}
+bool ArcBridgeServiceImpl::SendNotificationEventToAndroid(
+ const std::string& key, ArcNotificationEvent event) {
+ DCHECK(ipc_task_runner_->RunsTasksOnCurrentThread());
+ if (key.empty()) {
+ LOG(ERROR) << "SendNotificationToAndroid failed: Wrong parameter";
+ return false;
+ }
+ if (state() != State::READY) {
+ LOG(ERROR) << "Called SendNotificationEventToAndroid when the service is"
+ << "not ready";
+ return false;
+ }
+ return ipc_channel_->Send(
+ new ArcInstanceMsg_SendNotificationEventToAndroid(key, event));
+}
+
bool ArcBridgeServiceImpl::RefreshAppList() {
DCHECK(origin_task_runner()->RunsTasksOnCurrentThread());
if (state() != State::READY) {
@@ -251,6 +267,20 @@ void ArcBridgeServiceImpl::OnInstanceBootPhase(InstanceBootPhase phase) {
FOR_EACH_OBSERVER(Observer, observer_list(), OnInstanceBootPhase(phase));
}
+void ArcBridgeServiceImpl::OnNotificationPostedFromAndroid(
+ const arc::ArcNotificationData& data) {
+ DCHECK(origin_task_runner()->RunsTasksOnCurrentThread());
+ FOR_EACH_OBSERVER(NotificationObserver, notification_observer_list(),
+ OnNotificationPostedFromAndroid(data));
+}
+
+void ArcBridgeServiceImpl::OnNotificationRemovedFromAndroid(
+ const std::string& key) {
+ DCHECK(origin_task_runner()->RunsTasksOnCurrentThread());
+ FOR_EACH_OBSERVER(NotificationObserver, notification_observer_list(),
+ OnNotificationRemovedFromAndroid(key));
+}
+
bool ArcBridgeServiceImpl::OnMessageReceived(const IPC::Message& message) {
DCHECK(origin_task_runner()->RunsTasksOnCurrentThread());
bool handled = true;
@@ -260,6 +290,10 @@ bool ArcBridgeServiceImpl::OnMessageReceived(const IPC::Message& message) {
OnInstanceBootPhase)
IPC_MESSAGE_HANDLER(ArcInstanceHostMsg_AppListRefreshed, OnAppListRefreshed)
IPC_MESSAGE_HANDLER(ArcInstanceHostMsg_AppIcon, OnAppIcon)
+ IPC_MESSAGE_HANDLER(ArcInstanceHostMsg_NotificationPosted,
+ OnNotificationPostedFromAndroid)
+ IPC_MESSAGE_HANDLER(ArcInstanceHostMsg_NotificationRemoved,
+ OnNotificationRemovedFromAndroid)
IPC_MESSAGE_UNHANDLED(handled = false)
IPC_END_MESSAGE_MAP()
« no previous file with comments | « components/arc/arc_bridge_service_impl.h ('k') | components/arc/common/arc_host_messages.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698