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

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: remove stub wifi_credential_syncable_service 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 } else {
23 return SECURITY_CLASS_INVALID;
stevenjb 2014/11/04 17:21:21 No final else clause needed. Also, {} are unnecess
mukesh agrawal 2014/11/04 19:04:06 Done.
24 }
25 }
26
27 bool WifiSecurityClassToShillString(WifiSecurityClass security_class_in,
28 std::string* security_class_out) {
29 switch (security_class_in) {
30 case SECURITY_CLASS_NONE:
31 *security_class_out = shill::kSecurityNone;
32 return true;
33 case SECURITY_CLASS_WEP:
34 *security_class_out = shill::kSecurityWep;
35 return true;
36 case SECURITY_CLASS_PSK:
37 *security_class_out = shill::kSecurityPsk;
38 return true;
39 case SECURITY_CLASS_802_1X:
40 *security_class_out = shill::kSecurity8021x;
41 return true;
42 case SECURITY_CLASS_INVALID:
43 return false;
44 default:
stevenjb 2014/11/04 17:21:21 Rather than putting a default here, let the compil
mukesh agrawal 2014/11/04 19:04:06 Done. I also changed the CHECK to a LOG(ERROR), t
45 CHECK(false) << "Invalid WifiSecurityClass enum with value "
46 << security_class_in;
47 return false;
48 }
49 }
50
51 } // namespace wifi_sync
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698