| 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 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 78 if (net_instance()) | 78 if (net_instance()) |
| 79 observer->OnNetInstanceReady(); | 79 observer->OnNetInstanceReady(); |
| 80 if (notifications_instance()) | 80 if (notifications_instance()) |
| 81 observer->OnNotificationsInstanceReady(); | 81 observer->OnNotificationsInstanceReady(); |
| 82 if (obb_mounter_instance()) | 82 if (obb_mounter_instance()) |
| 83 observer->OnObbMounterInstanceReady(); | 83 observer->OnObbMounterInstanceReady(); |
| 84 if (policy_instance()) | 84 if (policy_instance()) |
| 85 observer->OnPolicyInstanceReady(); | 85 observer->OnPolicyInstanceReady(); |
| 86 if (power_instance()) | 86 if (power_instance()) |
| 87 observer->OnPowerInstanceReady(); | 87 observer->OnPowerInstanceReady(); |
| 88 if (print_instance()) |
| 89 observer->OnPrintInstanceReady(); |
| 88 if (process_instance()) | 90 if (process_instance()) |
| 89 observer->OnProcessInstanceReady(); | 91 observer->OnProcessInstanceReady(); |
| 90 if (storage_manager_instance()) | 92 if (storage_manager_instance()) |
| 91 observer->OnStorageManagerInstanceReady(); | 93 observer->OnStorageManagerInstanceReady(); |
| 92 if (video_instance()) | 94 if (video_instance()) |
| 93 observer->OnVideoInstanceReady(); | 95 observer->OnVideoInstanceReady(); |
| 94 if (window_manager_instance()) | 96 if (window_manager_instance()) |
| 95 observer->OnWindowManagerInstanceReady(); | 97 observer->OnWindowManagerInstanceReady(); |
| 96 } | 98 } |
| 97 | 99 |
| (...skipping 373 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 471 | 473 |
| 472 void ArcBridgeService::ClosePowerChannel() { | 474 void ArcBridgeService::ClosePowerChannel() { |
| 473 DCHECK(CalledOnValidThread()); | 475 DCHECK(CalledOnValidThread()); |
| 474 if (!power_ptr_) | 476 if (!power_ptr_) |
| 475 return; | 477 return; |
| 476 | 478 |
| 477 power_ptr_.reset(); | 479 power_ptr_.reset(); |
| 478 FOR_EACH_OBSERVER(Observer, observer_list(), OnPowerInstanceClosed()); | 480 FOR_EACH_OBSERVER(Observer, observer_list(), OnPowerInstanceClosed()); |
| 479 } | 481 } |
| 480 | 482 |
| 483 void ArcBridgeService::OnPrintInstanceReady(mojom::PrintInstancePtr print_ptr) { |
| 484 DCHECK(CalledOnValidThread()); |
| 485 temporary_print_ptr_ = std::move(print_ptr); |
| 486 temporary_print_ptr_.QueryVersion(base::Bind( |
| 487 &ArcBridgeService::OnPrintVersionReady, weak_factory_.GetWeakPtr())); |
| 488 } |
| 489 |
| 490 void ArcBridgeService::OnPrintVersionReady(uint32_t version) { |
| 491 DCHECK(CalledOnValidThread()); |
| 492 print_ptr_ = std::move(temporary_print_ptr_); |
| 493 print_ptr_.set_connection_error_handler(base::Bind( |
| 494 &ArcBridgeService::ClosePrintChannel, weak_factory_.GetWeakPtr())); |
| 495 FOR_EACH_OBSERVER(Observer, observer_list(), OnPrintInstanceReady()); |
| 496 } |
| 497 |
| 498 void ArcBridgeService::ClosePrintChannel() { |
| 499 DCHECK(CalledOnValidThread()); |
| 500 if (!print_ptr_) |
| 501 return; |
| 502 |
| 503 print_ptr_.reset(); |
| 504 FOR_EACH_OBSERVER(Observer, observer_list(), OnPrintInstanceClosed()); |
| 505 } |
| 506 |
| 481 void ArcBridgeService::OnProcessInstanceReady( | 507 void ArcBridgeService::OnProcessInstanceReady( |
| 482 mojom::ProcessInstancePtr process_ptr) { | 508 mojom::ProcessInstancePtr process_ptr) { |
| 483 DCHECK(CalledOnValidThread()); | 509 DCHECK(CalledOnValidThread()); |
| 484 temporary_process_ptr_ = std::move(process_ptr); | 510 temporary_process_ptr_ = std::move(process_ptr); |
| 485 temporary_process_ptr_.QueryVersion(base::Bind( | 511 temporary_process_ptr_.QueryVersion(base::Bind( |
| 486 &ArcBridgeService::OnProcessVersionReady, weak_factory_.GetWeakPtr())); | 512 &ArcBridgeService::OnProcessVersionReady, weak_factory_.GetWeakPtr())); |
| 487 } | 513 } |
| 488 | 514 |
| 489 void ArcBridgeService::OnProcessVersionReady(uint32_t version) { | 515 void ArcBridgeService::OnProcessVersionReady(uint32_t version) { |
| 490 DCHECK(CalledOnValidThread()); | 516 DCHECK(CalledOnValidThread()); |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 617 CloseCrashCollectorChannel(); | 643 CloseCrashCollectorChannel(); |
| 618 CloseFileSystemChannel(); | 644 CloseFileSystemChannel(); |
| 619 CloseImeChannel(); | 645 CloseImeChannel(); |
| 620 CloseIntentHelperChannel(); | 646 CloseIntentHelperChannel(); |
| 621 CloseMetricsChannel(); | 647 CloseMetricsChannel(); |
| 622 CloseNetChannel(); | 648 CloseNetChannel(); |
| 623 CloseNotificationsChannel(); | 649 CloseNotificationsChannel(); |
| 624 CloseObbMounterChannel(); | 650 CloseObbMounterChannel(); |
| 625 ClosePolicyChannel(); | 651 ClosePolicyChannel(); |
| 626 ClosePowerChannel(); | 652 ClosePowerChannel(); |
| 653 ClosePrintChannel(); |
| 627 CloseProcessChannel(); | 654 CloseProcessChannel(); |
| 628 CloseStorageManagerChannel(); | 655 CloseStorageManagerChannel(); |
| 629 CloseVideoChannel(); | 656 CloseVideoChannel(); |
| 630 CloseWindowManagerChannel(); | 657 CloseWindowManagerChannel(); |
| 631 } | 658 } |
| 632 | 659 |
| 633 } // namespace arc | 660 } // namespace arc |
| OLD | NEW |