| 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 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 71 if (crash_collector_instance()) | 71 if (crash_collector_instance()) |
| 72 observer->OnCrashCollectorInstanceReady(); | 72 observer->OnCrashCollectorInstanceReady(); |
| 73 if (ime_instance()) | 73 if (ime_instance()) |
| 74 observer->OnImeInstanceReady(); | 74 observer->OnImeInstanceReady(); |
| 75 if (metrics_instance()) | 75 if (metrics_instance()) |
| 76 observer->OnMetricsInstanceReady(); | 76 observer->OnMetricsInstanceReady(); |
| 77 if (net_instance()) | 77 if (net_instance()) |
| 78 observer->OnNetInstanceReady(); | 78 observer->OnNetInstanceReady(); |
| 79 if (notifications_instance()) | 79 if (notifications_instance()) |
| 80 observer->OnNotificationsInstanceReady(); | 80 observer->OnNotificationsInstanceReady(); |
| 81 if (obb_mounter_instance()) |
| 82 observer->OnObbMounterInstanceReady(); |
| 81 if (policy_instance()) | 83 if (policy_instance()) |
| 82 observer->OnPolicyInstanceReady(); | 84 observer->OnPolicyInstanceReady(); |
| 83 if (power_instance()) | 85 if (power_instance()) |
| 84 observer->OnPowerInstanceReady(); | 86 observer->OnPowerInstanceReady(); |
| 85 if (process_instance()) | 87 if (process_instance()) |
| 86 observer->OnProcessInstanceReady(); | 88 observer->OnProcessInstanceReady(); |
| 87 if (storage_manager_instance()) | 89 if (storage_manager_instance()) |
| 88 observer->OnStorageManagerInstanceReady(); | 90 observer->OnStorageManagerInstanceReady(); |
| 89 if (video_instance()) | 91 if (video_instance()) |
| 90 observer->OnVideoInstanceReady(); | 92 observer->OnVideoInstanceReady(); |
| (...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 365 | 367 |
| 366 void ArcBridgeService::CloseNotificationsChannel() { | 368 void ArcBridgeService::CloseNotificationsChannel() { |
| 367 DCHECK(CalledOnValidThread()); | 369 DCHECK(CalledOnValidThread()); |
| 368 if (!notifications_ptr_) | 370 if (!notifications_ptr_) |
| 369 return; | 371 return; |
| 370 | 372 |
| 371 notifications_ptr_.reset(); | 373 notifications_ptr_.reset(); |
| 372 FOR_EACH_OBSERVER(Observer, observer_list(), OnNotificationsInstanceClosed()); | 374 FOR_EACH_OBSERVER(Observer, observer_list(), OnNotificationsInstanceClosed()); |
| 373 } | 375 } |
| 374 | 376 |
| 377 void ArcBridgeService::OnObbMounterInstanceReady( |
| 378 mojom::ObbMounterInstancePtr obb_mounter_ptr) { |
| 379 DCHECK(CalledOnValidThread()); |
| 380 temporary_obb_mounter_ptr_ = std::move(obb_mounter_ptr); |
| 381 temporary_obb_mounter_ptr_.QueryVersion(base::Bind( |
| 382 &ArcBridgeService::OnObbMounterVersionReady, |
| 383 weak_factory_.GetWeakPtr())); |
| 384 } |
| 385 |
| 386 void ArcBridgeService::OnObbMounterVersionReady(int32_t version) { |
| 387 DCHECK(CalledOnValidThread()); |
| 388 obb_mounter_ptr_ = std::move(temporary_obb_mounter_ptr_); |
| 389 obb_mounter_ptr_.set_connection_error_handler(base::Bind( |
| 390 &ArcBridgeService::CloseObbMounterChannel, |
| 391 weak_factory_.GetWeakPtr())); |
| 392 FOR_EACH_OBSERVER(Observer, observer_list(), OnObbMounterInstanceReady()); |
| 393 } |
| 394 |
| 395 void ArcBridgeService::CloseObbMounterChannel() { |
| 396 if (!obb_mounter_ptr_) |
| 397 return; |
| 398 |
| 399 obb_mounter_ptr_.reset(); |
| 400 FOR_EACH_OBSERVER(Observer, observer_list(), OnObbMounterInstanceClosed()); |
| 401 } |
| 402 |
| 375 void ArcBridgeService::OnPolicyInstanceReady( | 403 void ArcBridgeService::OnPolicyInstanceReady( |
| 376 mojom::PolicyInstancePtr policy_ptr) { | 404 mojom::PolicyInstancePtr policy_ptr) { |
| 377 DCHECK(CalledOnValidThread()); | 405 DCHECK(CalledOnValidThread()); |
| 378 temporary_policy_ptr_ = std::move(policy_ptr); | 406 temporary_policy_ptr_ = std::move(policy_ptr); |
| 379 temporary_policy_ptr_.QueryVersion(base::Bind( | 407 temporary_policy_ptr_.QueryVersion(base::Bind( |
| 380 &ArcBridgeService::OnPolicyVersionReady, weak_factory_.GetWeakPtr())); | 408 &ArcBridgeService::OnPolicyVersionReady, weak_factory_.GetWeakPtr())); |
| 381 } | 409 } |
| 382 | 410 |
| 383 void ArcBridgeService::OnPolicyVersionReady(int32_t version) { | 411 void ArcBridgeService::OnPolicyVersionReady(int32_t version) { |
| 384 DCHECK(CalledOnValidThread()); | 412 DCHECK(CalledOnValidThread()); |
| (...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 552 CloseAudioChannel(); | 580 CloseAudioChannel(); |
| 553 CloseAuthChannel(); | 581 CloseAuthChannel(); |
| 554 CloseBluetoothChannel(); | 582 CloseBluetoothChannel(); |
| 555 CloseClipboardChannel(); | 583 CloseClipboardChannel(); |
| 556 CloseCrashCollectorChannel(); | 584 CloseCrashCollectorChannel(); |
| 557 CloseImeChannel(); | 585 CloseImeChannel(); |
| 558 CloseIntentHelperChannel(); | 586 CloseIntentHelperChannel(); |
| 559 CloseMetricsChannel(); | 587 CloseMetricsChannel(); |
| 560 CloseNetChannel(); | 588 CloseNetChannel(); |
| 561 CloseNotificationsChannel(); | 589 CloseNotificationsChannel(); |
| 590 CloseObbMounterChannel(); |
| 562 ClosePolicyChannel(); | 591 ClosePolicyChannel(); |
| 563 ClosePowerChannel(); | 592 ClosePowerChannel(); |
| 564 CloseProcessChannel(); | 593 CloseProcessChannel(); |
| 565 CloseStorageManagerChannel(); | 594 CloseStorageManagerChannel(); |
| 566 CloseVideoChannel(); | 595 CloseVideoChannel(); |
| 567 CloseWindowManagerChannel(); | 596 CloseWindowManagerChannel(); |
| 568 } | 597 } |
| 569 | 598 |
| 570 } // namespace arc | 599 } // namespace arc |
| OLD | NEW |