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

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: 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_impl.cc
diff --git a/components/arc/arc_bridge_service_impl.cc b/components/arc/arc_bridge_service_impl.cc
index 1a1c954fefa2993b44ff387ae762c8cc6c9597a2..81e4c9167785d2e068d2a1a72ba5f02182ebeb92 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));
+}
+
void ArcBridgeServiceImpl::SocketConnect(const base::FilePath& socket_path) {
DCHECK(origin_task_runner()->RunsTasksOnCurrentThread());
if (state() != State::STOPPED) {
@@ -219,6 +235,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;
@@ -226,6 +256,10 @@ bool ArcBridgeServiceImpl::OnMessageReceived(const IPC::Message& message) {
IPC_BEGIN_MESSAGE_MAP(ArcBridgeServiceImpl, message)
IPC_MESSAGE_HANDLER(ArcInstanceHostMsg_InstanceBootPhase,
OnInstanceBootPhase)
+ IPC_MESSAGE_HANDLER(ArcInstanceHostMsg_NotificationPosted,
+ OnNotificationPostedFromAndroid)
+ IPC_MESSAGE_HANDLER(ArcInstanceHostMsg_NotificationRemoved,
+ OnNotificationRemovedFromAndroid)
IPC_MESSAGE_UNHANDLED(handled = false)
IPC_END_MESSAGE_MAP()

Powered by Google App Engine
This is Rietveld 408576698