| 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.h" | 5 #include "components/arc/arc_bridge_service.h" |
| 6 | 6 |
| 7 #include "base/files/file_path.h" | 7 #include "base/files/file_path.h" |
| 8 #include "base/files/file_util.h" | 8 #include "base/files/file_util.h" |
| 9 #include "base/prefs/pref_registry_simple.h" | 9 #include "base/prefs/pref_registry_simple.h" |
| 10 #include "base/prefs/pref_service.h" | 10 #include "base/prefs/pref_service.h" |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 118 SetState(State::STOPPING); | 118 SetState(State::STOPPING); |
| 119 chromeos::SessionManagerClient* session_manager_client = | 119 chromeos::SessionManagerClient* session_manager_client = |
| 120 chromeos::DBusThreadManager::Get()->GetSessionManagerClient(); | 120 chromeos::DBusThreadManager::Get()->GetSessionManagerClient(); |
| 121 session_manager_client->StopArcInstance(base::Bind( | 121 session_manager_client->StopArcInstance(base::Bind( |
| 122 &ArcBridgeService::OnInstanceStopped, weak_factory_.GetWeakPtr())); | 122 &ArcBridgeService::OnInstanceStopped, weak_factory_.GetWeakPtr())); |
| 123 } | 123 } |
| 124 | 124 |
| 125 bool ArcBridgeService::RegisterInputDevice(const std::string& name, | 125 bool ArcBridgeService::RegisterInputDevice(const std::string& name, |
| 126 const std::string& device_type, | 126 const std::string& device_type, |
| 127 base::ScopedFD fd) { | 127 base::ScopedFD fd) { |
| 128 DCHECK(ipc_task_runner_->RunsTasksOnCurrentThread()); | 128 DCHECK(origin_task_runner_->RunsTasksOnCurrentThread()); |
| 129 if (state_ != State::READY) { | 129 if (state_ != State::READY) { |
| 130 LOG(ERROR) << "Called RegisterInputDevice when the service is not ready"; | 130 LOG(ERROR) << "Called RegisterInputDevice when the service is not ready"; |
| 131 return false; | 131 return false; |
| 132 } | 132 } |
| 133 return ipc_channel_->Send(new ArcInstanceMsg_RegisterInputDevice( | 133 return ipc_channel_->Send(new ArcInstanceMsg_RegisterInputDevice( |
| 134 name, device_type, base::FileDescriptor(fd.Pass()))); | 134 name, device_type, base::FileDescriptor(fd.Pass()))); |
| 135 } | 135 } |
| 136 | 136 |
| 137 void ArcBridgeService::SocketConnect(const base::FilePath& socket_path) { | 137 void ArcBridgeService::SocketConnect(const base::FilePath& socket_path) { |
| 138 DCHECK(origin_task_runner_->RunsTasksOnCurrentThread()); | 138 DCHECK(origin_task_runner_->RunsTasksOnCurrentThread()); |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 274 void ArcBridgeService::OnInstanceStopped(bool success) { | 274 void ArcBridgeService::OnInstanceStopped(bool success) { |
| 275 DCHECK(origin_task_runner_->RunsTasksOnCurrentThread()); | 275 DCHECK(origin_task_runner_->RunsTasksOnCurrentThread()); |
| 276 // STOPPING is the only valid state for this function. | 276 // STOPPING is the only valid state for this function. |
| 277 // DCHECK on enum classes not supported. | 277 // DCHECK on enum classes not supported. |
| 278 DCHECK(state_ == State::STOPPING); | 278 DCHECK(state_ == State::STOPPING); |
| 279 ipc_channel_.reset(); | 279 ipc_channel_.reset(); |
| 280 SetState(State::STOPPED); | 280 SetState(State::STOPPED); |
| 281 } | 281 } |
| 282 | 282 |
| 283 } // namespace arc | 283 } // namespace arc |
| OLD | NEW |