| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #ifndef CHROME_BROWSER_NET_PROXY_SERVICE_FACTORY_H_ | 5 #ifndef CHROME_BROWSER_NET_PROXY_SERVICE_FACTORY_H_ |
| 6 #define CHROME_BROWSER_NET_PROXY_SERVICE_FACTORY_H_ | 6 #define CHROME_BROWSER_NET_PROXY_SERVICE_FACTORY_H_ |
| 7 | 7 |
| 8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
| 9 | 9 |
| 10 class ChromeProxyConfigService; | 10 class ChromeProxyConfigService; |
| 11 class CommandLine; | 11 class CommandLine; |
| 12 class PrefProxyConfigTrackerImpl; | 12 class PrefProxyConfigTrackerImpl; |
| 13 class PrefService; | 13 class PrefService; |
| 14 | 14 |
| 15 #if defined(OS_CHROMEOS) | 15 #if defined(OS_CHROMEOS) |
| 16 namespace chromeos { | 16 namespace chromeos { |
| 17 class ProxyConfigServiceImpl; | 17 class ProxyConfigServiceImpl; |
| 18 } | 18 } |
| 19 #endif // defined(OS_CHROMEOS) | 19 #endif // defined(OS_CHROMEOS) |
| 20 | 20 |
| 21 #if defined(OS_CHROMEOS) |
| 22 typedef chromeos::ProxyConfigServiceImpl PrefProxyConfigTracker; |
| 23 #else |
| 24 typedef PrefProxyConfigTrackerImpl PrefProxyConfigTracker; |
| 25 #endif // defined(OS_CHROMEOS) |
| 26 |
| 21 namespace net { | 27 namespace net { |
| 22 class NetLog; | 28 class NetLog; |
| 23 class NetworkDelegate; | 29 class NetworkDelegate; |
| 24 class ProxyConfigService; | 30 class ProxyConfigService; |
| 25 class ProxyService; | 31 class ProxyService; |
| 26 class URLRequestContext; | 32 class URLRequestContext; |
| 27 } // namespace net | 33 } // namespace net |
| 28 | 34 |
| 29 class ProxyServiceFactory { | 35 class ProxyServiceFactory { |
| 30 public: | 36 public: |
| 31 // Creates a ProxyConfigService that delivers the system preferences | 37 // Creates a ProxyConfigService that delivers the system preferences |
| 32 // (or the respective ChromeOS equivalent). | 38 // (or the respective ChromeOS equivalent). |
| 33 // The ChromeProxyConfigService returns "pending" until it has been informed | 39 // The ChromeProxyConfigService returns "pending" until it has been informed |
| 34 // about the proxy configuration by calling its UpdateProxyConfig method. | 40 // about the proxy configuration by calling its UpdateProxyConfig method. |
| 35 static ChromeProxyConfigService* CreateProxyConfigService(); | 41 static ChromeProxyConfigService* CreateProxyConfigService(); |
| 36 | 42 |
| 37 #if defined(OS_CHROMEOS) | 43 // Creates a PrefProxyConfigTracker that tracks preferences of a |
| 38 static chromeos::ProxyConfigServiceImpl* CreatePrefProxyConfigTracker( | 44 // profile. On ChromeOS it additionaly tracks local state for shared proxy |
| 39 PrefService* pref_service); | 45 // settings. This tracker should be used if the profile's preferences should |
| 40 #else | 46 // be respected. On ChromeOS's signin screen this is for example not the case. |
| 41 static PrefProxyConfigTrackerImpl* CreatePrefProxyConfigTracker( | 47 static PrefProxyConfigTracker* CreatePrefProxyConfigTrackerOfProfile( |
| 42 PrefService* pref_service); | 48 PrefService* profile_prefs, |
| 43 #endif // defined(OS_CHROMEOS) | 49 PrefService* local_state_prefs); |
| 50 |
| 51 // Creates a PrefProxyConfigTracker that tracks local state only. This tracker |
| 52 // should be used for the system request context and the signin screen |
| 53 // (ChromeOS only). |
| 54 static PrefProxyConfigTracker* CreatePrefProxyConfigTrackerOfLocalState( |
| 55 PrefService* local_state_prefs); |
| 44 | 56 |
| 45 // Create a proxy service according to the options on command line. | 57 // Create a proxy service according to the options on command line. |
| 46 static net::ProxyService* CreateProxyService( | 58 static net::ProxyService* CreateProxyService( |
| 47 net::NetLog* net_log, | 59 net::NetLog* net_log, |
| 48 net::URLRequestContext* context, | 60 net::URLRequestContext* context, |
| 49 net::NetworkDelegate* network_delegate, | 61 net::NetworkDelegate* network_delegate, |
| 50 net::ProxyConfigService* proxy_config_service, | 62 net::ProxyConfigService* proxy_config_service, |
| 51 const CommandLine& command_line); | 63 const CommandLine& command_line); |
| 52 | 64 |
| 53 private: | 65 private: |
| 54 DISALLOW_IMPLICIT_CONSTRUCTORS(ProxyServiceFactory); | 66 DISALLOW_IMPLICIT_CONSTRUCTORS(ProxyServiceFactory); |
| 55 }; | 67 }; |
| 56 | 68 |
| 57 #endif // CHROME_BROWSER_NET_PROXY_SERVICE_FACTORY_H_ | 69 #endif // CHROME_BROWSER_NET_PROXY_SERVICE_FACTORY_H_ |
| OLD | NEW |