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

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: Rebased. 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 // |profile_prefs| can be NULL if this object should only track prefs from
50 // local state (e.g., for system request context or sigin-in screen).
51 explicit ProxyConfigServiceImpl(PrefService* profile_prefs,
52 PrefService* local_state_prefs);
49 virtual ~ProxyConfigServiceImpl(); 53 virtual ~ProxyConfigServiceImpl();
50 54
51 // PrefProxyConfigTrackerImpl implementation. 55 // PrefProxyConfigTrackerImpl implementation.
52 virtual void OnProxyConfigChanged(ProxyPrefs::ConfigState config_state, 56 virtual void OnProxyConfigChanged(ProxyPrefs::ConfigState config_state,
53 const net::ProxyConfig& config) OVERRIDE; 57 const net::ProxyConfig& config) OVERRIDE;
54 58
55 // NetworkStateHandlerObserver implementation. 59 // NetworkStateHandlerObserver implementation.
56 virtual void DefaultNetworkChanged(const NetworkState* network) OVERRIDE; 60 virtual void DefaultNetworkChanged(const NetworkState* network) OVERRIDE;
57 61
58 // Register UseShardProxies preference.
59 static void RegisterPrefs(PrefRegistrySimple* registry);
60 static void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry);
61
62 protected: 62 protected:
63 friend class UIProxyConfigService; 63 friend class UIProxyConfigService;
64 64
65 // Returns value of UseSharedProxies preference if it's not default, else 65 // Returns true if proxy is to be ignored for this network profile and
66 // returns false if user is logged in and true otherwise. 66 // |onc_source|, e.g. this happens if the network is shared and
67 static bool GetUseSharedProxies(const PrefService* pref_service); 67 // use-shared-proxies is turned off. |profile_prefs| may be NULL.
68 68 static bool IgnoreProxy(const PrefService* profile_prefs,
69 // 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
71 // off.
72 static bool IgnoreProxy(const PrefService* pref_service,
73 const std::string network_profile_path, 69 const std::string network_profile_path,
74 onc::ONCSource onc_source); 70 onc::ONCSource onc_source);
75 71
76 private: 72 private:
77 // Called when the kUseSharedProxies preference changes. 73 // Called when the kUseSharedProxies preference changes.
78 void OnUseSharedProxiesChanged(); 74 void OnUseSharedProxiesChanged();
79 75
80 // Determines effective proxy config based on prefs from config tracker, the 76 // Determines effective proxy config based on prefs from config tracker, the
81 // current default network and if user is using shared proxies. The effective 77 // 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 78 // config is stored in |active_config_| and activated on network stack, and
83 // hence, picked up by observers. 79 // hence, picked up by observers.
84 void DetermineEffectiveConfigFromDefaultNetwork(); 80 void DetermineEffectiveConfigFromDefaultNetwork();
85 81
86 // State of |active_config_|. |active_config_| is only valid if 82 // State of |active_config_|. |active_config_| is only valid if
87 // |active_config_state_| is not ProxyPrefs::CONFIG_UNSET. 83 // |active_config_state_| is not ProxyPrefs::CONFIG_UNSET.
88 ProxyPrefs::ConfigState active_config_state_; 84 ProxyPrefs::ConfigState active_config_state_;
89 85
90 // Active proxy configuration, which could be from prefs or network. 86 // Active proxy configuration, which could be from prefs or network.
91 net::ProxyConfig active_config_; 87 net::ProxyConfig active_config_;
92 88
93 // Track changes in UseSharedProxies user preference. 89 // Track changes in UseSharedProxies user preference.
94 BooleanPrefMember use_shared_proxies_; 90 BooleanPrefMember use_shared_proxies_;
95 91
92 // Not owned. NULL if tracking only local state prefs (e.g. in the system
93 // request context or sign-in screen).
94 PrefService* profile_prefs_;
95
96 base::WeakPtrFactory<ProxyConfigServiceImpl> pointer_factory_; 96 base::WeakPtrFactory<ProxyConfigServiceImpl> pointer_factory_;
97 97
98 DISALLOW_COPY_AND_ASSIGN(ProxyConfigServiceImpl); 98 DISALLOW_COPY_AND_ASSIGN(ProxyConfigServiceImpl);
99 }; 99 };
100 100
101 } // namespace chromeos 101 } // namespace chromeos
102 102
103 #endif // CHROME_BROWSER_CHROMEOS_PROXY_CONFIG_SERVICE_IMPL_H_ 103 #endif // CHROME_BROWSER_CHROMEOS_PROXY_CONFIG_SERVICE_IMPL_H_
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/net/proxy_config_handler.cc ('k') | chrome/browser/chromeos/proxy_config_service_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698