Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(44)

Side by Side Diff: chrome/browser/chromeos/proxy_config_service_impl.h

Issue 18112018: Cleanup the UseSharedProxies preference. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Added missing include. Created 7 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 #ifndef CHROME_BROWSER_CHROMEOS_PROXY_CONFIG_SERVICE_IMPL_H_ 5 #ifndef CHROME_BROWSER_CHROMEOS_PROXY_CONFIG_SERVICE_IMPL_H_
6 #define CHROME_BROWSER_CHROMEOS_PROXY_CONFIG_SERVICE_IMPL_H_ 6 #define CHROME_BROWSER_CHROMEOS_PROXY_CONFIG_SERVICE_IMPL_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
(...skipping 20 matching lines...) Expand all
31 // - exists one per profile and one per local state 31 // - exists one per profile and one per local state
32 // - persists proxy setting per network in flimflim 32 // - persists proxy setting per network in flimflim
33 // - provides network stack with latest effective proxy configuration for 33 // - provides network stack with latest effective proxy configuration for
34 // currently active network via PrefProxyConfigTrackerImpl's mechanism of 34 // currently active network via PrefProxyConfigTrackerImpl's mechanism of
35 // pushing config to ChromeProxyConfigService 35 // pushing config to ChromeProxyConfigService
36 class ProxyConfigServiceImpl : public PrefProxyConfigTrackerImpl, 36 class ProxyConfigServiceImpl : public PrefProxyConfigTrackerImpl,
37 public NetworkStateHandlerObserver { 37 public NetworkStateHandlerObserver {
38 public: 38 public:
39 // ProxyConfigServiceImpl is created in ProxyServiceFactory:: 39 // ProxyConfigServiceImpl is created in ProxyServiceFactory::
40 // CreatePrefProxyConfigTrackerImpl via Profile::GetProxyConfigTracker() for 40 // CreatePrefProxyConfigTrackerImpl via Profile::GetProxyConfigTracker() for
41 // profile or IOThread constructor for local state and is owned by the 41 // profile or via IOThread constructor for local state and is owned by the
42 // respective classes. 42 // respective classes.
43 // 43 //
44 // The new modified proxy config, together with proxy from prefs if available, 44 // The user's proxy config, proxy policies and proxy from prefs, are used to
45 // are used to determine the effective proxy config, which is then pushed 45 // determine the effective proxy config, which is then pushed through
46 // through PrefProxyConfigTrackerImpl to ChromeProxyConfigService to the 46 // PrefProxyConfigTrackerImpl to ChromeProxyConfigService to the
47 // network stack. 47 // network stack.
48 explicit ProxyConfigServiceImpl(PrefService* pref_service); 48 //
49 // |signin_profile| must be true, if this object is associated to the signin
50 // profile. |profile_prefs| must be NULL if this object is constructed for the
51 // system request context.
52 explicit ProxyConfigServiceImpl(bool signin_profile,
53 PrefService* profile_prefs,
54 PrefService* local_state_prefs);
49 virtual ~ProxyConfigServiceImpl(); 55 virtual ~ProxyConfigServiceImpl();
50 56
51 // PrefProxyConfigTrackerImpl implementation. 57 // PrefProxyConfigTrackerImpl implementation.
52 virtual void OnProxyConfigChanged(ProxyPrefs::ConfigState config_state, 58 virtual void OnProxyConfigChanged(ProxyPrefs::ConfigState config_state,
53 const net::ProxyConfig& config) OVERRIDE; 59 const net::ProxyConfig& config) OVERRIDE;
54 60
55 // NetworkStateHandlerObserver implementation. 61 // NetworkStateHandlerObserver implementation.
56 virtual void DefaultNetworkChanged(const NetworkState* network) OVERRIDE; 62 virtual void DefaultNetworkChanged(const NetworkState* network) OVERRIDE;
57 63
58 // Register UseShardProxies preference.
59 static void RegisterPrefs(PrefRegistrySimple* registry);
60 static void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry);
61
62 protected: 64 protected:
63 friend class UIProxyConfigService; 65 friend class UIProxyConfigService;
64 66
65 // Returns value of UseSharedProxies preference if it's not default, else
66 // returns false if user is logged in and true otherwise.
67 static bool GetUseSharedProxies(const PrefService* pref_service);
68
69 // Returns true if proxy is to be ignored for this profile and |onc_source|, 67 // Returns true if proxy is to be ignored for this profile and |onc_source|,
70 // e.g. this happens if the network is shared and use-shared-proxies is turned 68 // e.g. this happens if the network is shared and use-shared-proxies is turned
71 // off. 69 // off. |profile_prefs| can be NULL for system request context.
72 static bool IgnoreProxy(const PrefService* pref_service, 70 static bool IgnoreProxy(bool signin_profile,
71 const PrefService* profile_prefs,
73 const std::string network_profile_path, 72 const std::string network_profile_path,
74 onc::ONCSource onc_source); 73 onc::ONCSource onc_source);
75 74
76 private: 75 private:
77 // Called when the kUseSharedProxies preference changes. 76 // Called when the kUseSharedProxies preference changes.
78 void OnUseSharedProxiesChanged(); 77 void OnUseSharedProxiesChanged();
79 78
80 // Determines effective proxy config based on prefs from config tracker, the 79 // Determines effective proxy config based on prefs from config tracker, the
81 // current default network and if user is using shared proxies. The effective 80 // current default network and if user is using shared proxies. The effective
82 // config is stored in |active_config_| and activated on network stack, and 81 // config is stored in |active_config_| and activated on network stack, and
83 // hence, picked up by observers. 82 // hence, picked up by observers.
84 void DetermineEffectiveConfigFromDefaultNetwork(); 83 void DetermineEffectiveConfigFromDefaultNetwork();
85 84
86 // State of |active_config_|. |active_config_| is only valid if 85 // State of |active_config_|. |active_config_| is only valid if
87 // |active_config_state_| is not ProxyPrefs::CONFIG_UNSET. 86 // |active_config_state_| is not ProxyPrefs::CONFIG_UNSET.
88 ProxyPrefs::ConfigState active_config_state_; 87 ProxyPrefs::ConfigState active_config_state_;
89 88
90 // Active proxy configuration, which could be from prefs or network. 89 // Active proxy configuration, which could be from prefs or network.
91 net::ProxyConfig active_config_; 90 net::ProxyConfig active_config_;
92 91
93 // Track changes in UseSharedProxies user preference. 92 // Track changes in UseSharedProxies user preference.
94 BooleanPrefMember use_shared_proxies_; 93 BooleanPrefMember use_shared_proxies_;
95 94
95 // Not owned. NULL in the system request context.
96 PrefService* profile_prefs_;
97
98 // Wether this object is associated to the signin profile.
battre 2013/07/11 13:31:23 ni: Whether
pneubeck (no reviews) 2013/07/12 09:42:30 Done.
99 bool signin_profile_;
100
96 base::WeakPtrFactory<ProxyConfigServiceImpl> pointer_factory_; 101 base::WeakPtrFactory<ProxyConfigServiceImpl> pointer_factory_;
97 102
98 DISALLOW_COPY_AND_ASSIGN(ProxyConfigServiceImpl); 103 DISALLOW_COPY_AND_ASSIGN(ProxyConfigServiceImpl);
99 }; 104 };
100 105
101 } // namespace chromeos 106 } // namespace chromeos
102 107
103 #endif // CHROME_BROWSER_CHROMEOS_PROXY_CONFIG_SERVICE_IMPL_H_ 108 #endif // CHROME_BROWSER_CHROMEOS_PROXY_CONFIG_SERVICE_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698