| 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 11 matching lines...) Expand all Loading... |
| 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 #endif // defined(OS_CHROMEOS) | 25 #endif // defined(OS_CHROMEOS) |
| 26 | 26 |
| 27 using content::BrowserThread; | 27 using content::BrowserThread; |
| 28 | 28 |
| 29 // static | 29 // static |
| 30 ChromeProxyConfigService* ProxyServiceFactory::CreateProxyConfigService( | 30 ChromeProxyConfigService* ProxyServiceFactory::CreateProxyConfigService( |
| 31 bool wait_for_first_update) { | 31 bool wait_for_first_update) { |
| 32 // The linux gconf-based proxy settings getter relies on being initialized | 32 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
| 33 // from the UI thread. | |
| 34 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | |
| 35 | 33 |
| 36 net::ProxyConfigService* base_service = NULL; | 34 net::ProxyConfigService* base_service = NULL; |
| 37 | 35 |
| 38 #if !defined(OS_CHROMEOS) | 36 #if !defined(OS_CHROMEOS) |
| 39 // On ChromeOS, base service is NULL; chromeos::ProxyConfigServiceImpl | 37 // On ChromeOS, base service is NULL; chromeos::ProxyConfigServiceImpl |
| 40 // determines the effective proxy config to take effect in the network layer, | 38 // determines the effective proxy config to take effect in the network layer, |
| 41 // be it from prefs or system (which is network shill on chromeos). | 39 // be it from prefs or system (which is network shill on chromeos). |
| 42 | 40 |
| 43 // For other platforms, create a baseline service that provides proxy | 41 // For other platforms, create a baseline service that provides proxy |
| 44 // configuration in case nothing is configured through prefs (Note: prefs | 42 // configuration in case nothing is configured through prefs (Note: prefs |
| 45 // include command line and configuration policy). | 43 // include command line and configuration policy). |
| 46 | 44 |
| 47 // TODO(port): the IO and FILE message loops are only used by Linux. Can | 45 // TODO(port): the IO and FILE message loops are only used by Linux. Can |
| 48 // that code be moved to chrome/browser instead of being in net, so that it | 46 // that code be moved to chrome/browser instead of being in net, so that it |
| 49 // can use BrowserThread instead of raw MessageLoop pointers? See bug 25354. | 47 // can use BrowserThread instead of raw MessageLoop pointers? See bug 25354. |
| 50 base_service = net::ProxyService::CreateSystemProxyConfigService( | 48 base_service = net::ProxyService::CreateSystemProxyConfigService( |
| 51 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO), | 49 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::UI), |
| 52 BrowserThread::UnsafeGetMessageLoopForThread(BrowserThread::FILE)); | 50 BrowserThread::UnsafeGetMessageLoopForThread(BrowserThread::FILE)); |
| 53 #endif // !defined(OS_CHROMEOS) | 51 #endif // !defined(OS_CHROMEOS) |
| 54 | 52 |
| 55 return new ChromeProxyConfigService(base_service, wait_for_first_update); | 53 return new ChromeProxyConfigService(base_service, wait_for_first_update); |
| 56 } | 54 } |
| 57 | 55 |
| 58 #if defined(OS_CHROMEOS) | 56 #if defined(OS_CHROMEOS) |
| 59 // static | 57 // static |
| 60 chromeos::ProxyConfigServiceImpl* | 58 chromeos::ProxyConfigServiceImpl* |
| 61 ProxyServiceFactory::CreatePrefProxyConfigTracker( | 59 ProxyServiceFactory::CreatePrefProxyConfigTracker( |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 127 #endif // defined(OS_IOS) | 125 #endif // defined(OS_IOS) |
| 128 } else { | 126 } else { |
| 129 proxy_service = net::ProxyService::CreateUsingSystemProxyResolver( | 127 proxy_service = net::ProxyService::CreateUsingSystemProxyResolver( |
| 130 proxy_config_service, | 128 proxy_config_service, |
| 131 num_pac_threads, | 129 num_pac_threads, |
| 132 net_log); | 130 net_log); |
| 133 } | 131 } |
| 134 | 132 |
| 135 return proxy_service; | 133 return proxy_service; |
| 136 } | 134 } |
| OLD | NEW |