Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(155)

Side by Side Diff: components/arc/arc_bridge_service.cc

Issue 2115863002: Stub for ARC print Bridge (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: arc_bridge.mojom version update Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 if (net_instance()) 70 if (net_instance())
71 observer->OnNetInstanceReady(); 71 observer->OnNetInstanceReady();
72 if (notifications_instance()) 72 if (notifications_instance())
73 observer->OnNotificationsInstanceReady(); 73 observer->OnNotificationsInstanceReady();
74 if (obb_mounter_instance()) 74 if (obb_mounter_instance())
75 observer->OnObbMounterInstanceReady(); 75 observer->OnObbMounterInstanceReady();
76 if (policy_instance()) 76 if (policy_instance())
77 observer->OnPolicyInstanceReady(); 77 observer->OnPolicyInstanceReady();
78 if (power_instance()) 78 if (power_instance())
79 observer->OnPowerInstanceReady(); 79 observer->OnPowerInstanceReady();
80 if (print_instance())
81 observer->OnPrintInstanceReady();
80 if (process_instance()) 82 if (process_instance())
81 observer->OnProcessInstanceReady(); 83 observer->OnProcessInstanceReady();
82 if (storage_manager_instance()) 84 if (storage_manager_instance())
83 observer->OnStorageManagerInstanceReady(); 85 observer->OnStorageManagerInstanceReady();
84 if (video_instance()) 86 if (video_instance())
85 observer->OnVideoInstanceReady(); 87 observer->OnVideoInstanceReady();
86 if (window_manager_instance()) 88 if (window_manager_instance())
87 observer->OnWindowManagerInstanceReady(); 89 observer->OnWindowManagerInstanceReady();
88 } 90 }
89 91
(...skipping 373 matching lines...) Expand 10 before | Expand all | Expand 10 after
463 465
464 void ArcBridgeService::ClosePowerChannel() { 466 void ArcBridgeService::ClosePowerChannel() {
465 DCHECK(CalledOnValidThread()); 467 DCHECK(CalledOnValidThread());
466 if (!power_ptr_) 468 if (!power_ptr_)
467 return; 469 return;
468 470
469 power_ptr_.reset(); 471 power_ptr_.reset();
470 FOR_EACH_OBSERVER(Observer, observer_list(), OnPowerInstanceClosed()); 472 FOR_EACH_OBSERVER(Observer, observer_list(), OnPowerInstanceClosed());
471 } 473 }
472 474
475 void ArcBridgeService::OnPrintInstanceReady(mojom::PrintInstancePtr print_ptr) {
476 DCHECK(CalledOnValidThread());
477 temporary_print_ptr_ = std::move(print_ptr);
478 temporary_print_ptr_.QueryVersion(base::Bind(
479 &ArcBridgeService::OnPrintVersionReady, weak_factory_.GetWeakPtr()));
480 }
481
482 void ArcBridgeService::OnPrintVersionReady(uint32_t version) {
483 DCHECK(CalledOnValidThread());
484 print_ptr_ = std::move(temporary_print_ptr_);
485 print_ptr_.set_connection_error_handler(base::Bind(
486 &ArcBridgeService::ClosePrintChannel, weak_factory_.GetWeakPtr()));
487 FOR_EACH_OBSERVER(Observer, observer_list(), OnPrintInstanceReady());
488 }
489
490 void ArcBridgeService::ClosePrintChannel() {
491 DCHECK(CalledOnValidThread());
492 if (!print_ptr_)
493 return;
494
495 print_ptr_.reset();
496 FOR_EACH_OBSERVER(Observer, observer_list(), OnPrintInstanceClosed());
497 }
498
473 void ArcBridgeService::OnProcessInstanceReady( 499 void ArcBridgeService::OnProcessInstanceReady(
474 mojom::ProcessInstancePtr process_ptr) { 500 mojom::ProcessInstancePtr process_ptr) {
475 DCHECK(CalledOnValidThread()); 501 DCHECK(CalledOnValidThread());
476 temporary_process_ptr_ = std::move(process_ptr); 502 temporary_process_ptr_ = std::move(process_ptr);
477 temporary_process_ptr_.QueryVersion(base::Bind( 503 temporary_process_ptr_.QueryVersion(base::Bind(
478 &ArcBridgeService::OnProcessVersionReady, weak_factory_.GetWeakPtr())); 504 &ArcBridgeService::OnProcessVersionReady, weak_factory_.GetWeakPtr()));
479 } 505 }
480 506
481 void ArcBridgeService::OnProcessVersionReady(uint32_t version) { 507 void ArcBridgeService::OnProcessVersionReady(uint32_t version) {
482 DCHECK(CalledOnValidThread()); 508 DCHECK(CalledOnValidThread());
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
609 CloseCrashCollectorChannel(); 635 CloseCrashCollectorChannel();
610 CloseFileSystemChannel(); 636 CloseFileSystemChannel();
611 CloseImeChannel(); 637 CloseImeChannel();
612 CloseIntentHelperChannel(); 638 CloseIntentHelperChannel();
613 CloseMetricsChannel(); 639 CloseMetricsChannel();
614 CloseNetChannel(); 640 CloseNetChannel();
615 CloseNotificationsChannel(); 641 CloseNotificationsChannel();
616 CloseObbMounterChannel(); 642 CloseObbMounterChannel();
617 ClosePolicyChannel(); 643 ClosePolicyChannel();
618 ClosePowerChannel(); 644 ClosePowerChannel();
645 ClosePrintChannel();
619 CloseProcessChannel(); 646 CloseProcessChannel();
620 CloseStorageManagerChannel(); 647 CloseStorageManagerChannel();
621 CloseVideoChannel(); 648 CloseVideoChannel();
622 CloseWindowManagerChannel(); 649 CloseWindowManagerChannel();
623 } 650 }
624 651
625 } // namespace arc 652 } // namespace arc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698