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 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
146 | 146 |
147 void ArcBridgeService::CloseInputChannel() { | 147 void ArcBridgeService::CloseInputChannel() { |
148 DCHECK(CalledOnValidThread()); | 148 DCHECK(CalledOnValidThread()); |
149 if (!input_ptr_) | 149 if (!input_ptr_) |
150 return; | 150 return; |
151 | 151 |
152 input_ptr_.reset(); | 152 input_ptr_.reset(); |
153 FOR_EACH_OBSERVER(Observer, observer_list(), OnInputInstanceClosed()); | 153 FOR_EACH_OBSERVER(Observer, observer_list(), OnInputInstanceClosed()); |
154 } | 154 } |
155 | 155 |
156 void ArcBridgeService::OnNetInstanceReady(NetInstancePtr net_ptr) { | |
157 DCHECK(CalledOnValidThread()); | |
158 temporary_net_ptr_ = std::move(net_ptr); | |
159 temporary_net_ptr_.QueryVersion(base::Bind( | |
160 &ArcBridgeService::OnNetVersionReady, weak_factory_.GetWeakPtr())); | |
161 } | |
162 | |
163 void ArcBridgeService::OnNetVersionReady(int32_t version) { | |
164 DCHECK(CalledOnValidThread()); | |
165 net_ptr_ = std::move(temporary_net_ptr_); | |
166 FOR_EACH_OBSERVER(Observer, observer_list(), OnNetInstanceReady()); | |
hidehiko
2016/01/15 08:38:39
This needs to be called after set_connection_error
cernekee
2016/01/15 22:45:36
Done.
| |
167 net_ptr_.set_connection_error_handler(base::Bind( | |
168 &ArcBridgeService::CloseNetChannel, weak_factory_.GetWeakPtr())); | |
169 } | |
170 | |
171 void ArcBridgeService::CloseNetChannel() { | |
172 DCHECK(CalledOnValidThread()); | |
173 if (!net_ptr_) | |
174 return; | |
175 | |
176 net_ptr_.reset(); | |
177 FOR_EACH_OBSERVER(Observer, observer_list(), OnNetInstanceClosed()); | |
178 } | |
179 | |
156 void ArcBridgeService::OnNotificationsInstanceReady( | 180 void ArcBridgeService::OnNotificationsInstanceReady( |
157 NotificationsInstancePtr notifications_ptr) { | 181 NotificationsInstancePtr notifications_ptr) { |
158 DCHECK(CalledOnValidThread()); | 182 DCHECK(CalledOnValidThread()); |
159 temporary_notifications_ptr_ = std::move(notifications_ptr); | 183 temporary_notifications_ptr_ = std::move(notifications_ptr); |
160 temporary_notifications_ptr_.QueryVersion( | 184 temporary_notifications_ptr_.QueryVersion( |
161 base::Bind(&ArcBridgeService::OnNotificationsVersionReady, | 185 base::Bind(&ArcBridgeService::OnNotificationsVersionReady, |
162 weak_factory_.GetWeakPtr())); | 186 weak_factory_.GetWeakPtr())); |
163 } | 187 } |
164 | 188 |
165 void ArcBridgeService::OnNotificationsVersionReady(int32_t version) { | 189 void ArcBridgeService::OnNotificationsVersionReady(int32_t version) { |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
278 CloseAuthChannel(); | 302 CloseAuthChannel(); |
279 CloseClipboardChannel(); | 303 CloseClipboardChannel(); |
280 CloseInputChannel(); | 304 CloseInputChannel(); |
281 CloseNotificationsChannel(); | 305 CloseNotificationsChannel(); |
282 ClosePowerChannel(); | 306 ClosePowerChannel(); |
283 CloseProcessChannel(); | 307 CloseProcessChannel(); |
284 CloseSettingsChannel(); | 308 CloseSettingsChannel(); |
285 } | 309 } |
286 | 310 |
287 } // namespace arc | 311 } // namespace arc |
OLD | NEW |