Chromium Code Reviews| 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() |