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

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

Issue 675993005: components: add wifi_sync component (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@local-master
Patch Set: rebase Created 6 years, 1 month 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/wifi_security_class.h"
6
7 #include "base/logging.h"
8 #include "third_party/cros_system_api/dbus/service_constants.h"
9
10 namespace wifi_sync {
11
12 WifiSecurityClass WifiSecurityClassFromShillString(
13 const std::string& security_class_in) {
14 if (security_class_in == shill::kSecurityNone)
15 return SECURITY_CLASS_NONE;
16 else if (security_class_in == shill::kSecurityWep)
17 return SECURITY_CLASS_WEP;
18 else if (security_class_in == shill::kSecurityPsk)
19 return SECURITY_CLASS_PSK;
20 else if (security_class_in == shill::kSecurity8021x)
21 return SECURITY_CLASS_802_1X;
22 return SECURITY_CLASS_INVALID;
23 }
24
25 bool WifiSecurityClassToShillString(WifiSecurityClass security_class_in,
26 std::string* security_class_out) {
27 switch (security_class_in) {
28 case SECURITY_CLASS_NONE:
29 *security_class_out = shill::kSecurityNone;
30 return true;
31 case SECURITY_CLASS_WEP:
32 *security_class_out = shill::kSecurityWep;
33 return true;
34 case SECURITY_CLASS_PSK:
35 *security_class_out = shill::kSecurityPsk;
36 return true;
37 case SECURITY_CLASS_802_1X:
38 *security_class_out = shill::kSecurity8021x;
39 return true;
40 case SECURITY_CLASS_INVALID:
41 return false;
42 }
43 LOG(ERROR) << "Invalid WifiSecurityClass enum with value "
44 << security_class_in;
45 return false;
46 }
47
48 } // namespace wifi_sync
OLDNEW
« no previous file with comments | « components/wifi_sync/wifi_security_class.h ('k') | components/wifi_sync/wifi_security_class_chromeos_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698