| 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 "chrome/browser/net/pref_proxy_config_tracker_impl.h" | 5 #include "chrome/browser/net/pref_proxy_config_tracker_impl.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/values.h" | 8 #include "base/values.h" |
| 9 #include "chrome/browser/prefs/pref_registry_simple.h" | 9 #include "chrome/browser/prefs/pref_registry_simple.h" |
| 10 #include "chrome/browser/prefs/pref_registry_syncable.h" |
| 10 #include "chrome/browser/prefs/pref_service.h" | 11 #include "chrome/browser/prefs/pref_service.h" |
| 11 #include "chrome/browser/prefs/proxy_config_dictionary.h" | 12 #include "chrome/browser/prefs/proxy_config_dictionary.h" |
| 12 #include "chrome/common/chrome_notification_types.h" | 13 #include "chrome/common/chrome_notification_types.h" |
| 13 #include "chrome/common/pref_names.h" | 14 #include "chrome/common/pref_names.h" |
| 14 #include "content/public/browser/browser_thread.h" | 15 #include "content/public/browser/browser_thread.h" |
| 15 #include "content/public/browser/notification_details.h" | 16 #include "content/public/browser/notification_details.h" |
| 16 #include "content/public/browser/notification_source.h" | 17 #include "content/public/browser/notification_source.h" |
| 17 | 18 |
| 18 using content::BrowserThread; | 19 using content::BrowserThread; |
| 19 | 20 |
| (...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 196 } | 197 } |
| 197 | 198 |
| 198 // static | 199 // static |
| 199 void PrefProxyConfigTrackerImpl::RegisterPrefs(PrefRegistrySimple* registry) { | 200 void PrefProxyConfigTrackerImpl::RegisterPrefs(PrefRegistrySimple* registry) { |
| 200 DictionaryValue* default_settings = ProxyConfigDictionary::CreateSystem(); | 201 DictionaryValue* default_settings = ProxyConfigDictionary::CreateSystem(); |
| 201 registry->RegisterDictionaryPref(prefs::kProxy, default_settings); | 202 registry->RegisterDictionaryPref(prefs::kProxy, default_settings); |
| 202 } | 203 } |
| 203 | 204 |
| 204 // static | 205 // static |
| 205 void PrefProxyConfigTrackerImpl::RegisterUserPrefs( | 206 void PrefProxyConfigTrackerImpl::RegisterUserPrefs( |
| 206 PrefServiceSyncable* pref_service) { | 207 PrefRegistrySyncable* pref_service) { |
| 207 DictionaryValue* default_settings = ProxyConfigDictionary::CreateSystem(); | 208 DictionaryValue* default_settings = ProxyConfigDictionary::CreateSystem(); |
| 208 pref_service->RegisterDictionaryPref(prefs::kProxy, | 209 pref_service->RegisterDictionaryPref(prefs::kProxy, |
| 209 default_settings, | 210 default_settings, |
| 210 PrefServiceSyncable::UNSYNCABLE_PREF); | 211 PrefRegistrySyncable::UNSYNCABLE_PREF); |
| 211 } | 212 } |
| 212 | 213 |
| 213 ProxyPrefs::ConfigState PrefProxyConfigTrackerImpl::GetProxyConfig( | 214 ProxyPrefs::ConfigState PrefProxyConfigTrackerImpl::GetProxyConfig( |
| 214 net::ProxyConfig* config) { | 215 net::ProxyConfig* config) { |
| 215 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 216 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 216 if (config_state_ != ProxyPrefs::CONFIG_UNSET) | 217 if (config_state_ != ProxyPrefs::CONFIG_UNSET) |
| 217 *config = pref_config_; | 218 *config = pref_config_; |
| 218 return config_state_; | 219 return config_state_; |
| 219 } | 220 } |
| 220 | 221 |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 336 config_state = ProxyPrefs::CONFIG_EXTENSION; | 337 config_state = ProxyPrefs::CONFIG_EXTENSION; |
| 337 else | 338 else |
| 338 config_state = ProxyPrefs::CONFIG_OTHER_PRECEDE; | 339 config_state = ProxyPrefs::CONFIG_OTHER_PRECEDE; |
| 339 } else { | 340 } else { |
| 340 config_state = ProxyPrefs::CONFIG_FALLBACK; | 341 config_state = ProxyPrefs::CONFIG_FALLBACK; |
| 341 } | 342 } |
| 342 } | 343 } |
| 343 | 344 |
| 344 return config_state; | 345 return config_state; |
| 345 } | 346 } |
| OLD | NEW |