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

Side by Side Diff: components/wifi_sync/network_state_helper_chromeos.cc

Issue 709683004: components: add wifi_sync component (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@submit-1-security-class
Patch Set: test integration with chromeos network settings backend Created 6 years 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
(Empty)
1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "components/wifi_sync/network_state_helper_chromeos.h"
6
7 #include "base/logging.h"
8 #include "chromeos/network/network_state.h"
9 #include "chromeos/network/network_state_handler.h"
10 #include "components/wifi_sync/wifi_credential.h"
11 #include "components/wifi_sync/wifi_security_class.h"
12
13 namespace wifi_sync {
14
15 WifiCredential::CredentialSet GetWifiCredentialsForShillProfile(
16 chromeos::NetworkStateHandler* network_state_handler,
17 const std::string& shill_profile_path) {
18 if (!network_state_handler) {
19 LOG(ERROR) << "network_state_handler is null";
20 return WifiCredential::MakeSet();
21 }
22
23 chromeos::NetworkStateHandler::NetworkStateList networks;
24 network_state_handler->GetNetworkListByType(
25 chromeos::NetworkTypePattern::WiFi(),
26 true, /* configured_only */
27 false, /* visible_only */
28 0, /* unlimited result size */
29 &networks);
30
31 auto credentials(WifiCredential::MakeSet());
32 for (const chromeos::NetworkState* network : networks) {
33 DCHECK(network);
34
35 if (network->profile_path() != shill_profile_path) {
36 continue;
37 }
38
39 // TODO(quiche): Switch away from network->security(), once we have
40 // a security_class() field in NetworkState.
41 //
42 // TODO(quiche): Fill in the actual passphrase via an asynchronous
43 // call to a chromeos::NetworkConfigurationHandler instance's
44 // GetProperties method.
45 credentials.insert(
46 WifiCredential(network->raw_ssid(),
47 WifiSecurityClassFromShillString(network->security()),
48 "" /* empty passphrase */));
49 }
50 return credentials;
51 }
52
53 } // namespace wifi_sync
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698