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

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

Issue 1572483002: Implement OnGetNetworks for net.mojom (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase + incorporate code review feedback 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
« no previous file with comments | « components/arc/arc_bridge_service.h ('k') | components/arc/arc_service_manager.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.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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 if (app_instance()) 56 if (app_instance())
57 observer->OnAppInstanceReady(); 57 observer->OnAppInstanceReady();
58 if (auth_instance()) 58 if (auth_instance())
59 observer->OnAuthInstanceReady(); 59 observer->OnAuthInstanceReady();
60 if (clipboard_instance()) 60 if (clipboard_instance())
61 observer->OnClipboardInstanceReady(); 61 observer->OnClipboardInstanceReady();
62 if (ime_instance()) 62 if (ime_instance())
63 observer->OnImeInstanceReady(); 63 observer->OnImeInstanceReady();
64 if (input_instance()) 64 if (input_instance())
65 observer->OnInputInstanceReady(); 65 observer->OnInputInstanceReady();
66 if (notifications_instance()) 66 if (notifications_instance())
lhc(google) 2016/01/22 20:47:12 You need to add: if (net_instance()) observer->
cernekee 2016/01/22 20:54:28 Done.
67 observer->OnNotificationsInstanceReady(); 67 observer->OnNotificationsInstanceReady();
68 if (power_instance()) 68 if (power_instance())
69 observer->OnPowerInstanceReady(); 69 observer->OnPowerInstanceReady();
70 if (process_instance()) 70 if (process_instance())
71 observer->OnProcessInstanceReady(); 71 observer->OnProcessInstanceReady();
72 if (settings_instance()) 72 if (settings_instance())
73 observer->OnSettingsInstanceReady(); 73 observer->OnSettingsInstanceReady();
74 if (video_instance()) 74 if (video_instance())
75 observer->OnVideoInstanceReady(); 75 observer->OnVideoInstanceReady();
76 } 76 }
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
220 220
221 void ArcBridgeService::CloseIntentHelperChannel() { 221 void ArcBridgeService::CloseIntentHelperChannel() {
222 DCHECK(CalledOnValidThread()); 222 DCHECK(CalledOnValidThread());
223 if (!intent_helper_ptr_) 223 if (!intent_helper_ptr_)
224 return; 224 return;
225 225
226 intent_helper_ptr_.reset(); 226 intent_helper_ptr_.reset();
227 FOR_EACH_OBSERVER(Observer, observer_list(), OnIntentHelperInstanceClosed()); 227 FOR_EACH_OBSERVER(Observer, observer_list(), OnIntentHelperInstanceClosed());
228 } 228 }
229 229
230 void ArcBridgeService::OnNetInstanceReady(NetInstancePtr net_ptr) {
231 DCHECK(CalledOnValidThread());
232 temporary_net_ptr_ = std::move(net_ptr);
233 temporary_net_ptr_.QueryVersion(base::Bind(
234 &ArcBridgeService::OnNetVersionReady, weak_factory_.GetWeakPtr()));
235 }
236
237 void ArcBridgeService::OnNetVersionReady(int32_t version) {
238 DCHECK(CalledOnValidThread());
239 net_ptr_ = std::move(temporary_net_ptr_);
240 net_ptr_.set_connection_error_handler(base::Bind(
241 &ArcBridgeService::CloseNetChannel, weak_factory_.GetWeakPtr()));
242 FOR_EACH_OBSERVER(Observer, observer_list(), OnNetInstanceReady());
243 }
244
245 void ArcBridgeService::CloseNetChannel() {
246 DCHECK(CalledOnValidThread());
247 if (!net_ptr_)
248 return;
249
250 net_ptr_.reset();
251 FOR_EACH_OBSERVER(Observer, observer_list(), OnNetInstanceClosed());
252 }
253
230 void ArcBridgeService::OnNotificationsInstanceReady( 254 void ArcBridgeService::OnNotificationsInstanceReady(
231 NotificationsInstancePtr notifications_ptr) { 255 NotificationsInstancePtr notifications_ptr) {
232 DCHECK(CalledOnValidThread()); 256 DCHECK(CalledOnValidThread());
233 temporary_notifications_ptr_ = std::move(notifications_ptr); 257 temporary_notifications_ptr_ = std::move(notifications_ptr);
234 temporary_notifications_ptr_.QueryVersion( 258 temporary_notifications_ptr_.QueryVersion(
235 base::Bind(&ArcBridgeService::OnNotificationsVersionReady, 259 base::Bind(&ArcBridgeService::OnNotificationsVersionReady,
236 weak_factory_.GetWeakPtr())); 260 weak_factory_.GetWeakPtr()));
237 } 261 }
238 262
239 void ArcBridgeService::OnNotificationsVersionReady(int32_t version) { 263 void ArcBridgeService::OnNotificationsVersionReady(int32_t version) {
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
372 396
373 void ArcBridgeService::CloseAllChannels() { 397 void ArcBridgeService::CloseAllChannels() {
374 // Call all the error handlers of all the channels to both close the channel 398 // Call all the error handlers of all the channels to both close the channel
375 // and notify any observers that the channel is closed. 399 // and notify any observers that the channel is closed.
376 CloseAppChannel(); 400 CloseAppChannel();
377 CloseAuthChannel(); 401 CloseAuthChannel();
378 CloseClipboardChannel(); 402 CloseClipboardChannel();
379 CloseImeChannel(); 403 CloseImeChannel();
380 CloseInputChannel(); 404 CloseInputChannel();
381 CloseIntentHelperChannel(); 405 CloseIntentHelperChannel();
382 CloseNotificationsChannel(); 406 CloseNotificationsChannel();
lhc(google) 2016/01/22 20:47:12 You need to add: CloseNetChannel();
cernekee 2016/01/22 20:54:28 Done.
383 ClosePowerChannel(); 407 ClosePowerChannel();
384 CloseProcessChannel(); 408 CloseProcessChannel();
385 CloseSettingsChannel(); 409 CloseSettingsChannel();
386 CloseVideoChannel(); 410 CloseVideoChannel();
387 } 411 }
388 412
389 } // namespace arc 413 } // namespace arc
OLDNEW
« no previous file with comments | « components/arc/arc_bridge_service.h ('k') | components/arc/arc_service_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698