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

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

Issue 2257793002: Re-write many calls to WrapUnique() with MakeUnique() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 4 years, 3 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
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_sync/wifi_credential.h" 5 #include "components/wifi_sync/wifi_credential.h"
6 6
7 #include "base/i18n/streaming_utf8_validator.h" 7 #include "base/i18n/streaming_utf8_validator.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/memory/ptr_util.h" 9 #include "base/memory/ptr_util.h"
10 #include "base/strings/string_number_conversions.h" 10 #include "base/strings/string_number_conversions.h"
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 // crbug.com/432546. 43 // crbug.com/432546.
44 if (!base::StreamingUtf8Validator::Validate(ssid_utf8)) { 44 if (!base::StreamingUtf8Validator::Validate(ssid_utf8)) {
45 LOG(ERROR) << "SSID is not valid UTF-8"; 45 LOG(ERROR) << "SSID is not valid UTF-8";
46 return nullptr; 46 return nullptr;
47 } 47 }
48 48
49 std::string onc_security; 49 std::string onc_security;
50 if (!WifiSecurityClassToOncSecurityString(security_class(), &onc_security)) { 50 if (!WifiSecurityClassToOncSecurityString(security_class(), &onc_security)) {
51 NOTREACHED() << "Failed to convert SecurityClass with value " 51 NOTREACHED() << "Failed to convert SecurityClass with value "
52 << security_class(); 52 << security_class();
53 return base::WrapUnique(new base::DictionaryValue()); 53 return base::MakeUnique<base::DictionaryValue>();
54 } 54 }
55 55
56 std::unique_ptr<base::DictionaryValue> onc_properties( 56 std::unique_ptr<base::DictionaryValue> onc_properties(
57 new base::DictionaryValue()); 57 new base::DictionaryValue());
58 onc_properties->Set(onc::toplevel_config::kType, 58 onc_properties->Set(onc::toplevel_config::kType,
59 new base::StringValue(onc::network_type::kWiFi)); 59 new base::StringValue(onc::network_type::kWiFi));
60 // TODO(quiche): Switch to the HexSSID property, once ONC fully supports it. 60 // TODO(quiche): Switch to the HexSSID property, once ONC fully supports it.
61 // crbug.com/432546. 61 // crbug.com/432546.
62 onc_properties->Set(onc::network_config::WifiProperty(onc::wifi::kSSID), 62 onc_properties->Set(onc::network_config::WifiProperty(onc::wifi::kSSID),
63 new base::StringValue(ssid_utf8)); 63 new base::StringValue(ssid_utf8));
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 WifiCredential::WifiCredential( 102 WifiCredential::WifiCredential(
103 const std::vector<unsigned char>& ssid, 103 const std::vector<unsigned char>& ssid,
104 WifiSecurityClass security_class, 104 WifiSecurityClass security_class,
105 const std::string& passphrase) 105 const std::string& passphrase)
106 : ssid_(ssid), 106 : ssid_(ssid),
107 security_class_(security_class), 107 security_class_(security_class),
108 passphrase_(passphrase) { 108 passphrase_(passphrase) {
109 } 109 }
110 110
111 } // namespace wifi_sync 111 } // namespace wifi_sync
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698