| 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 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 170 | 170 |
| 171 void ArcBridgeService::CloseInputChannel() { | 171 void ArcBridgeService::CloseInputChannel() { |
| 172 DCHECK(CalledOnValidThread()); | 172 DCHECK(CalledOnValidThread()); |
| 173 if (!input_ptr_) | 173 if (!input_ptr_) |
| 174 return; | 174 return; |
| 175 | 175 |
| 176 input_ptr_.reset(); | 176 input_ptr_.reset(); |
| 177 FOR_EACH_OBSERVER(Observer, observer_list(), OnInputInstanceClosed()); | 177 FOR_EACH_OBSERVER(Observer, observer_list(), OnInputInstanceClosed()); |
| 178 } | 178 } |
| 179 | 179 |
| 180 void ArcBridgeService::OnIntentHelperInstanceReady( | |
| 181 IntentHelperInstancePtr intent_helper_ptr) { | |
| 182 DCHECK(CalledOnValidThread()); | |
| 183 temporary_intent_helper_ptr_ = std::move(intent_helper_ptr); | |
| 184 temporary_intent_helper_ptr_.QueryVersion( | |
| 185 base::Bind(&ArcBridgeService::OnIntentHelperVersionReady, | |
| 186 weak_factory_.GetWeakPtr())); | |
| 187 } | |
| 188 | |
| 189 void ArcBridgeService::OnIntentHelperVersionReady(int32_t version) { | |
| 190 DCHECK(CalledOnValidThread()); | |
| 191 intent_helper_ptr_ = std::move(temporary_intent_helper_ptr_); | |
| 192 intent_helper_ptr_.set_connection_error_handler(base::Bind( | |
| 193 &ArcBridgeService::CloseIntentHelperChannel, weak_factory_.GetWeakPtr())); | |
| 194 FOR_EACH_OBSERVER(Observer, observer_list(), OnIntentHelperInstanceReady()); | |
| 195 } | |
| 196 | |
| 197 void ArcBridgeService::CloseIntentHelperChannel() { | |
| 198 DCHECK(CalledOnValidThread()); | |
| 199 if (!intent_helper_ptr_) | |
| 200 return; | |
| 201 | |
| 202 intent_helper_ptr_.reset(); | |
| 203 FOR_EACH_OBSERVER(Observer, observer_list(), OnIntentHelperInstanceClosed()); | |
| 204 } | |
| 205 | |
| 206 void ArcBridgeService::OnNotificationsInstanceReady( | 180 void ArcBridgeService::OnNotificationsInstanceReady( |
| 207 NotificationsInstancePtr notifications_ptr) { | 181 NotificationsInstancePtr notifications_ptr) { |
| 208 DCHECK(CalledOnValidThread()); | 182 DCHECK(CalledOnValidThread()); |
| 209 temporary_notifications_ptr_ = std::move(notifications_ptr); | 183 temporary_notifications_ptr_ = std::move(notifications_ptr); |
| 210 temporary_notifications_ptr_.QueryVersion( | 184 temporary_notifications_ptr_.QueryVersion( |
| 211 base::Bind(&ArcBridgeService::OnNotificationsVersionReady, | 185 base::Bind(&ArcBridgeService::OnNotificationsVersionReady, |
| 212 weak_factory_.GetWeakPtr())); | 186 weak_factory_.GetWeakPtr())); |
| 213 } | 187 } |
| 214 | 188 |
| 215 void ArcBridgeService::OnNotificationsVersionReady(int32_t version) { | 189 void ArcBridgeService::OnNotificationsVersionReady(int32_t version) { |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 347 } | 321 } |
| 348 | 322 |
| 349 void ArcBridgeService::CloseAllChannels() { | 323 void ArcBridgeService::CloseAllChannels() { |
| 350 // Call all the error handlers of all the channels to both close the channel | 324 // Call all the error handlers of all the channels to both close the channel |
| 351 // and notify any observers that the channel is closed. | 325 // and notify any observers that the channel is closed. |
| 352 CloseAppChannel(); | 326 CloseAppChannel(); |
| 353 CloseAuthChannel(); | 327 CloseAuthChannel(); |
| 354 CloseClipboardChannel(); | 328 CloseClipboardChannel(); |
| 355 CloseImeChannel(); | 329 CloseImeChannel(); |
| 356 CloseInputChannel(); | 330 CloseInputChannel(); |
| 357 CloseIntentHelperChannel(); | |
| 358 CloseNotificationsChannel(); | 331 CloseNotificationsChannel(); |
| 359 ClosePowerChannel(); | 332 ClosePowerChannel(); |
| 360 CloseProcessChannel(); | 333 CloseProcessChannel(); |
| 361 CloseSettingsChannel(); | 334 CloseSettingsChannel(); |
| 362 CloseVideoChannel(); | 335 CloseVideoChannel(); |
| 363 } | 336 } |
| 364 | 337 |
| 365 } // namespace arc | 338 } // namespace arc |
| OLD | NEW |