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

Unified Diff: components/proxy_config/pref_proxy_config_tracker_impl.cc

Issue 2785883003: Use unique_ptr<DictionaryValue> in ProxyConfigDictionary (Closed)
Patch Set: one constructor Created 3 years, 9 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
Index: components/proxy_config/pref_proxy_config_tracker_impl.cc
diff --git a/components/proxy_config/pref_proxy_config_tracker_impl.cc b/components/proxy_config/pref_proxy_config_tracker_impl.cc
index 9c8da06904abb0db3520518b0269936b643a4e3a..f8077aa9032038126769864d3a64ebc23e3f82f1 100644
--- a/components/proxy_config/pref_proxy_config_tracker_impl.cc
+++ b/components/proxy_config/pref_proxy_config_tracker_impl.cc
@@ -6,6 +6,7 @@
#include <stddef.h>
+#include <memory>
#include <utility>
#include "base/bind.h"
@@ -207,8 +208,8 @@ net::ProxyConfigService::ConfigAvailability
// static
void PrefProxyConfigTrackerImpl::RegisterPrefs(PrefRegistrySimple* registry) {
- std::unique_ptr<base::DictionaryValue> default_settings(
- ProxyConfigDictionary::CreateSystem());
+ std::unique_ptr<base::DictionaryValue> default_settings =
+ ProxyConfigDictionary::CreateSystem();
registry->RegisterDictionaryPref(proxy_config::prefs::kProxy,
std::move(default_settings));
}
@@ -216,8 +217,8 @@ void PrefProxyConfigTrackerImpl::RegisterPrefs(PrefRegistrySimple* registry) {
// static
void PrefProxyConfigTrackerImpl::RegisterProfilePrefs(
user_prefs::PrefRegistrySyncable* pref_service) {
- std::unique_ptr<base::DictionaryValue> default_settings(
- ProxyConfigDictionary::CreateSystem());
+ std::unique_ptr<base::DictionaryValue> default_settings =
+ ProxyConfigDictionary::CreateSystem();
pref_service->RegisterDictionaryPref(proxy_config::prefs::kProxy,
std::move(default_settings));
pref_service->RegisterBooleanPref(proxy_config::prefs::kUseSharedProxies,
@@ -239,7 +240,7 @@ ProxyPrefs::ConfigState PrefProxyConfigTrackerImpl::ReadPrefConfig(
const base::DictionaryValue* dict =
pref_service->GetDictionary(proxy_config::prefs::kProxy);
DCHECK(dict);
- ProxyConfigDictionary proxy_dict(dict);
+ ProxyConfigDictionary proxy_dict(dict->CreateDeepCopy());
if (PrefConfigToNetConfig(proxy_dict, config)) {
if (!pref->IsUserModifiable() || pref->HasUserSetting()) {

Powered by Google App Engine
This is Rietveld 408576698