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

Side by Side Diff: chromeos/network/proxy/proxy_config_service_impl.cc

Issue 2785883003: Use unique_ptr<DictionaryValue> in ProxyConfigDictionary (Closed)
Patch Set: Fix compilation Created 3 years, 8 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "chromeos/network/proxy/proxy_config_service_impl.h" 5 #include "chromeos/network/proxy/proxy_config_service_impl.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "base/callback.h" 9 #include "base/callback.h"
10 #include "base/location.h" 10 #include "base/location.h"
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after
186 ProxyPrefs::ConfigState pref_state = 186 ProxyPrefs::ConfigState pref_state =
187 PrefProxyConfigTrackerImpl::ReadPrefConfig(profile_prefs, 187 PrefProxyConfigTrackerImpl::ReadPrefConfig(profile_prefs,
188 &pref_proxy_config); 188 &pref_proxy_config);
189 if (PrefProxyConfigTrackerImpl::PrefPrecedes(pref_state)) { 189 if (PrefProxyConfigTrackerImpl::PrefPrecedes(pref_state)) {
190 const PrefService::Preference* const pref = 190 const PrefService::Preference* const pref =
191 profile_prefs->FindPreference(::proxy_config::prefs::kProxy); 191 profile_prefs->FindPreference(::proxy_config::prefs::kProxy);
192 const base::DictionaryValue* proxy_config_value; 192 const base::DictionaryValue* proxy_config_value;
193 bool value_exists = pref->GetValue()->GetAsDictionary(&proxy_config_value); 193 bool value_exists = pref->GetValue()->GetAsDictionary(&proxy_config_value);
194 DCHECK(value_exists); 194 DCHECK(value_exists);
195 195
196 return base::MakeUnique<ProxyConfigDictionary>(proxy_config_value); 196 return base::MakeUnique<ProxyConfigDictionary>(
197 proxy_config_value->CreateDeepCopy());
197 } 198 }
198 199
199 const NetworkState* network = 200 const NetworkState* network =
200 NetworkHandler::Get()->network_state_handler()->DefaultNetwork(); 201 NetworkHandler::Get()->network_state_handler()->DefaultNetwork();
201 // No connected network. 202 // No connected network.
202 if (!network) 203 if (!network)
203 return nullptr; 204 return nullptr;
204 205
205 // Apply network proxy configuration. 206 // Apply network proxy configuration.
206 ::onc::ONCSource onc_source; 207 ::onc::ONCSource onc_source;
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
285 std::unique_ptr<base::DictionaryValue> config_dict( 286 std::unique_ptr<base::DictionaryValue> config_dict(
286 effective_config.ToValue()); 287 effective_config.ToValue());
287 VLOG(1) << this << ": Proxy changed: " 288 VLOG(1) << this << ": Proxy changed: "
288 << ProxyPrefs::ConfigStateToDebugString(active_config_state_) 289 << ProxyPrefs::ConfigStateToDebugString(active_config_state_)
289 << ", " << *config_dict; 290 << ", " << *config_dict;
290 } 291 }
291 } 292 }
292 } 293 }
293 294
294 } // namespace chromeos 295 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698