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

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

Issue 675993005: components: add wifi_sync component (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@local-master
Patch Set: fix style issues, and unnecessary virtual functions 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 #if defined(OS_CHROMEOS)
erikwright (departed) 2014/10/29 18:18:25 this whole file is chrome_os only. Can you use a f
mukesh agrawal 2014/10/30 18:41:29 Done.
9 #include "third_party/cros_system_api/dbus/service_constants.h"
10 #endif
11
12 namespace wifi_sync {
13
14 #if defined(OS_CHROMEOS)
15 WifiSecurityClass WifiSecurityClassFromShillString(
16 const std::string& security_class_in) {
17 if (security_class_in == shill::kSecurityNone) {
18 return SECURITY_CLASS_NONE;
19 } else if (security_class_in == shill::kSecurityWep) {
20 return SECURITY_CLASS_WEP;
21 } else if (security_class_in == shill::kSecurityPsk) {
22 return SECURITY_CLASS_PSK;
23 } else if (security_class_in == shill::kSecurity8021x) {
24 return SECURITY_CLASS_802_1X;
25 } else {
26 return SECURITY_CLASS_INVALID;
27 }
28 }
29
30 bool WifiSecurityClassToShillString(WifiSecurityClass security_class_in,
31 std::string* security_class_out) {
32 switch (security_class_in) {
33 case SECURITY_CLASS_NONE:
34 *security_class_out = shill::kSecurityNone;
35 return true;
36 case SECURITY_CLASS_WEP:
37 *security_class_out = shill::kSecurityWep;
38 return true;
39 case SECURITY_CLASS_PSK:
40 *security_class_out = shill::kSecurityPsk;
41 return true;
42 case SECURITY_CLASS_802_1X:
43 *security_class_out = shill::kSecurity8021x;
44 return true;
45 case SECURITY_CLASS_INVALID:
46 return false;
47 default:
48 CHECK(false) << "Invalid WifiSecurityClass enum with value "
49 << security_class_in;
50 return false;
51 }
52 }
53 #endif // OS_CHROMEOS
54
55 } // namespace wifi_sync
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698