| 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 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 107 #if defined(OS_CHROMEOS) | 107 #if defined(OS_CHROMEOS) |
| 108 return new chromeos::ProxyConfigServiceImpl(NULL, local_state_prefs); | 108 return new chromeos::ProxyConfigServiceImpl(NULL, local_state_prefs); |
| 109 #else | 109 #else |
| 110 return new PrefProxyConfigTrackerImpl( | 110 return new PrefProxyConfigTrackerImpl( |
| 111 local_state_prefs, | 111 local_state_prefs, |
| 112 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO)); | 112 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO)); |
| 113 #endif // defined(OS_CHROMEOS) | 113 #endif // defined(OS_CHROMEOS) |
| 114 } | 114 } |
| 115 | 115 |
| 116 // static | 116 // static |
| 117 net::ProxyService* ProxyServiceFactory::CreateProxyService( | 117 scoped_ptr<net::ProxyService> ProxyServiceFactory::CreateProxyService( |
| 118 net::NetLog* net_log, | 118 net::NetLog* net_log, |
| 119 net::URLRequestContext* context, | 119 net::URLRequestContext* context, |
| 120 net::NetworkDelegate* network_delegate, | 120 net::NetworkDelegate* network_delegate, |
| 121 net::ProxyConfigService* proxy_config_service, | 121 net::ProxyConfigService* proxy_config_service, |
| 122 const base::CommandLine& command_line, | 122 const base::CommandLine& command_line, |
| 123 bool quick_check_enabled) { | 123 bool quick_check_enabled) { |
| 124 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 124 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
| 125 #if defined(OS_IOS) | 125 #if defined(OS_IOS) |
| 126 bool use_v8 = false; | 126 bool use_v8 = false; |
| 127 #else | 127 #else |
| (...skipping 16 matching lines...) Expand all Loading... |
| 144 | 144 |
| 145 // Parse the switch (it should be a positive integer formatted as decimal). | 145 // Parse the switch (it should be a positive integer formatted as decimal). |
| 146 int n; | 146 int n; |
| 147 if (base::StringToInt(s, &n) && n > 0) { | 147 if (base::StringToInt(s, &n) && n > 0) { |
| 148 num_pac_threads = static_cast<size_t>(n); | 148 num_pac_threads = static_cast<size_t>(n); |
| 149 } else { | 149 } else { |
| 150 LOG(ERROR) << "Invalid switch for number of PAC threads: " << s; | 150 LOG(ERROR) << "Invalid switch for number of PAC threads: " << s; |
| 151 } | 151 } |
| 152 } | 152 } |
| 153 | 153 |
| 154 net::ProxyService* proxy_service = NULL; | 154 scoped_ptr<net::ProxyService> proxy_service; |
| 155 if (use_v8) { | 155 if (use_v8) { |
| 156 #if defined(OS_IOS) | 156 #if defined(OS_IOS) |
| 157 NOTREACHED(); | 157 NOTREACHED(); |
| 158 #else | 158 #else |
| 159 scoped_ptr<net::DhcpProxyScriptFetcher> dhcp_proxy_script_fetcher; | 159 scoped_ptr<net::DhcpProxyScriptFetcher> dhcp_proxy_script_fetcher; |
| 160 #if defined(OS_CHROMEOS) | 160 #if defined(OS_CHROMEOS) |
| 161 dhcp_proxy_script_fetcher.reset( | 161 dhcp_proxy_script_fetcher.reset( |
| 162 new chromeos::DhcpProxyScriptFetcherChromeos(context)); | 162 new chromeos::DhcpProxyScriptFetcherChromeos(context)); |
| 163 #else | 163 #else |
| 164 net::DhcpProxyScriptFetcherFactory dhcp_factory; | 164 net::DhcpProxyScriptFetcherFactory dhcp_factory; |
| (...skipping 28 matching lines...) Expand all Loading... |
| 193 proxy_service = net::ProxyService::CreateUsingSystemProxyResolver( | 193 proxy_service = net::ProxyService::CreateUsingSystemProxyResolver( |
| 194 proxy_config_service, | 194 proxy_config_service, |
| 195 num_pac_threads, | 195 num_pac_threads, |
| 196 net_log); | 196 net_log); |
| 197 } | 197 } |
| 198 | 198 |
| 199 proxy_service->set_quick_check_enabled(quick_check_enabled); | 199 proxy_service->set_quick_check_enabled(quick_check_enabled); |
| 200 | 200 |
| 201 return proxy_service; | 201 return proxy_service; |
| 202 } | 202 } |
| OLD | NEW |