OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "components/arc/arc_bridge_service_impl.h" | 5 #include "components/arc/arc_bridge_service_impl.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/files/file_path.h" | 8 #include "base/files/file_path.h" |
9 #include "base/files/file_util.h" | 9 #include "base/files/file_util.h" |
10 #include "base/prefs/pref_registry_simple.h" | 10 #include "base/prefs/pref_registry_simple.h" |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
98 | 98 |
99 bool ArcBridgeServiceImpl::RegisterInputDevice(const std::string& name, | 99 bool ArcBridgeServiceImpl::RegisterInputDevice(const std::string& name, |
100 const std::string& device_type, | 100 const std::string& device_type, |
101 base::ScopedFD fd) { | 101 base::ScopedFD fd) { |
102 DCHECK(origin_task_runner()->RunsTasksOnCurrentThread()); | 102 DCHECK(origin_task_runner()->RunsTasksOnCurrentThread()); |
103 if (state() != State::READY) { | 103 if (state() != State::READY) { |
104 LOG(ERROR) << "Called RegisterInputDevice when the service is not ready"; | 104 LOG(ERROR) << "Called RegisterInputDevice when the service is not ready"; |
105 return false; | 105 return false; |
106 } | 106 } |
107 return ipc_channel_->Send(new ArcInstanceMsg_RegisterInputDevice( | 107 return ipc_channel_->Send(new ArcInstanceMsg_RegisterInputDevice( |
108 name, device_type, base::FileDescriptor(fd.Pass()))); | 108 name, device_type, base::FileDescriptor(fd.release(), true))); |
109 } | 109 } |
110 | 110 |
111 bool ArcBridgeServiceImpl::SendNotificationEventToAndroid( | 111 bool ArcBridgeServiceImpl::SendNotificationEventToAndroid( |
112 const std::string& key, ArcNotificationEvent event) { | 112 const std::string& key, ArcNotificationEvent event) { |
113 DCHECK(ipc_task_runner_->RunsTasksOnCurrentThread()); | 113 DCHECK(ipc_task_runner_->RunsTasksOnCurrentThread()); |
114 if (key.empty()) { | 114 if (key.empty()) { |
115 LOG(ERROR) << "SendNotificationToAndroid failed: Wrong parameter"; | 115 LOG(ERROR) << "SendNotificationToAndroid failed: Wrong parameter"; |
116 return false; | 116 return false; |
117 } | 117 } |
118 if (state() != State::READY) { | 118 if (state() != State::READY) { |
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
330 void ArcBridgeServiceImpl::OnInstanceStopped(bool success) { | 330 void ArcBridgeServiceImpl::OnInstanceStopped(bool success) { |
331 DCHECK(origin_task_runner()->RunsTasksOnCurrentThread()); | 331 DCHECK(origin_task_runner()->RunsTasksOnCurrentThread()); |
332 // STOPPING is the only valid state for this function. | 332 // STOPPING is the only valid state for this function. |
333 // DCHECK on enum classes not supported. | 333 // DCHECK on enum classes not supported. |
334 DCHECK(state() == State::STOPPING); | 334 DCHECK(state() == State::STOPPING); |
335 ipc_channel_.reset(); | 335 ipc_channel_.reset(); |
336 SetState(State::STOPPED); | 336 SetState(State::STOPPED); |
337 } | 337 } |
338 | 338 |
339 } // namespace arc | 339 } // namespace arc |
OLD | NEW |