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_service.h" | 9 #include "chrome/browser/prefs/pref_service.h" |
10 #include "chrome/browser/prefs/proxy_config_dictionary.h" | 10 #include "chrome/browser/prefs/proxy_config_dictionary.h" |
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
189 *effective_config = net::ProxyConfig::CreateDirect(); | 189 *effective_config = net::ProxyConfig::CreateDirect(); |
190 return net::ProxyConfigService::CONFIG_VALID; | 190 return net::ProxyConfigService::CONFIG_VALID; |
191 } | 191 } |
192 | 192 |
193 *effective_config_state = ProxyPrefs::CONFIG_SYSTEM; | 193 *effective_config_state = ProxyPrefs::CONFIG_SYSTEM; |
194 *effective_config = system_config; | 194 *effective_config = system_config; |
195 return system_availability; | 195 return system_availability; |
196 } | 196 } |
197 | 197 |
198 // static | 198 // static |
199 void PrefProxyConfigTrackerImpl::RegisterPrefs(PrefService* pref_service) { | 199 void PrefProxyConfigTrackerImpl::RegisterPrefs( |
| 200 PrefServiceSimple* local_state) { |
| 201 DictionaryValue* default_settings = ProxyConfigDictionary::CreateSystem(); |
| 202 local_state->RegisterDictionaryPref(prefs::kProxy, default_settings); |
| 203 } |
| 204 |
| 205 // static |
| 206 void PrefProxyConfigTrackerImpl::RegisterUserPrefs( |
| 207 PrefServiceSyncable* pref_service) { |
200 DictionaryValue* default_settings = ProxyConfigDictionary::CreateSystem(); | 208 DictionaryValue* default_settings = ProxyConfigDictionary::CreateSystem(); |
201 pref_service->RegisterDictionaryPref(prefs::kProxy, | 209 pref_service->RegisterDictionaryPref(prefs::kProxy, |
202 default_settings, | 210 default_settings, |
203 PrefService::UNSYNCABLE_PREF); | 211 PrefServiceSyncable::UNSYNCABLE_PREF); |
204 } | 212 } |
205 | 213 |
206 ProxyPrefs::ConfigState PrefProxyConfigTrackerImpl::GetProxyConfig( | 214 ProxyPrefs::ConfigState PrefProxyConfigTrackerImpl::GetProxyConfig( |
207 net::ProxyConfig* config) { | 215 net::ProxyConfig* config) { |
208 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 216 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
209 if (config_state_ != ProxyPrefs::CONFIG_UNSET) | 217 if (config_state_ != ProxyPrefs::CONFIG_UNSET) |
210 *config = pref_config_; | 218 *config = pref_config_; |
211 return config_state_; | 219 return config_state_; |
212 } | 220 } |
213 | 221 |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
329 config_state = ProxyPrefs::CONFIG_EXTENSION; | 337 config_state = ProxyPrefs::CONFIG_EXTENSION; |
330 else | 338 else |
331 config_state = ProxyPrefs::CONFIG_OTHER_PRECEDE; | 339 config_state = ProxyPrefs::CONFIG_OTHER_PRECEDE; |
332 } else { | 340 } else { |
333 config_state = ProxyPrefs::CONFIG_FALLBACK; | 341 config_state = ProxyPrefs::CONFIG_FALLBACK; |
334 } | 342 } |
335 } | 343 } |
336 | 344 |
337 return config_state; | 345 return config_state; |
338 } | 346 } |
OLD | NEW |