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_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 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
11 | 11 |
12 #include "base/basictypes.h" | 12 #include "base/basictypes.h" |
13 #include "base/memory/ref_counted.h" | 13 #include "base/memory/ref_counted.h" |
14 #include "base/memory/scoped_ptr.h" | 14 #include "base/memory/scoped_ptr.h" |
15 #include "base/observer_list.h" | 15 #include "base/observer_list.h" |
16 #include "base/values.h" | 16 #include "base/values.h" |
17 #include "chrome/browser/chromeos/cros/network_library.h" | 17 #include "chrome/browser/chromeos/cros/network_library.h" |
18 #include "chrome/browser/chromeos/login/signed_settings.h" | 18 #include "chrome/browser/chromeos/login/signed_settings.h" |
19 #include "chrome/browser/net/pref_proxy_config_service.h" | |
19 #include "net/proxy/proxy_config.h" | 20 #include "net/proxy/proxy_config.h" |
20 #include "net/proxy/proxy_config_service.h" | 21 #include "net/proxy/proxy_config_service.h" |
21 #include "net/proxy/proxy_server.h" | 22 #include "net/proxy/proxy_server.h" |
22 | 23 |
24 class Profile; | |
25 | |
23 namespace chromeos { | 26 namespace chromeos { |
24 | 27 |
25 // Implementation of proxy config service for chromeos that: | 28 // Implementation of proxy config service for chromeos that: |
26 // - is RefCountedThreadSafe | 29 // - is RefCountedThreadSafe |
27 // - is wrapped by chromeos::ProxyConfigService which implements | 30 // - is wrapped by chromeos::ProxyConfigService which implements |
28 // net::ProxyConfigService interface by fowarding the methods to this class | 31 // net::ProxyConfigService interface by fowarding the methods to this class |
29 // - retrieves initial system proxy configuration from cros settings persisted | 32 // - retrieves initial system proxy configuration from cros settings persisted |
30 // on chromeos device from chromeos revisions before migration to flimflam, | 33 // on chromeos device from chromeos revisions before migration to flimflam, |
31 // - persists proxy setting per network in flimflim | 34 // - persists proxy setting per network in flimflim |
32 // - provides network stack with latest proxy configuration for currently | 35 // - provides network stack with latest proxy configuration for currently |
33 // active network for use on IO thread | 36 // active network for use on IO thread |
34 // - provides UI with methods to retrieve and modify proxy configuration for | 37 // - provides UI with methods to retrieve and modify proxy configuration for |
35 // any network (either currently active or non-active) on UI thread | 38 // any network (either currently active or non-active) on UI thread |
36 class ProxyConfigServiceImpl | 39 class ProxyConfigServiceImpl |
37 : public base::RefCountedThreadSafe<ProxyConfigServiceImpl>, | 40 : public base::RefCountedThreadSafe<ProxyConfigServiceImpl>, |
38 public SignedSettings::Delegate<std::string>, | 41 public SignedSettings::Delegate<std::string>, |
39 public NetworkLibrary::NetworkManagerObserver, | 42 public NetworkLibrary::NetworkManagerObserver, |
40 public NetworkLibrary::NetworkObserver { | 43 public NetworkLibrary::NetworkObserver, |
44 public ProxyConfigDecider { | |
41 public: | 45 public: |
42 // ProxyConfigServiceImpl is created on the UI thread in | 46 // ProxyConfigServiceImpl is created on the UI thread in |
43 // chrome/browser/net/proxy_service_factory.cc::CreateProxyConfigService | 47 // chrome/browser/net/proxy_service_factory.cc::CreateProxyConfigService |
44 // via BrowserProcess::chromeos_proxy_config_service_impl, and stored in | 48 // via BrowserProcess::chromeos_proxy_config_service_impl, and stored in |
45 // g_browser_process as a scoped_refptr (because it's RefCountedThreadSafe). | 49 // g_browser_process as a scoped_refptr (because it's RefCountedThreadSafe). |
46 // | 50 // |
47 // Past that point, it can be accessed from the IO or UI threads. | 51 // Past that point, it can be accessed from the IO or UI threads. |
48 // | 52 // |
49 // From the IO thread, it is accessed periodically through the wrapper class | 53 // From the IO thread, it is accessed periodically through the wrapper class |
50 // chromeos::ProxyConfigService via net::ProxyConfigService interface | 54 // chromeos::ProxyConfigService via net::ProxyConfigService interface |
(...skipping 22 matching lines...) Expand all Loading... | |
73 // Specifies if proxy config is direct, auto-detect, using pac script, | 77 // Specifies if proxy config is direct, auto-detect, using pac script, |
74 // single-proxy, or proxy-per-scheme. | 78 // single-proxy, or proxy-per-scheme. |
75 enum Mode { | 79 enum Mode { |
76 MODE_DIRECT, | 80 MODE_DIRECT, |
77 MODE_AUTO_DETECT, | 81 MODE_AUTO_DETECT, |
78 MODE_PAC_SCRIPT, | 82 MODE_PAC_SCRIPT, |
79 MODE_SINGLE_PROXY, | 83 MODE_SINGLE_PROXY, |
80 MODE_PROXY_PER_SCHEME, | 84 MODE_PROXY_PER_SCHEME, |
81 }; | 85 }; |
82 | 86 |
83 // Specifies where proxy configuration was picked up from. | |
84 enum Source { | |
85 SOURCE_NONE, // No default configuration. | |
86 SOURCE_POLICY, // Configuration is from policy. | |
87 SOURCE_OWNER, // Configuration is from owner. | |
88 }; | |
89 | |
90 struct Setting { | |
91 Setting() : source(SOURCE_NONE) {} | |
92 bool CanBeWrittenByUser(bool user_is_owner); | |
93 | |
94 Source source; | |
95 }; | |
96 | |
97 // Proxy setting for mode = direct or auto-detect or using pac script. | 87 // Proxy setting for mode = direct or auto-detect or using pac script. |
98 struct AutomaticProxy : public Setting { | 88 struct AutomaticProxy { |
99 GURL pac_url; // Set if proxy is using pac script. | 89 GURL pac_url; // Set if proxy is using pac script. |
100 }; | 90 }; |
101 | 91 |
102 // Proxy setting for mode = single-proxy or proxy-per-scheme. | 92 // Proxy setting for mode = single-proxy or proxy-per-scheme. |
103 struct ManualProxy : public Setting { | 93 struct ManualProxy { |
104 net::ProxyServer server; | 94 net::ProxyServer server; |
105 }; | 95 }; |
106 | 96 |
107 ProxyConfig(); | 97 ProxyConfig(); |
108 ~ProxyConfig(); | 98 ~ProxyConfig(); |
109 | 99 |
110 // Converts |this| to net::ProxyConfig. | 100 // Converts |this| to net::ProxyConfig. |
111 void ToNetProxyConfig(net::ProxyConfig* net_config); | 101 void ToNetProxyConfig(net::ProxyConfig* net_config); |
112 | 102 |
113 // Returns true if proxy config can be written by user. | 103 // Converts net::ProxyConfig to |this|. |
114 // If mode is MODE_PROXY_PER_SCHEME, |scheme| is one of "http", "https", | 104 bool FromNetProxyConfig(const net::ProxyConfig& net_config); |
115 // "ftp" or "socks"; otherwise, it should be empty or will be ignored. | |
116 bool CanBeWrittenByUser(bool user_is_owner, const std::string& scheme); | |
117 | 105 |
118 // Map |scheme| (one of "http", "https", "ftp" or "socks") to the correct | 106 // Map |scheme| (one of "http", "https", "ftp" or "socks") to the correct |
119 // ManualProxy. Returns NULL if scheme is invalid. | 107 // ManualProxy. Returns NULL if scheme is invalid. |
120 ManualProxy* MapSchemeToProxy(const std::string& scheme); | 108 ManualProxy* MapSchemeToProxy(const std::string& scheme); |
121 | 109 |
122 // We've migrated device settings to flimflam, so we only need to | 110 // We've migrated device settings to flimflam, so we only need to |
123 // deserialize previously persisted device settings. | 111 // deserialize previously persisted device settings. |
124 // Deserializes from signed setting on device as std::string into a | 112 // Deserializes from signed setting on device as std::string into a |
125 // protobuf and then into the config. | 113 // protobuf and then into the config. |
126 bool DeserializeForDevice(const std::string& input); | 114 bool DeserializeForDevice(const std::string& input); |
127 | 115 |
128 // Serializes config into a ProxyConfigDictionary and then std::string | 116 // Serializes config into a ProxyConfigDictionary and then std::string |
129 // persisted as string property in flimflam for a network. | 117 // persisted as string property in flimflam for a network. |
130 bool SerializeForNetwork(std::string* output); | 118 bool SerializeForNetwork(std::string* output); |
131 | 119 |
132 // Deserializes from string property in flimflam for a network into a | 120 // Deserializes from string property in flimflam for a network into a |
133 // ProxyConfigDictionary and then into the config. | 121 // ProxyConfigDictionary and then into the config. |
134 // Opposite of SerializeForNetwork. | 122 // Opposite of SerializeForNetwork. |
135 bool DeserializeForNetwork(const std::string& input); | 123 bool DeserializeForNetwork(const std::string& input); |
136 | 124 |
137 // Returns true if the given config is equivalent to this config. | 125 // Returns true if the given config is equivalent to this config. |
138 bool Equals(const ProxyConfig& other) const; | 126 bool Equals(const ProxyConfig& other) const; |
139 | 127 |
140 // Creates a textual dump of the configuration. | 128 Mode mode; |
141 std::string ToString() const; | |
142 | 129 |
143 Mode mode; | 130 PrefProxyConfigTracker::ConfigSource source; |
131 | |
132 bool user_modifiable; | |
Mattias Nissler (ping if slow)
2011/10/07 13:32:10
It would be good to have a comment explaining in w
kuan
2011/10/18 16:25:35
Done.
| |
144 | 133 |
145 // Set if mode is MODE_DIRECT or MODE_AUTO_DETECT or MODE_PAC_SCRIPT. | 134 // Set if mode is MODE_DIRECT or MODE_AUTO_DETECT or MODE_PAC_SCRIPT. |
146 AutomaticProxy automatic_proxy; | 135 AutomaticProxy automatic_proxy; |
147 // Set if mode is MODE_SINGLE_PROXY. | 136 // Set if mode is MODE_SINGLE_PROXY. |
148 ManualProxy single_proxy; | 137 ManualProxy single_proxy; |
149 // Set if mode is MODE_PROXY_PER_SCHEME and has http proxy. | 138 // Set if mode is MODE_PROXY_PER_SCHEME and has http proxy. |
150 ManualProxy http_proxy; | 139 ManualProxy http_proxy; |
151 // Set if mode is MODE_PROXY_PER_SCHEME and has https proxy. | 140 // Set if mode is MODE_PROXY_PER_SCHEME and has https proxy. |
152 ManualProxy https_proxy; | 141 ManualProxy https_proxy; |
153 // Set if mode is MODE_PROXY_PER_SCHEME and has ftp proxy. | 142 // Set if mode is MODE_PROXY_PER_SCHEME and has ftp proxy. |
(...skipping 18 matching lines...) Expand all Loading... | |
172 bool FromPrefProxyConfig(const DictionaryValue* proxy_dict); | 161 bool FromPrefProxyConfig(const DictionaryValue* proxy_dict); |
173 }; | 162 }; |
174 | 163 |
175 // Usual constructor. | 164 // Usual constructor. |
176 ProxyConfigServiceImpl(); | 165 ProxyConfigServiceImpl(); |
177 // Constructor for testing. | 166 // Constructor for testing. |
178 // |init_config| specifies the ProxyConfig to use for initialization. | 167 // |init_config| specifies the ProxyConfig to use for initialization. |
179 explicit ProxyConfigServiceImpl(const ProxyConfig& init_config); | 168 explicit ProxyConfigServiceImpl(const ProxyConfig& init_config); |
180 virtual ~ProxyConfigServiceImpl(); | 169 virtual ~ProxyConfigServiceImpl(); |
181 | 170 |
182 // Methods called on IO thread from wrapper class chromeos::ProxyConfigService | 171 // Called from UI thread to set user preference use_shared_proxies. |
183 // as ProxyConfigService methods. | 172 void UISetUseSharedProxies(bool use_shared); |
184 void AddObserver(net::ProxyConfigService::Observer* observer); | |
185 void RemoveObserver(net::ProxyConfigService::Observer* observer); | |
186 // Called from GetLatestProxyConfig. | |
187 net::ProxyConfigService::ConfigAvailability IOGetProxyConfig( | |
188 net::ProxyConfig* config); | |
189 | 173 |
190 // Called from UI thread to retrieve proxy configuration in |config|. | 174 // Called from UI thread to set user |profile| whose prefs proxy config will |
191 void UIGetProxyConfig(ProxyConfig* config); | 175 // be to be displayed or edited. Subsequent UISet* methods will use this |
176 // profile, until UI calls it again with a different profile. | |
177 void UISetCurrentUserProfile(Profile* profile); | |
192 | 178 |
193 // Called from UI thread to set service path of network to be displayed or | 179 // Called from UI thread to set service path of |network| to be displayed or |
194 // edited. Subsequent UISet* methods will use this network, until UI calls | 180 // edited. Subsequent UISet* methods will use this |
181 // network, until UI calls | |
195 // it again with a different network. | 182 // it again with a different network. |
Mattias Nissler (ping if slow)
2011/10/07 13:32:10
comment formatting.
kuan
2011/10/18 16:25:35
Done.
| |
196 bool UISetCurrentNetwork(const std::string& current_network); | 183 void UISetCurrentNetwork(const std::string& current_network); |
197 | 184 |
198 // Called from UI thread to make the currently active network the one to be | 185 // Called from UI thread to make the currently active |etwork the one to be |
Mattias Nissler (ping if slow)
2011/10/07 13:32:10
revert
kuan
2011/10/18 16:25:35
Done.
| |
199 // displayed or edited. Subsequent UISet* methods will use this network. until | 186 // displayed or edited. Subsequent UISet* methods will use this network until |
200 // UI calls it again when the active network has changed. | 187 // UI calls it again when the active network has changed. |
201 bool UIMakeActiveNetworkCurrent(); | 188 void UIMakeActiveNetworkCurrent(); |
202 | 189 |
203 // Called from UI thread to get name of the current active network. | 190 // Called from UI thread to get name of the current active network. |
204 const std::string& current_network_name() const { | 191 const std::string& current_network_name() const { |
205 return current_ui_network_name_; | 192 return current_ui_network_name_; |
206 } | 193 } |
207 | 194 |
208 // Called from UI thread to set/get user preference use_shared_proxies. | 195 // Called from UI thread to retrieve proxy configuration in |config|. |
209 void UISetUseSharedProxies(bool use_shared); | 196 void UIGetProxyConfig(ProxyConfig* config); |
210 bool use_shared_proxies() const { | |
211 return use_shared_proxies_; | |
212 } | |
213 | 197 |
214 // Called from UI thread to update proxy configuration for different modes. | 198 // Called from UI thread to update proxy configuration for different modes. |
215 // Returns true if config is set properly and persisted to flimflam for the | 199 // Returns true if config is set properly and persisted to flimflam for the |
216 // current network (set via UISetCurrentNetwork/UIMakeActiveNetworkCurrent). | 200 // current network (set via UISetCurrentNetwork/UIMakeActiveNetworkCurrent). |
217 // If this network is also currently active, config service proceeds to start | 201 // If this network is also currently active, config service proceeds to start |
218 // activating it on network stack. | 202 // activating it on network stack. |
219 // Returns false if config is not set properly, probably because information | 203 // Returns false if config is not set properly, probably because information |
220 // is incomplete or invalid; while config service won't proceed to activate or | 204 // is incomplete or invalid; while config service won't proceed to activate or |
221 // persist this config, the information is "cached" in the service, so that | 205 // persist this config, the information is "cached" in the service, so that |
222 // the next UIGetProxyConfig call will return this latest information. | 206 // the next UIGetProxyConfig call will return this latest information. |
(...skipping 10 matching lines...) Expand all Loading... | |
233 // Implementation for SignedSettings::Delegate | 217 // Implementation for SignedSettings::Delegate |
234 virtual void OnSettingsOpCompleted(SignedSettings::ReturnCode code, | 218 virtual void OnSettingsOpCompleted(SignedSettings::ReturnCode code, |
235 std::string value); | 219 std::string value); |
236 | 220 |
237 // NetworkLibrary::NetworkManagerObserver implementation. | 221 // NetworkLibrary::NetworkManagerObserver implementation. |
238 virtual void OnNetworkManagerChanged(NetworkLibrary* cros); | 222 virtual void OnNetworkManagerChanged(NetworkLibrary* cros); |
239 | 223 |
240 // NetworkLibrary::NetworkObserver implementation. | 224 // NetworkLibrary::NetworkObserver implementation. |
241 virtual void OnNetworkChanged(NetworkLibrary* cros, const Network* network); | 225 virtual void OnNetworkChanged(NetworkLibrary* cros, const Network* network); |
242 | 226 |
227 // Methods called on io thread from wrapper chromeos::ProxyConfigService as | |
Mattias Nissler (ping if slow)
2011/10/07 13:32:10
s/io/IO/
kuan
2011/10/18 16:25:35
function is removed.
| |
228 // net::ProxyConfigService methods. | |
229 void AddObserver(net::ProxyConfigService::Observer* observer); | |
230 void RemoveObserver(net::ProxyConfigService::Observer* observer); | |
231 // Called from GetLatestProxyConfig. | |
Mattias Nissler (ping if slow)
2011/10/07 13:32:10
maybe adjust to match the name then?
kuan
2011/10/18 16:25:35
function is removed.
| |
232 net::ProxyConfigService::ConfigAvailability IOGetProxyConfig( | |
233 net::ProxyConfig* config); | |
234 | |
235 // Methods called on ui thread from wrapper chromeos::ProxyConfigService to | |
Mattias Nissler (ping if slow)
2011/10/07 13:32:10
s/ui/UI/
kuan
2011/10/18 16:25:35
function is removed.
| |
236 // serve extra functionalities beyond net::ProxyCofigService methods. | |
237 // Implementation of PrefProxyConfigTracker::Observer. | |
238 void OnPrefProxyConfigChanged(PrefProxyConfigTracker* tracker); | |
239 | |
243 #if defined(UNIT_TEST) | 240 #if defined(UNIT_TEST) |
244 void SetTesting() { | 241 void SetTesting() { |
245 testing_ = true; | 242 testing_ = true; |
246 active_network_ = "test"; | 243 active_network_ = "test"; |
247 UIMakeActiveNetworkCurrent(); | 244 UIMakeActiveNetworkCurrent(); |
248 } | 245 } |
249 #endif // defined(UNIT_TEST) | 246 #endif // defined(UNIT_TEST) |
250 | 247 |
251 private: | 248 private: |
252 friend class base::RefCountedThreadSafe<ProxyConfigServiceImpl>; | 249 friend class base::RefCountedThreadSafe<ProxyConfigServiceImpl>; |
(...skipping 12 matching lines...) Expand all Loading... | |
265 // proxy setting of new network. | 262 // proxy setting of new network. |
266 void OnActiveNetworkChanged(NetworkLibrary* cros, | 263 void OnActiveNetworkChanged(NetworkLibrary* cros, |
267 const Network* active_network); | 264 const Network* active_network); |
268 | 265 |
269 // Sets proxy config for |network_path| into flimflam and activates setting | 266 // Sets proxy config for |network_path| into flimflam and activates setting |
270 // if the network is currently active. | 267 // if the network is currently active. |
271 void SetProxyConfigForNetwork(const std::string& network_path, | 268 void SetProxyConfigForNetwork(const std::string& network_path, |
272 const std::string& value, | 269 const std::string& value, |
273 bool only_set_if_empty); | 270 bool only_set_if_empty); |
274 | 271 |
275 // Determines and activates proxy config of |network| based on if network is | 272 // Determines effective proxy config based on prefs from config tracker, |
276 // shared/private or user is using shared proxies, etc. | 273 // |network| and if user is using shared proxies. |
277 void DetermineConfigFromNetwork(const Network* network); | 274 // If |activate| is true, effective config is stored in |active_config| and |
275 // activated on IO thread, and hence, picked up by observers. | |
276 // if |activate| is false, effective config is stored in |current_ui_config| | |
277 // but not activated on io thread, and hence, not picked up by observers. | |
278 void DetermineEffectiveConfig(const Network* network, bool activate); | |
278 | 279 |
279 // Set |current_ui_network_name_| with name of |network|. | 280 // Determine UI-related variables (|current_network_name_| and |
280 void SetCurrentNetworkName(const Network* network); | 281 // |current_ui_config_|) based on |network|, called from UISetCurrentNetwork |
282 // and UIMakeActiveNetworkActive. | |
283 void OnUISetCurrentNetwork(const Network* network); | |
284 | |
285 // Returns true if proxy is to be ignored for network, which happens if | |
286 // network is shared and use-shared-proxies is turned off. | |
287 bool IgnoreProxy(const Network* network) { | |
288 return network->profile_type() == PROFILE_SHARED && !use_shared_proxies_; | |
289 } | |
290 | |
291 // Reset UI cache variables that keep track of ui changes. | |
Mattias Nissler (ping if slow)
2011/10/07 13:32:10
s/ui/UI/
kuan
2011/10/18 16:25:35
Done.
| |
292 void ResetUICache(); | |
293 | |
294 // Returns prefs proxy config tracker of |current_ui_profile_| if available, | |
295 // or default profile. | |
296 PrefProxyConfigTracker* GetProxyConfigTracker(); | |
281 | 297 |
282 // Checks that method is called on BrowserThread::IO thread. | 298 // Checks that method is called on BrowserThread::IO thread. |
283 void CheckCurrentlyOnIOThread(); | 299 void CheckCurrentlyOnIOThread(); |
284 | 300 |
285 // Checks that method is called on BrowserThread::UI thread. | 301 // Checks that method is called on BrowserThread::UI thread. |
286 void CheckCurrentlyOnUIThread(); | 302 void CheckCurrentlyOnUIThread(); |
287 | 303 |
288 // Data members. | 304 // Data members. |
289 | 305 |
290 // True if running unit_tests, which will need to specifically exclude | 306 // True if running unit_tests, which will need to specifically exclude |
291 // flimflam logic. | 307 // flimflam logic. |
292 bool testing_; | 308 bool testing_; |
293 | 309 |
294 // True if tasks can be posted, which can only happen if constructor has | 310 // True if tasks can be posted, which can only happen if constructor has |
295 // completed (NewRunnableMethod cannot be created for a RefCountedThreadBase's | 311 // completed (NewRunnableMethod cannot be created for a RefCountedThreadBase's |
296 // method until the class's ref_count is at least one). | 312 // method until the class's ref_count is at least one). |
297 bool can_post_task_; | 313 bool can_post_task_; |
298 | 314 |
299 // Availability status of the configuration, initialized on UI thread, but | |
300 // afterwards only accessed from IO thread. | |
301 net::ProxyConfigService::ConfigAvailability config_availability_; | |
302 | |
303 // Service path of currently active network (determined via flimflam | 315 // Service path of currently active network (determined via flimflam |
304 // notifications) whose proxy config is taking effect. | 316 // notifications) whose proxy config is taking effect. |
305 std::string active_network_; | 317 std::string active_network_; |
306 // Proxy configuration of |active_network_|, only accessed from UI thread. | 318 |
319 // Active proxy configuration, which could be from prefs or network, only | |
320 // accessed from UI thread. | |
307 ProxyConfig active_config_; | 321 ProxyConfig active_config_; |
308 | 322 |
309 // Proxy config retreived from device, in format generated from | 323 // Proxy config retreived from device, in format generated from |
310 // SerializeForNetwork, that can be directly set into flimflam. | 324 // SerializeForNetwork, that can be directly set into flimflam. |
311 std::string device_config_; | 325 std::string device_config_; |
312 | 326 |
313 // Cached proxy configuration, to be converted to net::ProxyConfig and | 327 // Proxy configuration that is cache of |active_config_| and only accessible |
314 // returned by IOGetProxyConfig. | 328 // from IO thread (except for construction in UI thread), to be converted to |
315 // Initially populated from UI thread, but afterwards only accessed from IO | 329 // net::ProxyConfig and returned by IOGetProxyConfig. |
316 // thread. | 330 ProxyConfig io_config_; |
317 ProxyConfig cached_config_; | 331 |
332 // Availability status of |io_config_| accessible only from IO thread (except | |
333 // for construction in UI thread), returned by IOGetProxyConfig. | |
334 net::ProxyConfigService::ConfigAvailability io_config_availability_; | |
335 | |
336 // True if user preference UseSharedProxies is true. | |
337 bool use_shared_proxies_; | |
338 | |
339 // Current user profile, set in UISetCurrentUserProfile. | |
340 Profile* current_ui_profile_; // Weak ptr. | |
318 | 341 |
319 // Service path of network whose proxy configuration is being displayed or | 342 // Service path of network whose proxy configuration is being displayed or |
320 // edited via UI, separate from |active_network_| which may be same or | 343 // edited via UI, separate from |active_network_| which may be same or |
321 // different. | 344 // different. |
322 std::string current_ui_network_; | 345 std::string current_ui_network_; |
323 | 346 |
324 // Name of network with current_ui_network_, set in UIMakeActiveNetworkCurrent | 347 // Name of network with current_ui_network_, set in UISetCurrentNetwork and |
325 // and UISetCurrentNetwork. | 348 // UIMakeActiveNetworkCurrent. |
326 std::string current_ui_network_name_; | 349 std::string current_ui_network_name_; |
327 | 350 |
328 // Proxy configuration of |current_ui_network|. | 351 // Proxy configuration of |current_ui_network|. |
329 ProxyConfig current_ui_config_; | 352 ProxyConfig current_ui_config_; |
330 | 353 |
331 // True if user preference UseSharedProxies is true. | |
332 bool use_shared_proxies_; | |
333 | |
334 // List of observers for changes in proxy config. | 354 // List of observers for changes in proxy config. |
335 ObserverList<net::ProxyConfigService::Observer> observers_; | 355 ObserverList<net::ProxyConfigService::Observer> observers_; |
336 | 356 |
337 // Operation to retrieve proxy setting from device. | 357 // Operation to retrieve proxy setting from device. |
338 scoped_refptr<SignedSettings> retrieve_property_op_; | 358 scoped_refptr<SignedSettings> retrieve_property_op_; |
339 | 359 |
340 DISALLOW_COPY_AND_ASSIGN(ProxyConfigServiceImpl); | 360 DISALLOW_COPY_AND_ASSIGN(ProxyConfigServiceImpl); |
341 }; | 361 }; |
342 | 362 |
343 } // namespace chromeos | 363 } // namespace chromeos |
344 | 364 |
345 #endif // CHROME_BROWSER_CHROMEOS_PROXY_CONFIG_SERVICE_IMPL_H_ | 365 #endif // CHROME_BROWSER_CHROMEOS_PROXY_CONFIG_SERVICE_IMPL_H_ |
OLD | NEW |