| 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 <stddef.h> | 7 #include <stddef.h> |
| 8 #include <string> | 8 #include <string> |
| 9 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 69 // be it from prefs or system (which is network shill on chromeos). | 69 // be it from prefs or system (which is network shill on chromeos). |
| 70 | 70 |
| 71 // For other platforms, create a baseline service that provides proxy | 71 // For other platforms, create a baseline service that provides proxy |
| 72 // configuration in case nothing is configured through prefs (Note: prefs | 72 // configuration in case nothing is configured through prefs (Note: prefs |
| 73 // include command line and configuration policy). | 73 // include command line and configuration policy). |
| 74 | 74 |
| 75 // TODO(port): the IO and FILE message loops are only used by Linux. Can | 75 // TODO(port): the IO and FILE message loops are only used by Linux. Can |
| 76 // that code be moved to chrome/browser instead of being in net, so that it | 76 // that code be moved to chrome/browser instead of being in net, so that it |
| 77 // can use BrowserThread instead of raw MessageLoop pointers? See bug 25354. | 77 // can use BrowserThread instead of raw MessageLoop pointers? See bug 25354. |
| 78 base_service = net::ProxyService::CreateSystemProxyConfigService( | 78 base_service = net::ProxyService::CreateSystemProxyConfigService( |
| 79 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO), | 79 BrowserThread::GetTaskRunnerForThread(BrowserThread::IO), |
| 80 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::FILE)); | 80 BrowserThread::GetTaskRunnerForThread(BrowserThread::FILE)); |
| 81 #endif // !defined(OS_CHROMEOS) | 81 #endif // !defined(OS_CHROMEOS) |
| 82 | 82 |
| 83 return tracker->CreateTrackingProxyConfigService(std::move(base_service)); | 83 return tracker->CreateTrackingProxyConfigService(std::move(base_service)); |
| 84 } | 84 } |
| 85 | 85 |
| 86 // static | 86 // static |
| 87 PrefProxyConfigTracker* | 87 PrefProxyConfigTracker* |
| 88 ProxyServiceFactory::CreatePrefProxyConfigTrackerOfProfile( | 88 ProxyServiceFactory::CreatePrefProxyConfigTrackerOfProfile( |
| 89 PrefService* profile_prefs, | 89 PrefService* profile_prefs, |
| 90 PrefService* local_state_prefs) { | 90 PrefService* local_state_prefs) { |
| 91 #if defined(OS_CHROMEOS) | 91 #if defined(OS_CHROMEOS) |
| 92 return new chromeos::ProxyConfigServiceImpl(profile_prefs, local_state_prefs); | 92 return new chromeos::ProxyConfigServiceImpl(profile_prefs, local_state_prefs); |
| 93 #else | 93 #else |
| 94 return new PrefProxyConfigTrackerImpl( | 94 return new PrefProxyConfigTrackerImpl( |
| 95 profile_prefs, | 95 profile_prefs, BrowserThread::GetTaskRunnerForThread(BrowserThread::IO)); |
| 96 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO)); | |
| 97 #endif // defined(OS_CHROMEOS) | 96 #endif // defined(OS_CHROMEOS) |
| 98 } | 97 } |
| 99 | 98 |
| 100 // static | 99 // static |
| 101 PrefProxyConfigTracker* | 100 PrefProxyConfigTracker* |
| 102 ProxyServiceFactory::CreatePrefProxyConfigTrackerOfLocalState( | 101 ProxyServiceFactory::CreatePrefProxyConfigTrackerOfLocalState( |
| 103 PrefService* local_state_prefs) { | 102 PrefService* local_state_prefs) { |
| 104 #if defined(OS_CHROMEOS) | 103 #if defined(OS_CHROMEOS) |
| 105 return new chromeos::ProxyConfigServiceImpl(NULL, local_state_prefs); | 104 return new chromeos::ProxyConfigServiceImpl(NULL, local_state_prefs); |
| 106 #else | 105 #else |
| 107 return new PrefProxyConfigTrackerImpl( | 106 return new PrefProxyConfigTrackerImpl( |
| 108 local_state_prefs, | 107 local_state_prefs, |
| 109 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO)); | 108 BrowserThread::GetTaskRunnerForThread(BrowserThread::IO)); |
| 110 #endif // defined(OS_CHROMEOS) | 109 #endif // defined(OS_CHROMEOS) |
| 111 } | 110 } |
| 112 | 111 |
| 113 // static | 112 // static |
| 114 std::unique_ptr<net::ProxyService> ProxyServiceFactory::CreateProxyService( | 113 std::unique_ptr<net::ProxyService> ProxyServiceFactory::CreateProxyService( |
| 115 net::NetLog* net_log, | 114 net::NetLog* net_log, |
| 116 net::URLRequestContext* context, | 115 net::URLRequestContext* context, |
| 117 net::NetworkDelegate* network_delegate, | 116 net::NetworkDelegate* network_delegate, |
| 118 std::unique_ptr<net::ProxyConfigService> proxy_config_service, | 117 std::unique_ptr<net::ProxyConfigService> proxy_config_service, |
| 119 const base::CommandLine& command_line, | 118 const base::CommandLine& command_line, |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 188 } | 187 } |
| 189 | 188 |
| 190 proxy_service->set_quick_check_enabled(quick_check_enabled); | 189 proxy_service->set_quick_check_enabled(quick_check_enabled); |
| 191 proxy_service->set_sanitize_url_policy( | 190 proxy_service->set_sanitize_url_policy( |
| 192 pac_https_url_stripping_enabled | 191 pac_https_url_stripping_enabled |
| 193 ? net::ProxyService::SanitizeUrlPolicy::SAFE | 192 ? net::ProxyService::SanitizeUrlPolicy::SAFE |
| 194 : net::ProxyService::SanitizeUrlPolicy::UNSAFE); | 193 : net::ProxyService::SanitizeUrlPolicy::UNSAFE); |
| 195 | 194 |
| 196 return proxy_service; | 195 return proxy_service; |
| 197 } | 196 } |
| OLD | NEW |