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

Unified Diff: device/geolocation/network_location_request.cc

Issue 2911033002: Remove raw base::DictionaryValue::Set (Closed)
Patch Set: Proper Windows Fix Created 3 years, 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « dbus/values_util_unittest.cc ('k') | extensions/browser/api/socket/socket_api.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: device/geolocation/network_location_request.cc
diff --git a/device/geolocation/network_location_request.cc b/device/geolocation/network_location_request.cc
index 0db378af8d1e0e140b40f98ad127971ca2525834..08c157415f47cc0a928227dbbaacc2005efa6283 100644
--- a/device/geolocation/network_location_request.cc
+++ b/device/geolocation/network_location_request.cc
@@ -9,9 +9,11 @@
#include <limits>
#include <set>
#include <string>
+#include <utility>
#include "base/json/json_reader.h"
#include "base/json/json_writer.h"
+#include "base/memory/ptr_util.h"
#include "base/metrics/histogram.h"
#include "base/metrics/histogram_macros.h"
#include "base/strings/string_number_conversions.h"
@@ -274,10 +276,9 @@ void AddWifiData(const WifiData& wifi_data,
for (const auto& ap_data : wifi_data.access_point_data)
access_points_by_signal_strength.insert(&ap_data);
- base::ListValue* wifi_access_point_list = new base::ListValue();
+ auto wifi_access_point_list = base::MakeUnique<base::ListValue>();
for (auto* ap_data : access_points_by_signal_strength) {
- std::unique_ptr<base::DictionaryValue> wifi_dict(
- new base::DictionaryValue());
+ auto wifi_dict = base::MakeUnique<base::DictionaryValue>();
AddString("macAddress", base::UTF16ToUTF8(ap_data->mac_address),
wifi_dict.get());
AddInteger("signalStrength", ap_data->radio_signal_strength,
@@ -287,7 +288,7 @@ void AddWifiData(const WifiData& wifi_data,
AddInteger("signalToNoiseRatio", ap_data->signal_to_noise, wifi_dict.get());
wifi_access_point_list->Append(std::move(wifi_dict));
}
- request->Set("wifiAccessPoints", wifi_access_point_list);
+ request->Set("wifiAccessPoints", std::move(wifi_access_point_list));
}
void FormatPositionError(const GURL& server_url,
« no previous file with comments | « dbus/values_util_unittest.cc ('k') | extensions/browser/api/socket/socket_api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698