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

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

Issue 1917673002: Convert //components/[u-z]* from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 4 years, 7 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"
11 11
12 namespace wifi { 12 namespace wifi {
13 13
14 NetworkProperties::NetworkProperties() 14 NetworkProperties::NetworkProperties()
15 : connection_state(onc::connection_state::kNotConnected), 15 : connection_state(onc::connection_state::kNotConnected),
16 security(onc::wifi::kSecurityNone), 16 security(onc::wifi::kSecurityNone),
17 signal_strength(0), 17 signal_strength(0),
18 auto_connect(false), 18 auto_connect(false),
19 frequency(kFrequencyUnknown) { 19 frequency(kFrequencyUnknown) {
20 } 20 }
21 21
22 NetworkProperties::NetworkProperties(const NetworkProperties& other) = default; 22 NetworkProperties::NetworkProperties(const NetworkProperties& other) = default;
23 23
24 NetworkProperties::~NetworkProperties() { 24 NetworkProperties::~NetworkProperties() {
25 } 25 }
26 26
27 scoped_ptr<base::DictionaryValue> NetworkProperties::ToValue( 27 std::unique_ptr<base::DictionaryValue> NetworkProperties::ToValue(
28 bool network_list) const { 28 bool network_list) const {
29 scoped_ptr<base::DictionaryValue> value(new base::DictionaryValue()); 29 std::unique_ptr<base::DictionaryValue> value(new base::DictionaryValue());
30 30
31 value->SetString(onc::network_config::kGUID, guid); 31 value->SetString(onc::network_config::kGUID, guid);
32 value->SetString(onc::network_config::kName, name); 32 value->SetString(onc::network_config::kName, name);
33 value->SetString(onc::network_config::kConnectionState, connection_state); 33 value->SetString(onc::network_config::kConnectionState, connection_state);
34 DCHECK(type == onc::network_type::kWiFi); 34 DCHECK(type == onc::network_type::kWiFi);
35 value->SetString(onc::network_config::kType, type); 35 value->SetString(onc::network_config::kType, type);
36 36
37 // For now, assume all WiFi services are connectable. 37 // For now, assume all WiFi services are connectable.
38 value->SetBoolean(onc::network_config::kConnectable, true); 38 value->SetBoolean(onc::network_config::kConnectable, true);
39 39
40 scoped_ptr<base::DictionaryValue> wifi(new base::DictionaryValue()); 40 std::unique_ptr<base::DictionaryValue> wifi(new base::DictionaryValue());
41 wifi->SetString(onc::wifi::kSecurity, security); 41 wifi->SetString(onc::wifi::kSecurity, security);
42 wifi->SetInteger(onc::wifi::kSignalStrength, signal_strength); 42 wifi->SetInteger(onc::wifi::kSignalStrength, signal_strength);
43 43
44 // Network list expects subset of data. 44 // Network list expects subset of data.
45 if (!network_list) { 45 if (!network_list) {
46 if (frequency != kFrequencyUnknown) 46 if (frequency != kFrequencyUnknown)
47 wifi->SetInteger(onc::wifi::kFrequency, frequency); 47 wifi->SetInteger(onc::wifi::kFrequency, frequency);
48 scoped_ptr<base::ListValue> frequency_list(new base::ListValue()); 48 std::unique_ptr<base::ListValue> frequency_list(new base::ListValue());
49 for (FrequencySet::const_iterator it = this->frequency_set.begin(); 49 for (FrequencySet::const_iterator it = this->frequency_set.begin();
50 it != this->frequency_set.end(); 50 it != this->frequency_set.end();
51 ++it) { 51 ++it) {
52 frequency_list->AppendInteger(*it); 52 frequency_list->AppendInteger(*it);
53 } 53 }
54 if (!frequency_list->empty()) 54 if (!frequency_list->empty())
55 wifi->Set(onc::wifi::kFrequencyList, frequency_list.release()); 55 wifi->Set(onc::wifi::kFrequencyList, frequency_list.release());
56 if (!bssid.empty()) 56 if (!bssid.empty())
57 wifi->SetString(onc::wifi::kBSSID, bssid); 57 wifi->SetString(onc::wifi::kBSSID, bssid);
58 wifi->SetString(onc::wifi::kSSID, ssid); 58 wifi->SetString(onc::wifi::kSSID, ssid);
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 if (l.type == r.type) 108 if (l.type == r.type)
109 return l.guid < r.guid; 109 return l.guid < r.guid;
110 if (l.type == onc::network_type::kEthernet) 110 if (l.type == onc::network_type::kEthernet)
111 return true; 111 return true;
112 if (r.type == onc::network_type::kEthernet) 112 if (r.type == onc::network_type::kEthernet)
113 return false; 113 return false;
114 return l.type > r.type; 114 return l.type > r.type;
115 } 115 }
116 116
117 } // namespace wifi 117 } // 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