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

Unified Diff: components/arc/arc_bridge_service.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, 1 month 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.cc
diff --git a/components/arc/arc_bridge_service.cc b/components/arc/arc_bridge_service.cc
index 34c215e93daf65ce4e67f333e2f3d5b924be6687..7cd453b75dd55beddf7381e92e38267792872379 100644
--- a/components/arc/arc_bridge_service.cc
+++ b/components/arc/arc_bridge_service.cc
@@ -134,6 +134,21 @@ bool ArcBridgeService::RegisterInputDevice(const std::string& name,
name, device_type, base::FileDescriptor(fd.Pass())));
}
+bool ArcBridgeService::NotifyNotificationEvent(const std::string& key,
elijahtaylor1 2015/11/27 05:42:49 "NotifyNotification" is kind of confusing to put t
yoshiki 2015/11/27 10:48:06 Done.
+ NotificationEvent event) {
+ DCHECK(ipc_task_runner_->RunsTasksOnCurrentThread());
+ if (state_ != State::READY) {
+ LOG(ERROR) << "Called RegisterInputDevice when the service is not ready";
elijahtaylor1 2015/11/27 05:42:49 copy/paste error with RegisterInputDevice Maybe w
yoshiki 2015/11/27 10:48:06 I created a SendMessageIfReady(Message*) method, w
+ return false;
+ }
+ if (key.empty()) {
+ LOG(ERROR) << "NotifyNotificationEvent failed: Wrong parameter";
+ return false;
+ }
+ return ipc_channel_->Send(
+ new ArcInstanceMsg_NotifyNotificationEvent(key, event));
+}
+
void ArcBridgeService::SocketConnect(const base::FilePath& socket_path) {
DCHECK(origin_task_runner_->RunsTasksOnCurrentThread());
if (state_ != State::STOPPED) {
@@ -240,6 +255,19 @@ void ArcBridgeService::OnInstanceReady() {
SetState(State::READY);
}
+void ArcBridgeService::OnNotificationPosted(
+ const arc::ArcNotificationData& data) {
+ DCHECK(origin_task_runner_->RunsTasksOnCurrentThread());
+ FOR_EACH_OBSERVER(Observer, observer_list_,
+ OnNotificationPostedFromAndroid(data));
+}
+
+void ArcBridgeService::OnNotificationRemoved(const std::string& key) {
+ DCHECK(origin_task_runner_->RunsTasksOnCurrentThread());
+ FOR_EACH_OBSERVER(Observer, observer_list_,
+ OnNotificationRemovedFromAndroid(key));
+}
+
void ArcBridgeService::SetState(State state) {
DCHECK(origin_task_runner_->RunsTasksOnCurrentThread());
// DCHECK on enum classes not supported.
@@ -254,6 +282,10 @@ bool ArcBridgeService::OnMessageReceived(const IPC::Message& message) {
IPC_BEGIN_MESSAGE_MAP(ArcBridgeService, message)
IPC_MESSAGE_HANDLER(ArcInstanceHostMsg_InstanceReady, OnInstanceReady)
+ IPC_MESSAGE_HANDLER(ArcInstanceHostMsg_NotificationPosted,
+ OnNotificationPosted)
+ IPC_MESSAGE_HANDLER(ArcInstanceHostMsg_NotificationRemoved,
+ OnNotificationRemoved)
IPC_MESSAGE_UNHANDLED(handled = false)
IPC_END_MESSAGE_MAP()

Powered by Google App Engine
This is Rietveld 408576698