| 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 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 73 if (file_system_instance()) | 73 if (file_system_instance()) |
| 74 observer->OnFileSystemInstanceReady(); | 74 observer->OnFileSystemInstanceReady(); |
| 75 if (ime_instance()) | 75 if (ime_instance()) |
| 76 observer->OnImeInstanceReady(); | 76 observer->OnImeInstanceReady(); |
| 77 if (metrics_instance()) | 77 if (metrics_instance()) |
| 78 observer->OnMetricsInstanceReady(); | 78 observer->OnMetricsInstanceReady(); |
| 79 if (net_instance()) | 79 if (net_instance()) |
| 80 observer->OnNetInstanceReady(); | 80 observer->OnNetInstanceReady(); |
| 81 if (notifications_instance()) | 81 if (notifications_instance()) |
| 82 observer->OnNotificationsInstanceReady(); | 82 observer->OnNotificationsInstanceReady(); |
| 83 if (obb_mounter_instance()) |
| 84 observer->OnObbMounterInstanceReady(); |
| 83 if (policy_instance()) | 85 if (policy_instance()) |
| 84 observer->OnPolicyInstanceReady(); | 86 observer->OnPolicyInstanceReady(); |
| 85 if (power_instance()) | 87 if (power_instance()) |
| 86 observer->OnPowerInstanceReady(); | 88 observer->OnPowerInstanceReady(); |
| 87 if (process_instance()) | 89 if (process_instance()) |
| 88 observer->OnProcessInstanceReady(); | 90 observer->OnProcessInstanceReady(); |
| 89 if (storage_manager_instance()) | 91 if (storage_manager_instance()) |
| 90 observer->OnStorageManagerInstanceReady(); | 92 observer->OnStorageManagerInstanceReady(); |
| 91 if (video_instance()) | 93 if (video_instance()) |
| 92 observer->OnVideoInstanceReady(); | 94 observer->OnVideoInstanceReady(); |
| (...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 395 | 397 |
| 396 void ArcBridgeService::CloseNotificationsChannel() { | 398 void ArcBridgeService::CloseNotificationsChannel() { |
| 397 DCHECK(CalledOnValidThread()); | 399 DCHECK(CalledOnValidThread()); |
| 398 if (!notifications_ptr_) | 400 if (!notifications_ptr_) |
| 399 return; | 401 return; |
| 400 | 402 |
| 401 notifications_ptr_.reset(); | 403 notifications_ptr_.reset(); |
| 402 FOR_EACH_OBSERVER(Observer, observer_list(), OnNotificationsInstanceClosed()); | 404 FOR_EACH_OBSERVER(Observer, observer_list(), OnNotificationsInstanceClosed()); |
| 403 } | 405 } |
| 404 | 406 |
| 407 void ArcBridgeService::OnObbMounterInstanceReady( |
| 408 mojom::ObbMounterInstancePtr obb_mounter_ptr) { |
| 409 DCHECK(CalledOnValidThread()); |
| 410 temporary_obb_mounter_ptr_ = std::move(obb_mounter_ptr); |
| 411 temporary_obb_mounter_ptr_.QueryVersion(base::Bind( |
| 412 &ArcBridgeService::OnObbMounterVersionReady, |
| 413 weak_factory_.GetWeakPtr())); |
| 414 } |
| 415 |
| 416 void ArcBridgeService::OnObbMounterVersionReady(int32_t version) { |
| 417 DCHECK(CalledOnValidThread()); |
| 418 obb_mounter_ptr_ = std::move(temporary_obb_mounter_ptr_); |
| 419 obb_mounter_ptr_.set_connection_error_handler(base::Bind( |
| 420 &ArcBridgeService::CloseObbMounterChannel, |
| 421 weak_factory_.GetWeakPtr())); |
| 422 FOR_EACH_OBSERVER(Observer, observer_list(), OnObbMounterInstanceReady()); |
| 423 } |
| 424 |
| 425 void ArcBridgeService::CloseObbMounterChannel() { |
| 426 if (!obb_mounter_ptr_) |
| 427 return; |
| 428 |
| 429 obb_mounter_ptr_.reset(); |
| 430 FOR_EACH_OBSERVER(Observer, observer_list(), OnObbMounterInstanceClosed()); |
| 431 } |
| 432 |
| 405 void ArcBridgeService::OnPolicyInstanceReady( | 433 void ArcBridgeService::OnPolicyInstanceReady( |
| 406 mojom::PolicyInstancePtr policy_ptr) { | 434 mojom::PolicyInstancePtr policy_ptr) { |
| 407 DCHECK(CalledOnValidThread()); | 435 DCHECK(CalledOnValidThread()); |
| 408 temporary_policy_ptr_ = std::move(policy_ptr); | 436 temporary_policy_ptr_ = std::move(policy_ptr); |
| 409 temporary_policy_ptr_.QueryVersion(base::Bind( | 437 temporary_policy_ptr_.QueryVersion(base::Bind( |
| 410 &ArcBridgeService::OnPolicyVersionReady, weak_factory_.GetWeakPtr())); | 438 &ArcBridgeService::OnPolicyVersionReady, weak_factory_.GetWeakPtr())); |
| 411 } | 439 } |
| 412 | 440 |
| 413 void ArcBridgeService::OnPolicyVersionReady(int32_t version) { | 441 void ArcBridgeService::OnPolicyVersionReady(int32_t version) { |
| 414 DCHECK(CalledOnValidThread()); | 442 DCHECK(CalledOnValidThread()); |
| (...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 583 CloseAuthChannel(); | 611 CloseAuthChannel(); |
| 584 CloseBluetoothChannel(); | 612 CloseBluetoothChannel(); |
| 585 CloseClipboardChannel(); | 613 CloseClipboardChannel(); |
| 586 CloseCrashCollectorChannel(); | 614 CloseCrashCollectorChannel(); |
| 587 CloseFileSystemChannel(); | 615 CloseFileSystemChannel(); |
| 588 CloseImeChannel(); | 616 CloseImeChannel(); |
| 589 CloseIntentHelperChannel(); | 617 CloseIntentHelperChannel(); |
| 590 CloseMetricsChannel(); | 618 CloseMetricsChannel(); |
| 591 CloseNetChannel(); | 619 CloseNetChannel(); |
| 592 CloseNotificationsChannel(); | 620 CloseNotificationsChannel(); |
| 621 CloseObbMounterChannel(); |
| 593 ClosePolicyChannel(); | 622 ClosePolicyChannel(); |
| 594 ClosePowerChannel(); | 623 ClosePowerChannel(); |
| 595 CloseProcessChannel(); | 624 CloseProcessChannel(); |
| 596 CloseStorageManagerChannel(); | 625 CloseStorageManagerChannel(); |
| 597 CloseVideoChannel(); | 626 CloseVideoChannel(); |
| 598 CloseWindowManagerChannel(); | 627 CloseWindowManagerChannel(); |
| 599 } | 628 } |
| 600 | 629 |
| 601 } // namespace arc | 630 } // namespace arc |
| OLD | NEW |