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

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

Issue 1701063003: Refactor ArcBridgeService detection and initialization to a separate class ArcServiceLauncher. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address reviewer feedback Created 4 years, 9 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
« no previous file with comments | « components/arc/arc_bridge_service_impl.h ('k') | components/arc/test/fake_arc_bridge_service.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_impl.h" 5 #include "components/arc/arc_bridge_service_impl.h"
6 6
7 #include <string> 7 #include <string>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 16 matching lines...) Expand all
27 : bootstrap_(std::move(bootstrap)), 27 : bootstrap_(std::move(bootstrap)),
28 binding_(this), 28 binding_(this),
29 session_started_(false), 29 session_started_(false),
30 weak_factory_(this) { 30 weak_factory_(this) {
31 bootstrap_->set_delegate(this); 31 bootstrap_->set_delegate(this);
32 } 32 }
33 33
34 ArcBridgeServiceImpl::~ArcBridgeServiceImpl() { 34 ArcBridgeServiceImpl::~ArcBridgeServiceImpl() {
35 } 35 }
36 36
37 void ArcBridgeServiceImpl::DetectAvailability() {
38 chromeos::SessionManagerClient* session_manager_client =
39 chromeos::DBusThreadManager::Get()->GetSessionManagerClient();
40 session_manager_client->CheckArcAvailability(base::Bind(
41 &ArcBridgeServiceImpl::OnArcAvailable, weak_factory_.GetWeakPtr()));
42 }
43
44 void ArcBridgeServiceImpl::HandleStartup() { 37 void ArcBridgeServiceImpl::HandleStartup() {
45 DCHECK(CalledOnValidThread()); 38 DCHECK(CalledOnValidThread());
46 session_started_ = true; 39 session_started_ = true;
47 PrerequisitesChanged(); 40 PrerequisitesChanged();
48 } 41 }
49 42
50 void ArcBridgeServiceImpl::Shutdown() { 43 void ArcBridgeServiceImpl::Shutdown() {
51 DCHECK(CalledOnValidThread()); 44 DCHECK(CalledOnValidThread());
52 session_started_ = false; 45 session_started_ = false;
53 PrerequisitesChanged(); 46 PrerequisitesChanged();
(...skipping 20 matching lines...) Expand all
74 return; 67 return;
75 } 68 }
76 69
77 SetState(State::STOPPING); 70 SetState(State::STOPPING);
78 instance_ptr_.reset(); 71 instance_ptr_.reset();
79 if (binding_.is_bound()) 72 if (binding_.is_bound())
80 binding_.Close(); 73 binding_.Close();
81 bootstrap_->Stop(); 74 bootstrap_->Stop();
82 } 75 }
83 76
84 void ArcBridgeServiceImpl::OnArcAvailable(bool arc_available) { 77 void ArcBridgeServiceImpl::SetDetectedAvailability(bool arc_available) {
85 DCHECK(CalledOnValidThread()); 78 DCHECK(CalledOnValidThread());
86 if (available() == arc_available) 79 if (available() == arc_available)
87 return; 80 return;
88 SetAvailable(arc_available); 81 SetAvailable(arc_available);
89 PrerequisitesChanged(); 82 PrerequisitesChanged();
90 } 83 }
91 84
92 void ArcBridgeServiceImpl::OnConnectionEstablished( 85 void ArcBridgeServiceImpl::OnConnectionEstablished(
93 ArcBridgeInstancePtr instance) { 86 ArcBridgeInstancePtr instance) {
94 DCHECK(CalledOnValidThread()); 87 DCHECK(CalledOnValidThread());
(...skipping 28 matching lines...) Expand all
123 // This will happen when the instance is shut down. Ignore that case. 116 // This will happen when the instance is shut down. Ignore that case.
124 return; 117 return;
125 } 118 }
126 VLOG(1) << "Mojo connection lost"; 119 VLOG(1) << "Mojo connection lost";
127 CloseAllChannels(); 120 CloseAllChannels();
128 reconnect_ = true; 121 reconnect_ = true;
129 StopInstance(); 122 StopInstance();
130 } 123 }
131 124
132 } // namespace arc 125 } // namespace arc
OLDNEW
« no previous file with comments | « components/arc/arc_bridge_service_impl.h ('k') | components/arc/test/fake_arc_bridge_service.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698