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