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

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

Issue 709683004: components: add wifi_sync component (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@submit-1-security-class
Patch Set: fix android_aosp build 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/wifi_credential.h"
6
7 #include <limits>
8 #include <string>
9
10 #include "base/logging.h"
11 #include "base/strings/string_number_conversions.h"
12 #include "base/strings/stringprintf.h"
13
14 namespace wifi_sync {
15
16 WifiCredential::WifiCredential(
17 const std::vector<unsigned char>& ssid,
18 WifiSecurityClass security_class,
19 const std::string& passphrase)
20 : ssid_(ssid),
21 security_class_(security_class),
22 passphrase_(passphrase) {
23 }
24
25 WifiCredential::~WifiCredential() {
26 }
27
28 std::string WifiCredential::ToString() const {
29 return base::StringPrintf(
30 "[SSID (hex): %s, SecurityClass: %d]",
31 base::HexEncode(&ssid_.front(), ssid_.size()).c_str(),
32 security_class_); // Passphrase deliberately omitted.
33 }
34
35 // static
36 bool WifiCredential::IsLessThan(
37 const WifiCredential& a, const WifiCredential& b) {
38 return a.ssid_ < b.ssid_ ||
39 a.security_class_< b.security_class_ ||
40 a.passphrase_ < b.passphrase_;
41 }
42
43 // static
44 WifiCredential::CredentialSet WifiCredential::MakeSet() {
45 return CredentialSet(WifiCredential::IsLessThan);
46 }
47
48 } // namespace wifi_sync
OLDNEW
« no previous file with comments | « components/wifi_sync/wifi_credential.h ('k') | components/wifi_sync/wifi_credential_syncable_service.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698