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 "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/string_number_conversions.h" | 8 #include "base/string_number_conversions.h" |
9 #include "base/threading/thread.h" | 9 #include "base/threading/thread.h" |
10 #include "chrome/browser/browser_process.h" | 10 #include "chrome/browser/browser_process.h" |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
99 | 99 |
100 // Parse the switch (it should be a positive integer formatted as decimal). | 100 // Parse the switch (it should be a positive integer formatted as decimal). |
101 int n; | 101 int n; |
102 if (base::StringToInt(s, &n) && n > 0) { | 102 if (base::StringToInt(s, &n) && n > 0) { |
103 num_pac_threads = static_cast<size_t>(n); | 103 num_pac_threads = static_cast<size_t>(n); |
104 } else { | 104 } else { |
105 LOG(ERROR) << "Invalid switch for number of PAC threads: " << s; | 105 LOG(ERROR) << "Invalid switch for number of PAC threads: " << s; |
106 } | 106 } |
107 } | 107 } |
108 | 108 |
109 net::ProxyService* proxy_service; | 109 net::ProxyService* proxy_service = NULL; |
110 if (use_v8) { | 110 if (use_v8) { |
111 #if defined(OS_IOS) | 111 #if defined(OS_IOS) |
112 NOTREACHED(); | 112 NOTREACHED(); |
113 #else | 113 #else |
114 net::DhcpProxyScriptFetcherFactory dhcp_factory; | 114 net::DhcpProxyScriptFetcherFactory dhcp_factory; |
115 if (command_line.HasSwitch(switches::kDisableDhcpWpad)) { | 115 if (command_line.HasSwitch(switches::kDisableDhcpWpad)) { |
116 dhcp_factory.set_enabled(false); | 116 dhcp_factory.set_enabled(false); |
117 } | 117 } |
118 | 118 |
119 proxy_service = net::CreateProxyServiceUsingV8ProxyResolver( | 119 proxy_service = net::CreateProxyServiceUsingV8ProxyResolver( |
120 proxy_config_service, | 120 proxy_config_service, |
121 num_pac_threads, | 121 num_pac_threads, |
122 new net::ProxyScriptFetcherImpl(context), | 122 new net::ProxyScriptFetcherImpl(context), |
123 dhcp_factory.Create(context), | 123 dhcp_factory.Create(context), |
124 context->host_resolver(), | 124 context->host_resolver(), |
125 net_log, | 125 net_log, |
126 context->network_delegate()); | 126 context->network_delegate()); |
127 #endif // defined(OS_IOS) | 127 #endif // defined(OS_IOS) |
128 } else { | 128 } else { |
129 proxy_service = net::ProxyService::CreateUsingSystemProxyResolver( | 129 proxy_service = net::ProxyService::CreateUsingSystemProxyResolver( |
130 proxy_config_service, | 130 proxy_config_service, |
131 num_pac_threads, | 131 num_pac_threads, |
132 net_log); | 132 net_log); |
133 } | 133 } |
134 | 134 |
135 return proxy_service; | 135 return proxy_service; |
136 } | 136 } |
OLD | NEW |