Chromium Code Reviews| 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 <string> | 7 #include <string> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| 11 #include "base/json/json_writer.h" | 11 #include "base/json/json_writer.h" |
| 12 #include "base/prefs/pref_registry_simple.h" | 12 #include "base/prefs/pref_registry_simple.h" |
| 13 #include "base/prefs/pref_service.h" | 13 #include "base/prefs/pref_service.h" |
| 14 #include "base/sequenced_task_runner.h" | 14 #include "base/sequenced_task_runner.h" |
| 15 #include "base/sys_info.h" | 15 #include "base/sys_info.h" |
| 16 #include "base/task_runner_util.h" | 16 #include "base/task_runner_util.h" |
| 17 #include "base/thread_task_runner_handle.h" | 17 #include "base/thread_task_runner_handle.h" |
| 18 #include "chromeos/chromeos_switches.h" | 18 #include "chromeos/chromeos_switches.h" |
| 19 #include "chromeos/dbus/dbus_method_call_status.h" | 19 #include "chromeos/dbus/dbus_method_call_status.h" |
| 20 #include "chromeos/dbus/dbus_thread_manager.h" | 20 #include "chromeos/dbus/dbus_thread_manager.h" |
| 21 #include "chromeos/dbus/session_manager_client.h" | 21 #include "chromeos/dbus/session_manager_client.h" |
| 22 #include "ipc/ipc_channel_handle.h" | |
| 22 #include "mojo/public/cpp/bindings/array.h" | 23 #include "mojo/public/cpp/bindings/array.h" |
| 23 #include "third_party/mojo/src/mojo/edk/embedder/embedder.h" | 24 #include "third_party/mojo/src/mojo/edk/embedder/embedder.h" |
| 24 | 25 |
| 25 namespace mojo { | 26 namespace mojo { |
| 26 | 27 |
| 27 template <> | 28 template <> |
| 28 struct TypeConverter<arc::AppInfo, arc::AppInfoPtr> { | 29 struct TypeConverter<arc::AppInfo, arc::AppInfoPtr> { |
| 29 static arc::AppInfo Convert(const arc::AppInfoPtr& app_info_ptr) { | 30 static arc::AppInfo Convert(const arc::AppInfoPtr& app_info_ptr) { |
| 30 return *app_info_ptr; | 31 return *app_info_ptr; |
| 31 } | 32 } |
| (...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 195 DCHECK(CalledOnValidThread()); | 196 DCHECK(CalledOnValidThread()); |
| 196 if (state() != State::READY) { | 197 if (state() != State::READY) { |
| 197 LOG_IF(ERROR, base::SysInfo::IsRunningOnChromeOS()) | 198 LOG_IF(ERROR, base::SysInfo::IsRunningOnChromeOS()) |
| 198 << "Called RequestProcessList when the service is not ready"; | 199 << "Called RequestProcessList when the service is not ready"; |
| 199 return false; | 200 return false; |
| 200 } | 201 } |
| 201 instance_ptr_->RequestProcessList(); | 202 instance_ptr_->RequestProcessList(); |
| 202 return true; | 203 return true; |
| 203 } | 204 } |
| 204 | 205 |
| 206 // TODO(kcwu) move this to ArcBridgeService after rebased arc_bridge | |
| 207 // refactoring. | |
|
Luis Héctor Chávez
2015/12/23 00:02:53
This is done.
kcwu
2015/12/23 01:05:23
Done.
| |
| 208 void ArcBridgeServiceImpl::OnVideoInstanceReady(VideoInstancePtr video_ptr) { | |
| 209 DCHECK(CalledOnValidThread()); | |
| 210 video_ptr_ = std::move(video_ptr); | |
| 211 FOR_EACH_OBSERVER(Observer, observer_list(), OnVideoInstanceReady()); | |
| 212 } | |
| 213 | |
| 205 void ArcBridgeServiceImpl::OnInstanceBootPhase(InstanceBootPhase phase) { | 214 void ArcBridgeServiceImpl::OnInstanceBootPhase(InstanceBootPhase phase) { |
| 206 DCHECK(CalledOnValidThread()); | 215 DCHECK(CalledOnValidThread()); |
| 207 // The state can be CONNECTED the first time this is called, and will then | 216 // The state can be CONNECTED the first time this is called, and will then |
| 208 // transition to READY after BRIDGE_READY has been passed. | 217 // transition to READY after BRIDGE_READY has been passed. |
| 209 if (state() != State::CONNECTED && state() != State::READY) { | 218 if (state() != State::CONNECTED && state() != State::READY) { |
| 210 VLOG(1) << "StopInstance() called while connecting"; | 219 VLOG(1) << "StopInstance() called while connecting"; |
| 211 return; | 220 return; |
| 212 } | 221 } |
| 213 if (phase == INSTANCE_BOOT_PHASE_BRIDGE_READY) { | 222 if (phase == INSTANCE_BOOT_PHASE_BRIDGE_READY) { |
| 214 SetState(State::READY); | 223 SetState(State::READY); |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 292 | 301 |
| 293 SetState(State::CONNECTED); | 302 SetState(State::CONNECTED); |
| 294 } | 303 } |
| 295 | 304 |
| 296 void ArcBridgeServiceImpl::OnStopped() { | 305 void ArcBridgeServiceImpl::OnStopped() { |
| 297 DCHECK(CalledOnValidThread()); | 306 DCHECK(CalledOnValidThread()); |
| 298 SetState(State::STOPPED); | 307 SetState(State::STOPPED); |
| 299 } | 308 } |
| 300 | 309 |
| 301 } // namespace arc | 310 } // namespace arc |
| OLD | NEW |