Index: components/arc/arc_bridge_service.cc |
diff --git a/components/arc/arc_bridge_service.cc b/components/arc/arc_bridge_service.cc |
index 9183477ff8c9a455919c053d923338894da068e0..e97d962476bef1b142c6e59d51607f8bdedda962 100644 |
--- a/components/arc/arc_bridge_service.cc |
+++ b/components/arc/arc_bridge_service.cc |
@@ -153,6 +153,32 @@ void ArcBridgeService::CloseInputChannel() { |
FOR_EACH_OBSERVER(Observer, observer_list(), OnInputInstanceClosed()); |
} |
+void ArcBridgeService::OnIntentHelperInstanceReady( |
+ IntentHelperInstancePtr intent_helper_ptr) { |
+ DCHECK(CalledOnValidThread()); |
+ temporary_intent_helper_ptr_ = std::move(intent_helper_ptr); |
+ temporary_intent_helper_ptr_.QueryVersion( |
+ base::Bind(&ArcBridgeService::OnIntentHelperVersionReady, |
+ weak_factory_.GetWeakPtr())); |
+} |
+ |
+void ArcBridgeService::OnIntentHelperVersionReady(int32_t version) { |
+ DCHECK(CalledOnValidThread()); |
+ intent_helper_ptr_ = std::move(temporary_intent_helper_ptr_); |
+ FOR_EACH_OBSERVER(Observer, observer_list(), OnIntentHelperInstanceReady()); |
hidehiko
2016/01/15 09:04:55
Please call this after set_connection_error_handle
Yusuke Sato
2016/01/16 00:11:07
Done.
|
+ intent_helper_ptr_.set_connection_error_handler(base::Bind( |
+ &ArcBridgeService::CloseIntentHelperChannel, weak_factory_.GetWeakPtr())); |
+} |
+ |
+void ArcBridgeService::CloseIntentHelperChannel() { |
+ DCHECK(CalledOnValidThread()); |
+ if (!intent_helper_ptr_) |
+ return; |
+ |
+ intent_helper_ptr_.reset(); |
+ FOR_EACH_OBSERVER(Observer, observer_list(), OnIntentHelperInstanceClosed()); |
+} |
+ |
void ArcBridgeService::OnNotificationsInstanceReady( |
NotificationsInstancePtr notifications_ptr) { |
DCHECK(CalledOnValidThread()); |
@@ -303,6 +329,7 @@ void ArcBridgeService::CloseAllChannels() { |
CloseAuthChannel(); |
CloseClipboardChannel(); |
CloseInputChannel(); |
+ CloseIntentHelperChannel(); |
CloseNotificationsChannel(); |
ClosePowerChannel(); |
CloseProcessChannel(); |