| 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 <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/sequenced_task_runner.h" | 10 #include "base/sequenced_task_runner.h" |
| (...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 271 | 271 |
| 272 void ArcBridgeService::CloseProcessChannel() { | 272 void ArcBridgeService::CloseProcessChannel() { |
| 273 DCHECK(CalledOnValidThread()); | 273 DCHECK(CalledOnValidThread()); |
| 274 if (!process_ptr_) | 274 if (!process_ptr_) |
| 275 return; | 275 return; |
| 276 | 276 |
| 277 process_ptr_.reset(); | 277 process_ptr_.reset(); |
| 278 FOR_EACH_OBSERVER(Observer, observer_list(), OnProcessInstanceClosed()); | 278 FOR_EACH_OBSERVER(Observer, observer_list(), OnProcessInstanceClosed()); |
| 279 } | 279 } |
| 280 | 280 |
| 281 void ArcBridgeService::OnSettingsInstanceReady( | |
| 282 SettingsInstancePtr settings_ptr) { | |
| 283 DCHECK(CalledOnValidThread()); | |
| 284 temporary_settings_ptr_ = std::move(settings_ptr); | |
| 285 temporary_settings_ptr_.QueryVersion(base::Bind( | |
| 286 &ArcBridgeService::OnSettingsVersionReady, weak_factory_.GetWeakPtr())); | |
| 287 } | |
| 288 | |
| 289 void ArcBridgeService::OnSettingsVersionReady(int32_t version) { | |
| 290 DCHECK(CalledOnValidThread()); | |
| 291 settings_ptr_ = std::move(temporary_settings_ptr_); | |
| 292 settings_ptr_.set_connection_error_handler(base::Bind( | |
| 293 &ArcBridgeService::CloseSettingsChannel, weak_factory_.GetWeakPtr())); | |
| 294 FOR_EACH_OBSERVER(Observer, observer_list(), OnSettingsInstanceReady()); | |
| 295 } | |
| 296 | |
| 297 void ArcBridgeService::CloseSettingsChannel() { | |
| 298 DCHECK(CalledOnValidThread()); | |
| 299 if (!settings_ptr_) | |
| 300 return; | |
| 301 | |
| 302 settings_ptr_.reset(); | |
| 303 FOR_EACH_OBSERVER(Observer, observer_list(), OnSettingsInstanceClosed()); | |
| 304 } | |
| 305 | |
| 306 void ArcBridgeService::OnVideoInstanceReady(VideoInstancePtr video_ptr) { | 281 void ArcBridgeService::OnVideoInstanceReady(VideoInstancePtr video_ptr) { |
| 307 DCHECK(CalledOnValidThread()); | 282 DCHECK(CalledOnValidThread()); |
| 308 temporary_video_ptr_ = std::move(video_ptr); | 283 temporary_video_ptr_ = std::move(video_ptr); |
| 309 temporary_video_ptr_.QueryVersion(base::Bind( | 284 temporary_video_ptr_.QueryVersion(base::Bind( |
| 310 &ArcBridgeService::OnVideoVersionReady, weak_factory_.GetWeakPtr())); | 285 &ArcBridgeService::OnVideoVersionReady, weak_factory_.GetWeakPtr())); |
| 311 } | 286 } |
| 312 | 287 |
| 313 void ArcBridgeService::OnVideoVersionReady(int32_t version) { | 288 void ArcBridgeService::OnVideoVersionReady(int32_t version) { |
| 314 DCHECK(CalledOnValidThread()); | 289 DCHECK(CalledOnValidThread()); |
| 315 video_ptr_ = std::move(temporary_video_ptr_); | 290 video_ptr_ = std::move(temporary_video_ptr_); |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 351 // and notify any observers that the channel is closed. | 326 // and notify any observers that the channel is closed. |
| 352 CloseAppChannel(); | 327 CloseAppChannel(); |
| 353 CloseAuthChannel(); | 328 CloseAuthChannel(); |
| 354 CloseClipboardChannel(); | 329 CloseClipboardChannel(); |
| 355 CloseImeChannel(); | 330 CloseImeChannel(); |
| 356 CloseInputChannel(); | 331 CloseInputChannel(); |
| 357 CloseIntentHelperChannel(); | 332 CloseIntentHelperChannel(); |
| 358 CloseNotificationsChannel(); | 333 CloseNotificationsChannel(); |
| 359 ClosePowerChannel(); | 334 ClosePowerChannel(); |
| 360 CloseProcessChannel(); | 335 CloseProcessChannel(); |
| 361 CloseSettingsChannel(); | |
| 362 CloseVideoChannel(); | 336 CloseVideoChannel(); |
| 363 } | 337 } |
| 364 | 338 |
| 365 } // namespace arc | 339 } // namespace arc |
| OLD | NEW |