| 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/pref_set_observer.h" | 10 #include "chrome/browser/prefs/pref_set_observer.h" |
| (...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 307 } | 307 } |
| 308 if (update_pending_) | 308 if (update_pending_) |
| 309 OnProxyConfigChanged(config_state, new_config); | 309 OnProxyConfigChanged(config_state, new_config); |
| 310 } else { | 310 } else { |
| 311 NOTREACHED() << "Unexpected notification of type " << type; | 311 NOTREACHED() << "Unexpected notification of type " << type; |
| 312 } | 312 } |
| 313 } | 313 } |
| 314 | 314 |
| 315 ProxyPrefs::ConfigState PrefProxyConfigTrackerImpl::ReadPrefConfig( | 315 ProxyPrefs::ConfigState PrefProxyConfigTrackerImpl::ReadPrefConfig( |
| 316 net::ProxyConfig* config) { | 316 net::ProxyConfig* config) { |
| 317 #if defined(OS_IOS) | |
| 318 return ProxyPrefs::CONFIG_UNSET; | |
| 319 #else | |
| 320 | |
| 321 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 317 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 322 | 318 |
| 323 // Clear the configuration and source. | 319 // Clear the configuration and source. |
| 324 *config = net::ProxyConfig(); | 320 *config = net::ProxyConfig(); |
| 325 ProxyPrefs::ConfigState config_state = ProxyPrefs::CONFIG_UNSET; | 321 ProxyPrefs::ConfigState config_state = ProxyPrefs::CONFIG_UNSET; |
| 326 | 322 |
| 327 const PrefService::Preference* pref = | 323 const PrefService::Preference* pref = |
| 328 pref_service_->FindPreference(prefs::kProxy); | 324 pref_service_->FindPreference(prefs::kProxy); |
| 329 DCHECK(pref); | 325 DCHECK(pref); |
| 330 | 326 |
| 331 const DictionaryValue* dict = pref_service_->GetDictionary(prefs::kProxy); | 327 const DictionaryValue* dict = pref_service_->GetDictionary(prefs::kProxy); |
| 332 DCHECK(dict); | 328 DCHECK(dict); |
| 333 ProxyConfigDictionary proxy_dict(dict); | 329 ProxyConfigDictionary proxy_dict(dict); |
| 334 | 330 |
| 335 if (PrefConfigToNetConfig(proxy_dict, config)) { | 331 if (PrefConfigToNetConfig(proxy_dict, config)) { |
| 336 if (!pref->IsUserModifiable() || pref->HasUserSetting()) { | 332 if (!pref->IsUserModifiable() || pref->HasUserSetting()) { |
| 337 if (pref->IsManaged()) | 333 if (pref->IsManaged()) |
| 338 config_state = ProxyPrefs::CONFIG_POLICY; | 334 config_state = ProxyPrefs::CONFIG_POLICY; |
| 339 else if (pref->IsExtensionControlled()) | 335 else if (pref->IsExtensionControlled()) |
| 340 config_state = ProxyPrefs::CONFIG_EXTENSION; | 336 config_state = ProxyPrefs::CONFIG_EXTENSION; |
| 341 else | 337 else |
| 342 config_state = ProxyPrefs::CONFIG_OTHER_PRECEDE; | 338 config_state = ProxyPrefs::CONFIG_OTHER_PRECEDE; |
| 343 } else { | 339 } else { |
| 344 config_state = ProxyPrefs::CONFIG_FALLBACK; | 340 config_state = ProxyPrefs::CONFIG_FALLBACK; |
| 345 } | 341 } |
| 346 } | 342 } |
| 347 | 343 |
| 348 return config_state; | 344 return config_state; |
| 349 #endif // defined(OS_IOS) | |
| 350 } | 345 } |
| OLD | NEW |