| 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/strings/string_number_conversions.h" | 10 #include "base/strings/string_number_conversions.h" |
| (...skipping 25 matching lines...) Expand all Loading... |
| 36 #include "net/proxy/proxy_service_mojo.h" | 36 #include "net/proxy/proxy_service_mojo.h" |
| 37 #endif | 37 #endif |
| 38 | 38 |
| 39 using content::BrowserThread; | 39 using content::BrowserThread; |
| 40 | 40 |
| 41 // static | 41 // static |
| 42 net::ProxyConfigService* ProxyServiceFactory::CreateProxyConfigService( | 42 net::ProxyConfigService* ProxyServiceFactory::CreateProxyConfigService( |
| 43 PrefProxyConfigTracker* tracker) { | 43 PrefProxyConfigTracker* tracker) { |
| 44 // The linux gconf-based proxy settings getter relies on being initialized | 44 // The linux gconf-based proxy settings getter relies on being initialized |
| 45 // from the UI thread. | 45 // from the UI thread. |
| 46 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 46 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 47 | 47 |
| 48 scoped_ptr<net::ProxyConfigService> base_service; | 48 scoped_ptr<net::ProxyConfigService> base_service; |
| 49 | 49 |
| 50 #if !defined(OS_CHROMEOS) | 50 #if !defined(OS_CHROMEOS) |
| 51 // On ChromeOS, base service is NULL; chromeos::ProxyConfigServiceImpl | 51 // On ChromeOS, base service is NULL; chromeos::ProxyConfigServiceImpl |
| 52 // determines the effective proxy config to take effect in the network layer, | 52 // determines the effective proxy config to take effect in the network layer, |
| 53 // be it from prefs or system (which is network shill on chromeos). | 53 // be it from prefs or system (which is network shill on chromeos). |
| 54 | 54 |
| 55 // For other platforms, create a baseline service that provides proxy | 55 // For other platforms, create a baseline service that provides proxy |
| 56 // configuration in case nothing is configured through prefs (Note: prefs | 56 // configuration in case nothing is configured through prefs (Note: prefs |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 92 } | 92 } |
| 93 | 93 |
| 94 // static | 94 // static |
| 95 net::ProxyService* ProxyServiceFactory::CreateProxyService( | 95 net::ProxyService* ProxyServiceFactory::CreateProxyService( |
| 96 net::NetLog* net_log, | 96 net::NetLog* net_log, |
| 97 net::URLRequestContext* context, | 97 net::URLRequestContext* context, |
| 98 net::NetworkDelegate* network_delegate, | 98 net::NetworkDelegate* network_delegate, |
| 99 net::ProxyConfigService* proxy_config_service, | 99 net::ProxyConfigService* proxy_config_service, |
| 100 const base::CommandLine& command_line, | 100 const base::CommandLine& command_line, |
| 101 bool quick_check_enabled) { | 101 bool quick_check_enabled) { |
| 102 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 102 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
| 103 #if defined(OS_IOS) | 103 #if defined(OS_IOS) |
| 104 bool use_v8 = false; | 104 bool use_v8 = false; |
| 105 #else | 105 #else |
| 106 bool use_v8 = !command_line.HasSwitch(switches::kWinHttpProxyResolver); | 106 bool use_v8 = !command_line.HasSwitch(switches::kWinHttpProxyResolver); |
| 107 // TODO(eroman): Figure out why this doesn't work in single-process mode. | 107 // TODO(eroman): Figure out why this doesn't work in single-process mode. |
| 108 // Should be possible now that a private isolate is used. | 108 // Should be possible now that a private isolate is used. |
| 109 // http://crbug.com/474654 | 109 // http://crbug.com/474654 |
| 110 if (use_v8 && command_line.HasSwitch(switches::kSingleProcess)) { | 110 if (use_v8 && command_line.HasSwitch(switches::kSingleProcess)) { |
| 111 LOG(ERROR) << "Cannot use V8 Proxy resolver in single process mode."; | 111 LOG(ERROR) << "Cannot use V8 Proxy resolver in single process mode."; |
| 112 use_v8 = false; // Fallback to non-v8 implementation. | 112 use_v8 = false; // Fallback to non-v8 implementation. |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 169 proxy_service = net::ProxyService::CreateUsingSystemProxyResolver( | 169 proxy_service = net::ProxyService::CreateUsingSystemProxyResolver( |
| 170 proxy_config_service, | 170 proxy_config_service, |
| 171 num_pac_threads, | 171 num_pac_threads, |
| 172 net_log); | 172 net_log); |
| 173 } | 173 } |
| 174 | 174 |
| 175 proxy_service->set_quick_check_enabled(quick_check_enabled); | 175 proxy_service->set_quick_check_enabled(quick_check_enabled); |
| 176 | 176 |
| 177 return proxy_service; | 177 return proxy_service; |
| 178 } | 178 } |
| OLD | NEW |