| 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 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 63 if (audio_instance()) | 63 if (audio_instance()) |
| 64 observer->OnAudioInstanceReady(); | 64 observer->OnAudioInstanceReady(); |
| 65 if (auth_instance()) | 65 if (auth_instance()) |
| 66 observer->OnAuthInstanceReady(); | 66 observer->OnAuthInstanceReady(); |
| 67 if (bluetooth_instance()) | 67 if (bluetooth_instance()) |
| 68 observer->OnBluetoothInstanceReady(); | 68 observer->OnBluetoothInstanceReady(); |
| 69 if (clipboard_instance()) | 69 if (clipboard_instance()) |
| 70 observer->OnClipboardInstanceReady(); | 70 observer->OnClipboardInstanceReady(); |
| 71 if (crash_collector_instance()) | 71 if (crash_collector_instance()) |
| 72 observer->OnCrashCollectorInstanceReady(); | 72 observer->OnCrashCollectorInstanceReady(); |
| 73 if (file_system_instance()) |
| 74 observer->OnFileSystemInstanceReady(); |
| 73 if (ime_instance()) | 75 if (ime_instance()) |
| 74 observer->OnImeInstanceReady(); | 76 observer->OnImeInstanceReady(); |
| 75 if (metrics_instance()) | 77 if (metrics_instance()) |
| 76 observer->OnMetricsInstanceReady(); | 78 observer->OnMetricsInstanceReady(); |
| 77 if (net_instance()) | 79 if (net_instance()) |
| 78 observer->OnNetInstanceReady(); | 80 observer->OnNetInstanceReady(); |
| 79 if (notifications_instance()) | 81 if (notifications_instance()) |
| 80 observer->OnNotificationsInstanceReady(); | 82 observer->OnNotificationsInstanceReady(); |
| 81 if (policy_instance()) | 83 if (policy_instance()) |
| 82 observer->OnPolicyInstanceReady(); | 84 observer->OnPolicyInstanceReady(); |
| (...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 239 void ArcBridgeService::CloseCrashCollectorChannel() { | 241 void ArcBridgeService::CloseCrashCollectorChannel() { |
| 240 DCHECK(CalledOnValidThread()); | 242 DCHECK(CalledOnValidThread()); |
| 241 if (!crash_collector_ptr_) | 243 if (!crash_collector_ptr_) |
| 242 return; | 244 return; |
| 243 | 245 |
| 244 crash_collector_ptr_.reset(); | 246 crash_collector_ptr_.reset(); |
| 245 FOR_EACH_OBSERVER(Observer, observer_list(), | 247 FOR_EACH_OBSERVER(Observer, observer_list(), |
| 246 OnCrashCollectorInstanceClosed()); | 248 OnCrashCollectorInstanceClosed()); |
| 247 } | 249 } |
| 248 | 250 |
| 251 void ArcBridgeService::OnFileSystemInstanceReady( |
| 252 mojom::FileSystemInstancePtr file_system_ptr) { |
| 253 DCHECK(CalledOnValidThread()); |
| 254 temporary_file_system_ptr_ = std::move(file_system_ptr); |
| 255 temporary_file_system_ptr_.QueryVersion( |
| 256 base::Bind(&ArcBridgeService::OnFileSystemVersionReady, |
| 257 weak_factory_.GetWeakPtr())); |
| 258 } |
| 259 |
| 260 void ArcBridgeService::OnFileSystemVersionReady(int32_t version) { |
| 261 DCHECK(CalledOnValidThread()); |
| 262 file_system_ptr_ = std::move(temporary_file_system_ptr_); |
| 263 file_system_ptr_.set_connection_error_handler( |
| 264 base::Bind(&ArcBridgeService::CloseFileSystemChannel, |
| 265 weak_factory_.GetWeakPtr())); |
| 266 FOR_EACH_OBSERVER(Observer, observer_list(), OnFileSystemInstanceReady()); |
| 267 } |
| 268 |
| 269 void ArcBridgeService::CloseFileSystemChannel() { |
| 270 DCHECK(CalledOnValidThread()); |
| 271 if (!file_system_ptr_) |
| 272 return; |
| 273 |
| 274 file_system_ptr_.reset(); |
| 275 FOR_EACH_OBSERVER(Observer, observer_list(), |
| 276 OnFileSystemInstanceClosed()); |
| 277 } |
| 278 |
| 249 void ArcBridgeService::OnImeInstanceReady(mojom::ImeInstancePtr ime_ptr) { | 279 void ArcBridgeService::OnImeInstanceReady(mojom::ImeInstancePtr ime_ptr) { |
| 250 DCHECK(CalledOnValidThread()); | 280 DCHECK(CalledOnValidThread()); |
| 251 temporary_ime_ptr_ = std::move(ime_ptr); | 281 temporary_ime_ptr_ = std::move(ime_ptr); |
| 252 temporary_ime_ptr_.QueryVersion(base::Bind( | 282 temporary_ime_ptr_.QueryVersion(base::Bind( |
| 253 &ArcBridgeService::OnImeVersionReady, weak_factory_.GetWeakPtr())); | 283 &ArcBridgeService::OnImeVersionReady, weak_factory_.GetWeakPtr())); |
| 254 } | 284 } |
| 255 | 285 |
| 256 void ArcBridgeService::OnImeVersionReady(int32_t version) { | 286 void ArcBridgeService::OnImeVersionReady(int32_t version) { |
| 257 DCHECK(CalledOnValidThread()); | 287 DCHECK(CalledOnValidThread()); |
| 258 ime_ptr_ = std::move(temporary_ime_ptr_); | 288 ime_ptr_ = std::move(temporary_ime_ptr_); |
| (...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 547 | 577 |
| 548 void ArcBridgeService::CloseAllChannels() { | 578 void ArcBridgeService::CloseAllChannels() { |
| 549 // Call all the error handlers of all the channels to both close the channel | 579 // Call all the error handlers of all the channels to both close the channel |
| 550 // and notify any observers that the channel is closed. | 580 // and notify any observers that the channel is closed. |
| 551 CloseAppChannel(); | 581 CloseAppChannel(); |
| 552 CloseAudioChannel(); | 582 CloseAudioChannel(); |
| 553 CloseAuthChannel(); | 583 CloseAuthChannel(); |
| 554 CloseBluetoothChannel(); | 584 CloseBluetoothChannel(); |
| 555 CloseClipboardChannel(); | 585 CloseClipboardChannel(); |
| 556 CloseCrashCollectorChannel(); | 586 CloseCrashCollectorChannel(); |
| 587 CloseFileSystemChannel(); |
| 557 CloseImeChannel(); | 588 CloseImeChannel(); |
| 558 CloseIntentHelperChannel(); | 589 CloseIntentHelperChannel(); |
| 559 CloseMetricsChannel(); | 590 CloseMetricsChannel(); |
| 560 CloseNetChannel(); | 591 CloseNetChannel(); |
| 561 CloseNotificationsChannel(); | 592 CloseNotificationsChannel(); |
| 562 ClosePolicyChannel(); | 593 ClosePolicyChannel(); |
| 563 ClosePowerChannel(); | 594 ClosePowerChannel(); |
| 564 CloseProcessChannel(); | 595 CloseProcessChannel(); |
| 565 CloseStorageManagerChannel(); | 596 CloseStorageManagerChannel(); |
| 566 CloseVideoChannel(); | 597 CloseVideoChannel(); |
| 567 CloseWindowManagerChannel(); | 598 CloseWindowManagerChannel(); |
| 568 } | 599 } |
| 569 | 600 |
| 570 } // namespace arc | 601 } // namespace arc |
| OLD | NEW |