| Index: chrome/browser/net/chrome_url_request_context.cc
|
| diff --git a/chrome/browser/net/chrome_url_request_context.cc b/chrome/browser/net/chrome_url_request_context.cc
|
| index 4ec39395e965a626e698bcc73a408d399875ba03..bd3e9c685e469efb5e5f464b8b1401dad24bd1c3 100644
|
| --- a/chrome/browser/net/chrome_url_request_context.cc
|
| +++ b/chrome/browser/net/chrome_url_request_context.cc
|
| @@ -18,6 +18,7 @@
|
| #include "chrome/browser/net/chrome_net_log.h"
|
| #include "chrome/browser/net/sqlite_persistent_cookie_store.h"
|
| #include "chrome/browser/net/predictor_api.h"
|
| +#include "chrome/browser/net/pref_proxy_config_service.h"
|
| #include "chrome/browser/profile.h"
|
| #include "chrome/common/chrome_constants.h"
|
| #include "chrome/common/chrome_switches.h"
|
| @@ -68,26 +69,25 @@ net::ProxyConfigService* CreateProxyConfigService(Profile* profile) {
|
| // from the UI thread.
|
| CheckCurrentlyOnMainThread();
|
|
|
| - scoped_ptr<net::ProxyConfig> proxy_config(CreateProxyConfig(
|
| - profile->GetPrefs()));
|
| + // Create a baseline service that provides proxy configuration in case nothing
|
| + // is configured through prefs (Note: prefs include command line and
|
| + // configuration policy).
|
| + net::ProxyConfigService* base_service = NULL;
|
|
|
| - if (!proxy_config.get()) {
|
| - // Use system settings.
|
| - // TODO(port): the IO and FILE message loops are only used by Linux. Can
|
| - // that code be moved to chrome/browser instead of being in net, so that it
|
| - // can use BrowserThread instead of raw MessageLoop pointers? See bug 25354.
|
| + // TODO(port): the IO and FILE message loops are only used by Linux. Can
|
| + // that code be moved to chrome/browser instead of being in net, so that it
|
| + // can use BrowserThread instead of raw MessageLoop pointers? See bug 25354.
|
| #if defined(OS_CHROMEOS)
|
| - return new chromeos::ProxyConfigService(
|
| - profile->GetChromeOSProxyConfigServiceImpl());
|
| + base_service = new chromeos::ProxyConfigService(
|
| + profile->GetChromeOSProxyConfigServiceImpl());
|
| #else
|
| - return net::ProxyService::CreateSystemProxyConfigService(
|
| - g_browser_process->io_thread()->message_loop(),
|
| - g_browser_process->file_thread()->message_loop());
|
| + base_service = net::ProxyService::CreateSystemProxyConfigService(
|
| + g_browser_process->io_thread()->message_loop(),
|
| + g_browser_process->file_thread()->message_loop());
|
| #endif // defined(OS_CHROMEOS)
|
| - }
|
|
|
| - // Otherwise use the fixed settings from the command line.
|
| - return new net::ProxyConfigServiceFixed(*proxy_config.get());
|
| + return new PrefProxyConfigService(profile->GetProxyConfigTracker(),
|
| + base_service);
|
| }
|
|
|
| // Create a proxy service according to the options on command line.
|
| @@ -982,64 +982,3 @@ void ChromeURLRequestContextFactory::ApplyProfileParametersToContext(
|
| context->set_browser_file_system_context(browser_file_system_context_);
|
| context->set_extension_info_map(extension_info_map_);
|
| }
|
| -
|
| -// ----------------------------------------------------------------------------
|
| -
|
| -net::ProxyConfig* CreateProxyConfig(const PrefService* pref_service) {
|
| - // Scan for all "enable" type proxy switches.
|
| - static const char* proxy_prefs[] = {
|
| - prefs::kProxyPacUrl,
|
| - prefs::kProxyServer,
|
| - prefs::kProxyBypassList,
|
| - prefs::kProxyAutoDetect
|
| - };
|
| -
|
| - // Check whether the preference system holds a valid proxy configuration. Note
|
| - // that preferences coming from a lower-priority source than the user settings
|
| - // are ignored. That's because chrome treats the system settings as the
|
| - // default values, which should apply if there's no explicit value forced by
|
| - // policy or the user.
|
| - bool found_enable_proxy_pref = false;
|
| - for (size_t i = 0; i < arraysize(proxy_prefs); i++) {
|
| - const PrefService::Preference* pref =
|
| - pref_service->FindPreference(proxy_prefs[i]);
|
| - DCHECK(pref);
|
| - if (pref && (!pref->IsUserModifiable() || pref->HasUserSetting())) {
|
| - found_enable_proxy_pref = true;
|
| - break;
|
| - }
|
| - }
|
| -
|
| - if (!found_enable_proxy_pref &&
|
| - !pref_service->GetBoolean(prefs::kNoProxyServer)) {
|
| - return NULL;
|
| - }
|
| -
|
| - net::ProxyConfig* proxy_config = new net::ProxyConfig();
|
| - if (pref_service->GetBoolean(prefs::kNoProxyServer)) {
|
| - // Ignore all the other proxy config preferences if the use of a proxy
|
| - // has been explicitly disabled.
|
| - return proxy_config;
|
| - }
|
| -
|
| - if (pref_service->HasPrefPath(prefs::kProxyServer)) {
|
| - std::string proxy_server = pref_service->GetString(prefs::kProxyServer);
|
| - proxy_config->proxy_rules().ParseFromString(proxy_server);
|
| - }
|
| -
|
| - if (pref_service->HasPrefPath(prefs::kProxyPacUrl)) {
|
| - std::string proxy_pac = pref_service->GetString(prefs::kProxyPacUrl);
|
| - proxy_config->set_pac_url(GURL(proxy_pac));
|
| - }
|
| -
|
| - proxy_config->set_auto_detect(pref_service->GetBoolean(
|
| - prefs::kProxyAutoDetect));
|
| -
|
| - if (pref_service->HasPrefPath(prefs::kProxyBypassList)) {
|
| - std::string proxy_bypass =
|
| - pref_service->GetString(prefs::kProxyBypassList);
|
| - proxy_config->proxy_rules().bypass_rules.ParseFromString(proxy_bypass);
|
| - }
|
| -
|
| - return proxy_config;
|
| -}
|
|
|