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..872b687097a6c9fddd5ecca7afeaff8d6d620e96 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, |
| + NotificationEvent event) { |
| + DCHECK(ipc_task_runner_->RunsTasksOnCurrentThread()); |
| + if (state_ != State::READY) { |
| + LOG(ERROR) << "Called RegisterInputDevice when the service is not ready"; |
| + 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,17 @@ void ArcBridgeService::OnInstanceReady() { |
| SetState(State::READY); |
| } |
| +void ArcBridgeService::OnNotificationPosted( |
| + const arc::ArcNotificationData& data) { |
| + FOR_EACH_OBSERVER(Observer, observer_list_, |
|
khmel1
2015/11/25 00:30:10
DCHECK(origin_task_runner_->RunsTasksOnCurrentThre
yoshiki
2015/11/25 09:40:35
Done.
|
| + OnNotificationPostedFromAndroid(data)); |
| +} |
| + |
| +void ArcBridgeService::OnNotificationRemoved(const std::string& key) { |
| + 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 +280,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() |