| 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.h" | 12 #include "chrome/browser/net/pref_proxy_config_tracker.h" |
| 13 #include "chrome/browser/profiles/profile.h" |
| 13 #include "chrome/common/chrome_switches.h" | 14 #include "chrome/common/chrome_switches.h" |
| 14 #include "content/public/browser/browser_thread.h" | 15 #include "content/public/browser/browser_thread.h" |
| 15 #include "net/base/net_log.h" | 16 #include "net/base/net_log.h" |
| 16 #include "net/proxy/dhcp_proxy_script_fetcher_factory.h" | 17 #include "net/proxy/dhcp_proxy_script_fetcher_factory.h" |
| 17 #include "net/proxy/proxy_config_service.h" | 18 #include "net/proxy/proxy_config_service.h" |
| 18 #include "net/proxy/proxy_script_fetcher_impl.h" | 19 #include "net/proxy/proxy_script_fetcher_impl.h" |
| 19 #include "net/proxy/proxy_service.h" | 20 #include "net/proxy/proxy_service.h" |
| 20 #include "net/proxy/proxy_service_v8.h" | 21 #include "net/proxy/proxy_service_v8.h" |
| 21 #include "net/url_request/url_request_context.h" | 22 #include "net/url_request/url_request_context.h" |
| 22 | 23 |
| 23 #if defined(OS_CHROMEOS) | 24 #if defined(OS_CHROMEOS) |
| 25 #include "chrome/browser/chromeos/profiles/profile_helper.h" |
| 24 #include "chrome/browser/chromeos/proxy_config_service_impl.h" | 26 #include "chrome/browser/chromeos/proxy_config_service_impl.h" |
| 25 #endif // defined(OS_CHROMEOS) | 27 #endif // defined(OS_CHROMEOS) |
| 26 | 28 |
| 27 using content::BrowserThread; | 29 using content::BrowserThread; |
| 28 | 30 |
| 29 // static | 31 // static |
| 30 ChromeProxyConfigService* ProxyServiceFactory::CreateProxyConfigService() { | 32 ChromeProxyConfigService* ProxyServiceFactory::CreateProxyConfigService() { |
| 31 // The linux gconf-based proxy settings getter relies on being initialized | 33 // The linux gconf-based proxy settings getter relies on being initialized |
| 32 // from the UI thread. | 34 // from the UI thread. |
| 33 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 35 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| (...skipping 16 matching lines...) Expand all Loading... |
| 50 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO).get(), | 52 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO).get(), |
| 51 BrowserThread::UnsafeGetMessageLoopForThread(BrowserThread::FILE)); | 53 BrowserThread::UnsafeGetMessageLoopForThread(BrowserThread::FILE)); |
| 52 #endif // !defined(OS_CHROMEOS) | 54 #endif // !defined(OS_CHROMEOS) |
| 53 | 55 |
| 54 return new ChromeProxyConfigService(base_service); | 56 return new ChromeProxyConfigService(base_service); |
| 55 } | 57 } |
| 56 | 58 |
| 57 #if defined(OS_CHROMEOS) | 59 #if defined(OS_CHROMEOS) |
| 58 // static | 60 // static |
| 59 chromeos::ProxyConfigServiceImpl* | 61 chromeos::ProxyConfigServiceImpl* |
| 60 ProxyServiceFactory::CreatePrefProxyConfigTracker( | 62 ProxyServiceFactory::CreatePrefProxyConfigTracker(Profile* profile) { |
| 61 PrefService* pref_service) { | 63 return new chromeos::ProxyConfigServiceImpl( |
| 62 return new chromeos::ProxyConfigServiceImpl(pref_service); | 64 chromeos::ProfileHelper::IsSigninProfile(profile), |
| 65 profile->GetPrefs(), |
| 66 g_browser_process->local_state()); |
| 63 } | 67 } |
| 64 #else | 68 #else |
| 65 // static | 69 // static |
| 66 PrefProxyConfigTrackerImpl* ProxyServiceFactory::CreatePrefProxyConfigTracker( | 70 PrefProxyConfigTrackerImpl* ProxyServiceFactory::CreatePrefProxyConfigTracker( |
| 67 PrefService* pref_service) { | 71 Profile* profile) { |
| 68 return new PrefProxyConfigTrackerImpl(pref_service); | 72 return new PrefProxyConfigTrackerImpl(profile->GetPrefs()); |
| 69 } | 73 } |
| 70 #endif // defined(OS_CHROMEOS) | 74 #endif // defined(OS_CHROMEOS) |
| 71 | 75 |
| 72 // static | 76 // static |
| 77 PrefProxyConfigTrackerImpl* |
| 78 ProxyServiceFactory::CreatePrefProxyConfigTrackerForLocalState( |
| 79 PrefService* pref_service) { |
| 80 #if defined(OS_CHROMEOS) |
| 81 return new chromeos::ProxyConfigServiceImpl(false, NULL, pref_service); |
| 82 #else |
| 83 return new PrefProxyConfigTrackerImpl(pref_service); |
| 84 #endif // defined(OS_CHROMEOS) |
| 85 } |
| 86 |
| 87 // static |
| 73 net::ProxyService* ProxyServiceFactory::CreateProxyService( | 88 net::ProxyService* ProxyServiceFactory::CreateProxyService( |
| 74 net::NetLog* net_log, | 89 net::NetLog* net_log, |
| 75 net::URLRequestContext* context, | 90 net::URLRequestContext* context, |
| 76 net::NetworkDelegate* network_delegate, | 91 net::NetworkDelegate* network_delegate, |
| 77 net::ProxyConfigService* proxy_config_service, | 92 net::ProxyConfigService* proxy_config_service, |
| 78 const CommandLine& command_line) { | 93 const CommandLine& command_line) { |
| 79 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 94 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
| 80 | 95 |
| 81 #if defined(OS_IOS) | 96 #if defined(OS_IOS) |
| 82 bool use_v8 = false; | 97 bool use_v8 = false; |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 126 #endif // defined(OS_IOS) | 141 #endif // defined(OS_IOS) |
| 127 } else { | 142 } else { |
| 128 proxy_service = net::ProxyService::CreateUsingSystemProxyResolver( | 143 proxy_service = net::ProxyService::CreateUsingSystemProxyResolver( |
| 129 proxy_config_service, | 144 proxy_config_service, |
| 130 num_pac_threads, | 145 num_pac_threads, |
| 131 net_log); | 146 net_log); |
| 132 } | 147 } |
| 133 | 148 |
| 134 return proxy_service; | 149 return proxy_service; |
| 135 } | 150 } |
| OLD | NEW |