OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/proxy_config/pref_proxy_config_tracker_impl.h" | 5 #include "components/proxy_config/pref_proxy_config_tracker_impl.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
| 9 #include <utility> |
| 10 |
9 #include "base/bind.h" | 11 #include "base/bind.h" |
10 #include "base/location.h" | 12 #include "base/location.h" |
11 #include "base/single_thread_task_runner.h" | 13 #include "base/single_thread_task_runner.h" |
12 #include "base/values.h" | 14 #include "base/values.h" |
13 #include "components/pref_registry/pref_registry_syncable.h" | 15 #include "components/pref_registry/pref_registry_syncable.h" |
14 #include "components/prefs/pref_registry_simple.h" | 16 #include "components/prefs/pref_registry_simple.h" |
15 #include "components/prefs/pref_service.h" | 17 #include "components/prefs/pref_service.h" |
16 #include "components/proxy_config/proxy_config_dictionary.h" | 18 #include "components/proxy_config/proxy_config_dictionary.h" |
17 #include "components/proxy_config/proxy_config_pref_names.h" | 19 #include "components/proxy_config/proxy_config_pref_names.h" |
18 #include "net/proxy/proxy_server.h" | 20 #include "net/proxy/proxy_server.h" |
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
198 return net::ProxyConfigService::CONFIG_VALID; | 200 return net::ProxyConfigService::CONFIG_VALID; |
199 } | 201 } |
200 | 202 |
201 *effective_config_state = ProxyPrefs::CONFIG_SYSTEM; | 203 *effective_config_state = ProxyPrefs::CONFIG_SYSTEM; |
202 *effective_config = system_config; | 204 *effective_config = system_config; |
203 return system_availability; | 205 return system_availability; |
204 } | 206 } |
205 | 207 |
206 // static | 208 // static |
207 void PrefProxyConfigTrackerImpl::RegisterPrefs(PrefRegistrySimple* registry) { | 209 void PrefProxyConfigTrackerImpl::RegisterPrefs(PrefRegistrySimple* registry) { |
208 base::DictionaryValue* default_settings = | 210 std::unique_ptr<base::DictionaryValue> default_settings( |
209 ProxyConfigDictionary::CreateSystem(); | 211 ProxyConfigDictionary::CreateSystem()); |
210 registry->RegisterDictionaryPref(proxy_config::prefs::kProxy, | 212 registry->RegisterDictionaryPref(proxy_config::prefs::kProxy, |
211 default_settings); | 213 std::move(default_settings)); |
212 } | 214 } |
213 | 215 |
214 // static | 216 // static |
215 void PrefProxyConfigTrackerImpl::RegisterProfilePrefs( | 217 void PrefProxyConfigTrackerImpl::RegisterProfilePrefs( |
216 user_prefs::PrefRegistrySyncable* pref_service) { | 218 user_prefs::PrefRegistrySyncable* pref_service) { |
217 base::DictionaryValue* default_settings = | 219 std::unique_ptr<base::DictionaryValue> default_settings( |
218 ProxyConfigDictionary::CreateSystem(); | 220 ProxyConfigDictionary::CreateSystem()); |
219 pref_service->RegisterDictionaryPref(proxy_config::prefs::kProxy, | 221 pref_service->RegisterDictionaryPref(proxy_config::prefs::kProxy, |
220 default_settings); | 222 std::move(default_settings)); |
221 pref_service->RegisterBooleanPref(proxy_config::prefs::kUseSharedProxies, | 223 pref_service->RegisterBooleanPref(proxy_config::prefs::kUseSharedProxies, |
222 false); | 224 false); |
223 } | 225 } |
224 | 226 |
225 // static | 227 // static |
226 ProxyPrefs::ConfigState PrefProxyConfigTrackerImpl::ReadPrefConfig( | 228 ProxyPrefs::ConfigState PrefProxyConfigTrackerImpl::ReadPrefConfig( |
227 const PrefService* pref_service, | 229 const PrefService* pref_service, |
228 net::ProxyConfig* config) { | 230 net::ProxyConfig* config) { |
229 // Clear the configuration and source. | 231 // Clear the configuration and source. |
230 *config = net::ProxyConfig(); | 232 *config = net::ProxyConfig(); |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
349 (config_state_ != ProxyPrefs::CONFIG_UNSET && | 351 (config_state_ != ProxyPrefs::CONFIG_UNSET && |
350 !pref_config_.Equals(new_config))) { | 352 !pref_config_.Equals(new_config))) { |
351 config_state_ = config_state; | 353 config_state_ = config_state; |
352 if (config_state_ != ProxyPrefs::CONFIG_UNSET) | 354 if (config_state_ != ProxyPrefs::CONFIG_UNSET) |
353 pref_config_ = new_config; | 355 pref_config_ = new_config; |
354 update_pending_ = true; | 356 update_pending_ = true; |
355 } | 357 } |
356 if (update_pending_) | 358 if (update_pending_) |
357 OnProxyConfigChanged(config_state, new_config); | 359 OnProxyConfigChanged(config_state, new_config); |
358 } | 360 } |
OLD | NEW |