| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/proxy_service_factory.h" | 5 #include "chrome/browser/net/proxy_service_factory.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/metrics/field_trial.h" | 10 #include "base/metrics/field_trial.h" |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 103 ProxyServiceFactory::CreatePrefProxyConfigTrackerOfLocalState( | 103 ProxyServiceFactory::CreatePrefProxyConfigTrackerOfLocalState( |
| 104 PrefService* local_state_prefs) { | 104 PrefService* local_state_prefs) { |
| 105 #if defined(OS_CHROMEOS) | 105 #if defined(OS_CHROMEOS) |
| 106 return new chromeos::ProxyConfigServiceImpl(NULL, local_state_prefs); | 106 return new chromeos::ProxyConfigServiceImpl(NULL, local_state_prefs); |
| 107 #else | 107 #else |
| 108 return new PrefProxyConfigTrackerImpl(local_state_prefs); | 108 return new PrefProxyConfigTrackerImpl(local_state_prefs); |
| 109 #endif // defined(OS_CHROMEOS) | 109 #endif // defined(OS_CHROMEOS) |
| 110 } | 110 } |
| 111 | 111 |
| 112 // static | 112 // static |
| 113 net::ProxyService* ProxyServiceFactory::CreateProxyService( | 113 scoped_ptr<net::ProxyService> ProxyServiceFactory::CreateProxyService( |
| 114 net::NetLog* net_log, | 114 net::NetLog* net_log, |
| 115 net::URLRequestContext* context, | 115 net::URLRequestContext* context, |
| 116 net::NetworkDelegate* network_delegate, | 116 net::NetworkDelegate* network_delegate, |
| 117 net::ProxyConfigService* proxy_config_service, | 117 net::ProxyConfigService* proxy_config_service, |
| 118 const base::CommandLine& command_line, | 118 const base::CommandLine& command_line, |
| 119 bool quick_check_enabled) { | 119 bool quick_check_enabled) { |
| 120 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 120 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
| 121 #if defined(OS_IOS) | 121 #if defined(OS_IOS) |
| 122 bool use_v8 = false; | 122 bool use_v8 = false; |
| 123 #else | 123 #else |
| (...skipping 16 matching lines...) Expand all Loading... |
| 140 | 140 |
| 141 // Parse the switch (it should be a positive integer formatted as decimal). | 141 // Parse the switch (it should be a positive integer formatted as decimal). |
| 142 int n; | 142 int n; |
| 143 if (base::StringToInt(s, &n) && n > 0) { | 143 if (base::StringToInt(s, &n) && n > 0) { |
| 144 num_pac_threads = static_cast<size_t>(n); | 144 num_pac_threads = static_cast<size_t>(n); |
| 145 } else { | 145 } else { |
| 146 LOG(ERROR) << "Invalid switch for number of PAC threads: " << s; | 146 LOG(ERROR) << "Invalid switch for number of PAC threads: " << s; |
| 147 } | 147 } |
| 148 } | 148 } |
| 149 | 149 |
| 150 net::ProxyService* proxy_service = NULL; | 150 scoped_ptr<net::ProxyService> proxy_service; |
| 151 if (use_v8) { | 151 if (use_v8) { |
| 152 #if defined(OS_IOS) | 152 #if defined(OS_IOS) |
| 153 NOTREACHED(); | 153 NOTREACHED(); |
| 154 #else | 154 #else |
| 155 net::DhcpProxyScriptFetcher* dhcp_proxy_script_fetcher; | 155 net::DhcpProxyScriptFetcher* dhcp_proxy_script_fetcher; |
| 156 #if defined(OS_CHROMEOS) | 156 #if defined(OS_CHROMEOS) |
| 157 dhcp_proxy_script_fetcher = | 157 dhcp_proxy_script_fetcher = |
| 158 new chromeos::DhcpProxyScriptFetcherChromeos(context); | 158 new chromeos::DhcpProxyScriptFetcherChromeos(context); |
| 159 #else | 159 #else |
| 160 net::DhcpProxyScriptFetcherFactory dhcp_factory; | 160 net::DhcpProxyScriptFetcherFactory dhcp_factory; |
| (...skipping 28 matching lines...) Expand all Loading... |
| 189 proxy_service = net::ProxyService::CreateUsingSystemProxyResolver( | 189 proxy_service = net::ProxyService::CreateUsingSystemProxyResolver( |
| 190 proxy_config_service, | 190 proxy_config_service, |
| 191 num_pac_threads, | 191 num_pac_threads, |
| 192 net_log); | 192 net_log); |
| 193 } | 193 } |
| 194 | 194 |
| 195 proxy_service->set_quick_check_enabled(quick_check_enabled); | 195 proxy_service->set_quick_check_enabled(quick_check_enabled); |
| 196 | 196 |
| 197 return proxy_service; | 197 return proxy_service; |
| 198 } | 198 } |
| OLD | NEW |