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

Side by Side Diff: components/wifi/network_properties.cc

Issue 1549993003: Switch to standard integer types in components/, part 4 of 4. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 months 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
« no previous file with comments | « components/wifi/network_properties.h ('k') | components/wifi/wifi_service.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "components/wifi/network_properties.h" 5 #include "components/wifi/network_properties.h"
6 6
7 #include "base/message_loop/message_loop.h" 7 #include "base/message_loop/message_loop.h"
8 #include "base/strings/string_number_conversions.h" 8 #include "base/strings/string_number_conversions.h"
9 #include "base/strings/stringprintf.h" 9 #include "base/strings/stringprintf.h"
10 #include "components/onc/onc_constants.h" 10 #include "components/onc/onc_constants.h"
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 value.GetString(onc::network_config::kConnectionState, &connection_state); 77 value.GetString(onc::network_config::kConnectionState, &connection_state);
78 wifi->GetString(onc::wifi::kSecurity, &security); 78 wifi->GetString(onc::wifi::kSecurity, &security);
79 wifi->GetString(onc::wifi::kSSID, &ssid); 79 wifi->GetString(onc::wifi::kSSID, &ssid);
80 wifi->GetString(onc::wifi::kPassphrase, &password); 80 wifi->GetString(onc::wifi::kPassphrase, &password);
81 wifi->GetBoolean(onc::wifi::kAutoConnect, &auto_connect); 81 wifi->GetBoolean(onc::wifi::kAutoConnect, &auto_connect);
82 return true; 82 return true;
83 } 83 }
84 return false; 84 return false;
85 } 85 }
86 86
87 std::string NetworkProperties::MacAddressAsString(const uint8 mac_as_int[6]) { 87 std::string NetworkProperties::MacAddressAsString(const uint8_t mac_as_int[6]) {
88 // mac_as_int is big-endian. Write in byte chunks. 88 // mac_as_int is big-endian. Write in byte chunks.
89 // Format is XX:XX:XX:XX:XX:XX. 89 // Format is XX:XX:XX:XX:XX:XX.
90 static const char* const kMacFormatString = "%02x:%02x:%02x:%02x:%02x:%02x"; 90 static const char* const kMacFormatString = "%02x:%02x:%02x:%02x:%02x:%02x";
91 return base::StringPrintf(kMacFormatString, 91 return base::StringPrintf(kMacFormatString,
92 mac_as_int[0], 92 mac_as_int[0],
93 mac_as_int[1], 93 mac_as_int[1],
94 mac_as_int[2], 94 mac_as_int[2],
95 mac_as_int[3], 95 mac_as_int[3],
96 mac_as_int[4], 96 mac_as_int[4],
97 mac_as_int[5]); 97 mac_as_int[5]);
98 } 98 }
99 99
100 bool NetworkProperties::OrderByType(const NetworkProperties& l, 100 bool NetworkProperties::OrderByType(const NetworkProperties& l,
101 const NetworkProperties& r) { 101 const NetworkProperties& r) {
102 if (l.connection_state != r.connection_state) 102 if (l.connection_state != r.connection_state)
103 return l.connection_state < r.connection_state; 103 return l.connection_state < r.connection_state;
104 // This sorting order is needed only for browser_tests, which expect this 104 // This sorting order is needed only for browser_tests, which expect this
105 // network type sort order: ethernet < wifi < vpn < cellular. 105 // network type sort order: ethernet < wifi < vpn < cellular.
106 if (l.type == r.type) 106 if (l.type == r.type)
107 return l.guid < r.guid; 107 return l.guid < r.guid;
108 if (l.type == onc::network_type::kEthernet) 108 if (l.type == onc::network_type::kEthernet)
109 return true; 109 return true;
110 if (r.type == onc::network_type::kEthernet) 110 if (r.type == onc::network_type::kEthernet)
111 return false; 111 return false;
112 return l.type > r.type; 112 return l.type > r.type;
113 } 113 }
114 114
115 } // namespace wifi 115 } // namespace wifi
OLDNEW
« no previous file with comments | « components/wifi/network_properties.h ('k') | components/wifi/wifi_service.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698