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/strings/string_number_conversions.h" | 8 #include "base/strings/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" |
11 #include "chrome/browser/io_thread.h" | 11 #include "chrome/browser/io_thread.h" |
12 #include "chrome/browser/net/pref_proxy_config_tracker_impl.h" | 12 #include "chrome/browser/net/pref_proxy_config_tracker_impl.h" |
13 #include "chrome/common/chrome_switches.h" | 13 #include "chrome/common/chrome_switches.h" |
14 #include "content/public/browser/browser_thread.h" | 14 #include "content/public/browser/browser_thread.h" |
15 #include "net/base/net_log.h" | 15 #include "net/base/net_log.h" |
16 #include "net/proxy/dhcp_proxy_script_fetcher_factory.h" | 16 #include "net/proxy/dhcp_proxy_script_fetcher_factory.h" |
17 #include "net/proxy/proxy_config_service.h" | 17 #include "net/proxy/proxy_config_service.h" |
18 #include "net/proxy/proxy_script_fetcher_impl.h" | 18 #include "net/proxy/proxy_script_fetcher_impl.h" |
19 #include "net/proxy/proxy_service.h" | 19 #include "net/proxy/proxy_service.h" |
20 #include "net/proxy/proxy_service_v8.h" | 20 #include "net/proxy/proxy_service_v8.h" |
21 #include "net/url_request/url_request_context.h" | 21 #include "net/url_request/url_request_context.h" |
22 | 22 |
23 #if defined(OS_CHROMEOS) | 23 #if defined(OS_CHROMEOS) |
24 #include "chrome/browser/chromeos/proxy_config_service_impl.h" | 24 #include "chrome/browser/chromeos/proxy_config_service_impl.h" |
25 #include "chromeos/network/dhcp_proxy_script_fetcher_chromeos.h" | 25 #include "chromeos/network/dhcp_proxy_script_fetcher_chromeos.h" |
26 #endif // defined(OS_CHROMEOS) | 26 #endif // defined(OS_CHROMEOS) |
27 | 27 |
| 28 #if defined(OS_WIN) |
| 29 #include "win8/util/win8_util.h" |
| 30 #endif |
| 31 |
28 using content::BrowserThread; | 32 using content::BrowserThread; |
29 | 33 |
30 // static | 34 // static |
31 net::ProxyConfigService* ProxyServiceFactory::CreateProxyConfigService( | 35 net::ProxyConfigService* ProxyServiceFactory::CreateProxyConfigService( |
32 PrefProxyConfigTracker* tracker) { | 36 PrefProxyConfigTracker* tracker) { |
33 // The linux gconf-based proxy settings getter relies on being initialized | 37 // The linux gconf-based proxy settings getter relies on being initialized |
34 // from the UI thread. | 38 // from the UI thread. |
35 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 39 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
36 | 40 |
37 scoped_ptr<net::ProxyConfigService> base_service; | 41 scoped_ptr<net::ProxyConfigService> base_service; |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
94 #else | 98 #else |
95 bool use_v8 = !command_line.HasSwitch(switches::kWinHttpProxyResolver); | 99 bool use_v8 = !command_line.HasSwitch(switches::kWinHttpProxyResolver); |
96 if (use_v8 && command_line.HasSwitch(switches::kSingleProcess)) { | 100 if (use_v8 && command_line.HasSwitch(switches::kSingleProcess)) { |
97 // See the note about V8 multithreading in net/proxy/proxy_resolver_v8.h | 101 // See the note about V8 multithreading in net/proxy/proxy_resolver_v8.h |
98 // to understand why we have this limitation. | 102 // to understand why we have this limitation. |
99 LOG(ERROR) << "Cannot use V8 Proxy resolver in single process mode."; | 103 LOG(ERROR) << "Cannot use V8 Proxy resolver in single process mode."; |
100 use_v8 = false; // Fallback to non-v8 implementation. | 104 use_v8 = false; // Fallback to non-v8 implementation. |
101 } | 105 } |
102 #endif // defined(OS_IOS) | 106 #endif // defined(OS_IOS) |
103 | 107 |
| 108 #if defined(OS_WIN) |
| 109 // Crashes. http://crbug.com/266838 |
| 110 if (use_v8 && win8::IsSingleWindowMetroMode()) |
| 111 use_v8 = false; |
| 112 #endif |
| 113 |
104 size_t num_pac_threads = 0u; // Use default number of threads. | 114 size_t num_pac_threads = 0u; // Use default number of threads. |
105 | 115 |
106 // Check the command line for an override on the number of proxy resolver | 116 // Check the command line for an override on the number of proxy resolver |
107 // threads to use. | 117 // threads to use. |
108 if (command_line.HasSwitch(switches::kNumPacThreads)) { | 118 if (command_line.HasSwitch(switches::kNumPacThreads)) { |
109 std::string s = command_line.GetSwitchValueASCII(switches::kNumPacThreads); | 119 std::string s = command_line.GetSwitchValueASCII(switches::kNumPacThreads); |
110 | 120 |
111 // Parse the switch (it should be a positive integer formatted as decimal). | 121 // Parse the switch (it should be a positive integer formatted as decimal). |
112 int n; | 122 int n; |
113 if (base::StringToInt(s, &n) && n > 0) { | 123 if (base::StringToInt(s, &n) && n > 0) { |
(...skipping 29 matching lines...) Expand all Loading... |
143 #endif // defined(OS_IOS) | 153 #endif // defined(OS_IOS) |
144 } else { | 154 } else { |
145 proxy_service = net::ProxyService::CreateUsingSystemProxyResolver( | 155 proxy_service = net::ProxyService::CreateUsingSystemProxyResolver( |
146 proxy_config_service, | 156 proxy_config_service, |
147 num_pac_threads, | 157 num_pac_threads, |
148 net_log); | 158 net_log); |
149 } | 159 } |
150 | 160 |
151 return proxy_service; | 161 return proxy_service; |
152 } | 162 } |
OLD | NEW |