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

Side by Side Diff: extensions/browser/api/networking_config/networking_config_service.cc

Issue 2252373002: Re-write many calls to WrapUnique() with MakeUnique() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 4 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 "extensions/browser/api/networking_config/networking_config_service.h" 5 #include "extensions/browser/api/networking_config/networking_config_service.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <algorithm> 10 #include <algorithm>
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after
186 ->network_state_handler() 186 ->network_state_handler()
187 ->GetNetworkStateFromGuid(guid); 187 ->GetNetworkStateFromGuid(guid);
188 if (!network) 188 if (!network)
189 return nullptr; 189 return nullptr;
190 190
191 // Populate the NetworkInfo object. 191 // Populate the NetworkInfo object.
192 api::networking_config::NetworkInfo network_info; 192 api::networking_config::NetworkInfo network_info;
193 network_info.type = api::networking_config::NETWORK_TYPE_WIFI; 193 network_info.type = api::networking_config::NETWORK_TYPE_WIFI;
194 const std::vector<uint8_t>& raw_ssid = network->raw_ssid(); 194 const std::vector<uint8_t>& raw_ssid = network->raw_ssid();
195 std::string hex_ssid = base::HexEncode(raw_ssid.data(), raw_ssid.size()); 195 std::string hex_ssid = base::HexEncode(raw_ssid.data(), raw_ssid.size());
196 network_info.hex_ssid = base::WrapUnique(new std::string(hex_ssid)); 196 network_info.hex_ssid = base::MakeUnique<std::string>(hex_ssid);
197 network_info.ssid = base::WrapUnique(new std::string(network->name())); 197 network_info.ssid = base::MakeUnique<std::string>(network->name());
198 network_info.guid = base::WrapUnique(new std::string(network->guid())); 198 network_info.guid = base::MakeUnique<std::string>(network->guid());
199 if (bssid) 199 if (bssid)
200 network_info.bssid.reset(new std::string(*bssid)); 200 network_info.bssid.reset(new std::string(*bssid));
201 std::unique_ptr<base::ListValue> results = 201 std::unique_ptr<base::ListValue> results =
202 api::networking_config::OnCaptivePortalDetected::Create(network_info); 202 api::networking_config::OnCaptivePortalDetected::Create(network_info);
203 std::unique_ptr<Event> event( 203 std::unique_ptr<Event> event(
204 new Event(events::NETWORKING_CONFIG_ON_CAPTIVE_PORTAL_DETECTED, 204 new Event(events::NETWORKING_CONFIG_ON_CAPTIVE_PORTAL_DETECTED,
205 api::networking_config::OnCaptivePortalDetected::kEventName, 205 api::networking_config::OnCaptivePortalDetected::kEventName,
206 std::move(results))); 206 std::move(results)));
207 return event; 207 return event;
208 } 208 }
(...skipping 19 matching lines...) Expand all
228 network_handler->managed_network_configuration_handler()->GetProperties( 228 network_handler->managed_network_configuration_handler()->GetProperties(
229 "" /* empty userhash */, service_path, 229 "" /* empty userhash */, service_path,
230 base::Bind(&NetworkingConfigService::OnGotProperties, 230 base::Bind(&NetworkingConfigService::OnGotProperties,
231 weak_factory_.GetWeakPtr(), extension_id, guid, 231 weak_factory_.GetWeakPtr(), extension_id, guid,
232 authentication_callback), 232 authentication_callback),
233 base::Bind(&NetworkingConfigService::OnGetPropertiesFailed, 233 base::Bind(&NetworkingConfigService::OnGetPropertiesFailed,
234 weak_factory_.GetWeakPtr(), extension_id, guid)); 234 weak_factory_.GetWeakPtr(), extension_id, guid));
235 } 235 }
236 236
237 } // namespace extensions 237 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698