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

Side by Side Diff: components/arc/net/arc_net_host_impl.cc

Issue 1680483002: ARC: Implement the startScan API to start scanning of WiFI APs. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 10 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/net/arc_net_host_impl.h" 5 #include "components/arc/net/arc_net_host_impl.h"
6 6
7 #include <string> 7 #include <string>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/logging.h" 10 #include "base/logging.h"
11 #include "base/posix/eintr_wrapper.h" 11 #include "base/posix/eintr_wrapper.h"
12 #include "base/thread_task_runner_handle.h" 12 #include "base/thread_task_runner_handle.h"
13 #include "base/time/time.h" 13 #include "base/time/time.h"
14 #include "chromeos/network/network_handler.h" 14 #include "chromeos/network/network_handler.h"
15 #include "chromeos/network/network_state_handler.h" 15 #include "chromeos/network/network_state_handler.h"
16 #include "chromeos/network/network_util.h" 16 #include "chromeos/network/network_util.h"
17 #include "chromeos/network/onc/onc_utils.h" 17 #include "chromeos/network/onc/onc_utils.h"
18 #include "components/arc/arc_bridge_service.h" 18 #include "components/arc/arc_bridge_service.h"
19 #include "third_party/mojo/src/mojo/edk/embedder/embedder.h" 19 #include "third_party/mojo/src/mojo/edk/embedder/embedder.h"
20 20
21 namespace { 21 namespace {
22 22
23 const int kGetNetworksListLimit = 100; 23 const int kGetNetworksListLimit = 100;
24 24
25 } // namespace 25 } // namespace
26 26
27 namespace arc { 27 namespace arc {
28 28
29 chromeos::NetworkStateHandler* GetStateHandler() {
30 return chromeos::NetworkHandler::Get()->network_state_handler();
31 }
32
29 ArcNetHostImpl::ArcNetHostImpl(ArcBridgeService* bridge_service) 33 ArcNetHostImpl::ArcNetHostImpl(ArcBridgeService* bridge_service)
30 : ArcService(bridge_service), binding_(this) { 34 : ArcService(bridge_service), binding_(this) {
31 arc_bridge_service()->AddObserver(this); 35 arc_bridge_service()->AddObserver(this);
32 } 36 }
33 37
34 ArcNetHostImpl::~ArcNetHostImpl() { 38 ArcNetHostImpl::~ArcNetHostImpl() {
35 DCHECK(thread_checker_.CalledOnValidThread()); 39 DCHECK(thread_checker_.CalledOnValidThread());
36 arc_bridge_service()->RemoveObserver(this); 40 arc_bridge_service()->RemoveObserver(this);
37 } 41 }
38 42
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 wc->bssid = tmp; 97 wc->bssid = tmp;
94 98
95 data->networks.push_back(std::move(wc)); 99 data->networks.push_back(std::move(wc));
96 } 100 }
97 101
98 callback.Run(std::move(data)); 102 callback.Run(std::move(data));
99 } 103 }
100 104
101 void ArcNetHostImpl::GetWifiEnabledState( 105 void ArcNetHostImpl::GetWifiEnabledState(
102 const GetWifiEnabledStateCallback& callback) { 106 const GetWifiEnabledStateCallback& callback) {
103 chromeos::NetworkStateHandler* handler = 107 bool is_enabled = GetStateHandler()->IsTechnologyEnabled(
104 chromeos::NetworkHandler::Get()->network_state_handler(); 108 chromeos::NetworkTypePattern::WiFi());
105 bool is_enabled =
106 handler->IsTechnologyEnabled(chromeos::NetworkTypePattern::WiFi());
107 109
108 callback.Run(is_enabled); 110 callback.Run(is_enabled);
109 } 111 }
110 112
113 void ArcNetHostImpl::StartScan(const StartScanCallback& callback) {
114 GetStateHandler()->RequestScan();
115 callback.Run(true);
Luis Héctor Chávez 2016/02/08 16:35:46 Why add this if it is always going to be true? If
abhishekbh 2016/02/12 02:17:33 Removed.
116 }
117
111 } // namespace arc 118 } // namespace arc
OLDNEW
« components/arc/common/net.mojom ('K') | « components/arc/net/arc_net_host_impl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698