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

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

Issue 1590723003: Host-side implementation of ARC Intent handler (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: review Created 4 years, 11 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 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
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::OnIntentHelperInstanceReady(
157 IntentHelperInstancePtr intent_helper_ptr) {
158 DCHECK(CalledOnValidThread());
159 temporary_intent_helper_ptr_ = std::move(intent_helper_ptr);
160 temporary_intent_helper_ptr_.QueryVersion(
161 base::Bind(&ArcBridgeService::OnIntentHelperVersionReady,
162 weak_factory_.GetWeakPtr()));
163 }
164
165 void ArcBridgeService::OnIntentHelperVersionReady(int32_t version) {
166 DCHECK(CalledOnValidThread());
167 intent_helper_ptr_ = std::move(temporary_intent_helper_ptr_);
168 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.
169 intent_helper_ptr_.set_connection_error_handler(base::Bind(
170 &ArcBridgeService::CloseIntentHelperChannel, weak_factory_.GetWeakPtr()));
171 }
172
173 void ArcBridgeService::CloseIntentHelperChannel() {
174 DCHECK(CalledOnValidThread());
175 if (!intent_helper_ptr_)
176 return;
177
178 intent_helper_ptr_.reset();
179 FOR_EACH_OBSERVER(Observer, observer_list(), OnIntentHelperInstanceClosed());
180 }
181
156 void ArcBridgeService::OnNotificationsInstanceReady( 182 void ArcBridgeService::OnNotificationsInstanceReady(
157 NotificationsInstancePtr notifications_ptr) { 183 NotificationsInstancePtr notifications_ptr) {
158 DCHECK(CalledOnValidThread()); 184 DCHECK(CalledOnValidThread());
159 temporary_notifications_ptr_ = std::move(notifications_ptr); 185 temporary_notifications_ptr_ = std::move(notifications_ptr);
160 temporary_notifications_ptr_.QueryVersion( 186 temporary_notifications_ptr_.QueryVersion(
161 base::Bind(&ArcBridgeService::OnNotificationsVersionReady, 187 base::Bind(&ArcBridgeService::OnNotificationsVersionReady,
162 weak_factory_.GetWeakPtr())); 188 weak_factory_.GetWeakPtr()));
163 } 189 }
164 190
165 void ArcBridgeService::OnNotificationsVersionReady(int32_t version) { 191 void ArcBridgeService::OnNotificationsVersionReady(int32_t version) {
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
296 return thread_checker_.CalledOnValidThread(); 322 return thread_checker_.CalledOnValidThread();
297 } 323 }
298 324
299 void ArcBridgeService::CloseAllChannels() { 325 void ArcBridgeService::CloseAllChannels() {
300 // Call all the error handlers of all the channels to both close the channel 326 // Call all the error handlers of all the channels to both close the channel
301 // and notify any observers that the channel is closed. 327 // and notify any observers that the channel is closed.
302 CloseAppChannel(); 328 CloseAppChannel();
303 CloseAuthChannel(); 329 CloseAuthChannel();
304 CloseClipboardChannel(); 330 CloseClipboardChannel();
305 CloseInputChannel(); 331 CloseInputChannel();
332 CloseIntentHelperChannel();
306 CloseNotificationsChannel(); 333 CloseNotificationsChannel();
307 ClosePowerChannel(); 334 ClosePowerChannel();
308 CloseProcessChannel(); 335 CloseProcessChannel();
309 CloseSettingsChannel(); 336 CloseSettingsChannel();
310 CloseVideoChannel(); 337 CloseVideoChannel();
311 } 338 }
312 339
313 } // namespace arc 340 } // namespace arc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698