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

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

Issue 10915106: Renaming instances of "flimflam" with "shill", now that we're only (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Upload after merge Created 8 years, 3 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
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 #include <vector> 9 #include <vector>
10 10
11 #include "base/basictypes.h" 11 #include "base/basictypes.h"
12 #include "base/values.h" 12 #include "base/values.h"
13 #include "chrome/browser/api/prefs/pref_member.h" 13 #include "chrome/browser/api/prefs/pref_member.h"
14 #include "chrome/browser/chromeos/cros/network_library.h" 14 #include "chrome/browser/chromeos/cros/network_library.h"
15 #include "chrome/browser/net/pref_proxy_config_tracker_impl.h" 15 #include "chrome/browser/net/pref_proxy_config_tracker_impl.h"
16 16
17 namespace chromeos { 17 namespace chromeos {
18 18
19 // Implementation of proxy config service for chromeos that: 19 // Implementation of proxy config service for chromeos that:
20 // - extends PrefProxyConfigTrackerImpl (and so lives and runs entirely on UI 20 // - extends PrefProxyConfigTrackerImpl (and so lives and runs entirely on UI
21 // thread) to handle proxy from prefs (via PrefProxyConfigTrackerImpl) and 21 // thread) to handle proxy from prefs (via PrefProxyConfigTrackerImpl) and
22 // system i.e. network (via flimflam notifications) 22 // system i.e. network (via shill notifications)
23 // - exists one per profile and one per local state 23 // - exists one per profile and one per local state
24 // - retrieves initial system proxy configuration from cros settings persisted 24 // - retrieves initial system proxy configuration from cros settings persisted
25 // on chromeos device from chromeos revisions before migration to flimflam, 25 // on chromeos device from chromeos revisions before migration to shill,
26 // - persists proxy setting per network in flimflim 26 // - persists proxy setting per network in flimflim
27 // - provides network stack with latest effective proxy configuration for 27 // - provides network stack with latest effective proxy configuration for
28 // currently active network via PrefProxyConfigTrackerImpl's mechanism of 28 // currently active network via PrefProxyConfigTrackerImpl's mechanism of
29 // pushing config to ChromeProxyConfigService 29 // pushing config to ChromeProxyConfigService
30 // - provides UI with methods to retrieve and modify proxy configuration for 30 // - provides UI with methods to retrieve and modify proxy configuration for
31 // any remembered network (either currently active or non-active) of current 31 // any remembered network (either currently active or non-active) of current
32 // user profile 32 // user profile
33 class ProxyConfigServiceImpl 33 class ProxyConfigServiceImpl
34 : public PrefProxyConfigTrackerImpl, 34 : public PrefProxyConfigTrackerImpl,
35 public NetworkLibrary::NetworkManagerObserver, 35 public NetworkLibrary::NetworkManagerObserver,
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 bool FromNetProxyConfig(const net::ProxyConfig& net_config); 88 bool FromNetProxyConfig(const net::ProxyConfig& net_config);
89 89
90 // Converts |this| to Dictionary of ProxyConfigDictionary format (which 90 // Converts |this| to Dictionary of ProxyConfigDictionary format (which
91 // is the same format used by prefs). 91 // is the same format used by prefs).
92 DictionaryValue* ToPrefProxyConfig(); 92 DictionaryValue* ToPrefProxyConfig();
93 93
94 // Map |scheme| (one of "http", "https", "ftp" or "socks") to the correct 94 // Map |scheme| (one of "http", "https", "ftp" or "socks") to the correct
95 // ManualProxy. Returns NULL if scheme is invalid. 95 // ManualProxy. Returns NULL if scheme is invalid.
96 ManualProxy* MapSchemeToProxy(const std::string& scheme); 96 ManualProxy* MapSchemeToProxy(const std::string& scheme);
97 97
98 // We've migrated device settings to flimflam, so we only need to 98 // We've migrated device settings to shill, so we only need to
99 // deserialize previously persisted device settings. 99 // deserialize previously persisted device settings.
100 // Deserializes from signed setting on device as std::string into a 100 // Deserializes from signed setting on device as std::string into a
101 // protobuf and then into the config. 101 // protobuf and then into the config.
102 bool DeserializeForDevice(const std::string& input); 102 bool DeserializeForDevice(const std::string& input);
103 103
104 // Serializes config into a ProxyConfigDictionary and then std::string 104 // Serializes config into a ProxyConfigDictionary and then std::string
105 // persisted as string property in flimflam for a network. 105 // persisted as string property in shill for a network.
106 bool SerializeForNetwork(std::string* output); 106 bool SerializeForNetwork(std::string* output);
107 107
108 // Encodes the proxy server as "<url-scheme>=<proxy-scheme>://<proxy>" 108 // Encodes the proxy server as "<url-scheme>=<proxy-scheme>://<proxy>"
109 static void EncodeAndAppendProxyServer(const std::string& scheme, 109 static void EncodeAndAppendProxyServer(const std::string& scheme,
110 const net::ProxyServer& server, 110 const net::ProxyServer& server,
111 std::string* spec); 111 std::string* spec);
112 112
113 Mode mode; 113 Mode mode;
114 114
115 ProxyPrefs::ConfigState state; 115 ProxyPrefs::ConfigState state;
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
152 void UIMakeActiveNetworkCurrent(); 152 void UIMakeActiveNetworkCurrent();
153 153
154 // Called from UI to get name of the current network set via 154 // Called from UI to get name of the current network set via
155 // UISetCurrentNetwork or UIMakeActiveNetworkCurrent. 155 // UISetCurrentNetwork or UIMakeActiveNetworkCurrent.
156 void UIGetCurrentNetworkName(std::string* network_name); 156 void UIGetCurrentNetworkName(std::string* network_name);
157 157
158 // Called from UI to retrieve proxy configuration in |current_ui_config_|. 158 // Called from UI to retrieve proxy configuration in |current_ui_config_|.
159 void UIGetProxyConfig(ProxyConfig* config); 159 void UIGetProxyConfig(ProxyConfig* config);
160 160
161 // Called from UI to update proxy configuration for different modes. 161 // Called from UI to update proxy configuration for different modes.
162 // Returns true if config is set properly and persisted to flimflam for the 162 // Returns true if config is set properly and persisted to shill for the
163 // current network (set via UISetCurrentNetwork/UIMakeActiveNetworkCurrent). 163 // current network (set via UISetCurrentNetwork/UIMakeActiveNetworkCurrent).
164 // If this network is also currently active, config service proceeds to start 164 // If this network is also currently active, config service proceeds to start
165 // activating it on network stack. 165 // activating it on network stack.
166 // Returns false if config is not set properly, probably because information 166 // Returns false if config is not set properly, probably because information
167 // is incomplete or invalid; while config service won't proceed to activate or 167 // is incomplete or invalid; while config service won't proceed to activate or
168 // persist this config, the information is "cached" in the service, so that 168 // persist this config, the information is "cached" in the service, so that
169 // the next UIGetProxyConfig call will return this latest information. 169 // the next UIGetProxyConfig call will return this latest information.
170 bool UISetProxyConfigToDirect(); 170 bool UISetProxyConfigToDirect();
171 bool UISetProxyConfigToAutoDetect(); 171 bool UISetProxyConfigToAutoDetect();
172 bool UISetProxyConfigToPACScript(const GURL& pac_url); 172 bool UISetProxyConfigToPACScript(const GURL& pac_url);
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
211 // content::NotificationObserver implementation. 211 // content::NotificationObserver implementation.
212 virtual void Observe(int type, 212 virtual void Observe(int type,
213 const content::NotificationSource& source, 213 const content::NotificationSource& source,
214 const content::NotificationDetails& details) OVERRIDE; 214 const content::NotificationDetails& details) OVERRIDE;
215 215
216 // Called from the various UISetProxyConfigTo*. 216 // Called from the various UISetProxyConfigTo*.
217 void OnUISetProxyConfig(); 217 void OnUISetProxyConfig();
218 218
219 // Called from OnNetworkManagerChanged and OnNetworkChanged for currently 219 // Called from OnNetworkManagerChanged and OnNetworkChanged for currently
220 // active network, to handle previously active network, new active network, 220 // active network, to handle previously active network, new active network,
221 // and if necessary, migrates device settings to flimflam and/or activates 221 // and if necessary, migrates device settings to shill and/or activates
222 // proxy setting of new network. 222 // proxy setting of new network.
223 void OnActiveNetworkChanged(NetworkLibrary* cros, 223 void OnActiveNetworkChanged(NetworkLibrary* cros,
224 const Network* active_network); 224 const Network* active_network);
225 225
226 // Sets proxy config for |network_path| into flimflam and activates setting 226 // Sets proxy config for |network_path| into shill and activates setting
227 // if the network is currently active. If |only_set_if_empty| is true, 227 // if the network is currently active. If |only_set_if_empty| is true,
228 // proxy will be set and saved only if network has no proxy. 228 // proxy will be set and saved only if network has no proxy.
229 void SetProxyConfigForNetwork(const std::string& network_path, 229 void SetProxyConfigForNetwork(const std::string& network_path,
230 const std::string& value, 230 const std::string& value,
231 bool only_set_if_empty); 231 bool only_set_if_empty);
232 232
233 // Returns value of UseSharedProxies preference if it's not default, else 233 // Returns value of UseSharedProxies preference if it's not default, else
234 // returns false if user is logged in and true otherwise. 234 // returns false if user is logged in and true otherwise.
235 bool GetUseSharedProxies(); 235 bool GetUseSharedProxies();
236 236
(...skipping 15 matching lines...) Expand all
252 return network->profile_type() == PROFILE_SHARED && !GetUseSharedProxies(); 252 return network->profile_type() == PROFILE_SHARED && !GetUseSharedProxies();
253 } 253 }
254 254
255 // Reset UI cache variables that keep track of UI activities. 255 // Reset UI cache variables that keep track of UI activities.
256 void ResetUICache(); 256 void ResetUICache();
257 257
258 void FetchProxyPolicy(); 258 void FetchProxyPolicy();
259 259
260 // Data members. 260 // Data members.
261 261
262 // Service path of currently active network (determined via flimflam 262 // Service path of currently active network (determined via shill
263 // notifications); if effective proxy config is from system, proxy of this 263 // notifications); if effective proxy config is from system, proxy of this
264 // network will be the one taking effect. 264 // network will be the one taking effect.
265 std::string active_network_; 265 std::string active_network_;
266 266
267 // State of |active_config_|. |active_config_| is only valid if 267 // State of |active_config_|. |active_config_| is only valid if
268 // |active_config_state_| is not ProxyPrefs::CONFIG_UNSET. 268 // |active_config_state_| is not ProxyPrefs::CONFIG_UNSET.
269 ProxyPrefs::ConfigState active_config_state_; 269 ProxyPrefs::ConfigState active_config_state_;
270 270
271 // Active proxy configuration, which could be from prefs or network. 271 // Active proxy configuration, which could be from prefs or network.
272 net::ProxyConfig active_config_; 272 net::ProxyConfig active_config_;
273 273
274 // Proxy config retreived from device, in format generated from 274 // Proxy config retreived from device, in format generated from
275 // SerializeForNetwork, that can be directly set into flimflam. 275 // SerializeForNetwork, that can be directly set into shill.
276 std::string device_config_; 276 std::string device_config_;
277 277
278 // Service path of network whose proxy configuration is being displayed or 278 // Service path of network whose proxy configuration is being displayed or
279 // edited via UI, separate from |active_network_| which may be same or 279 // edited via UI, separate from |active_network_| which may be same or
280 // different. 280 // different.
281 std::string current_ui_network_; 281 std::string current_ui_network_;
282 282
283 // Proxy configuration of |current_ui_network_|. 283 // Proxy configuration of |current_ui_network_|.
284 ProxyConfig current_ui_config_; 284 ProxyConfig current_ui_config_;
285 285
286 // Track changes in UseSharedProxies user preference. 286 // Track changes in UseSharedProxies user preference.
287 BooleanPrefMember use_shared_proxies_; 287 BooleanPrefMember use_shared_proxies_;
288 288
289 // Callbacks for notification when network to be viewed has been changed from 289 // Callbacks for notification when network to be viewed has been changed from
290 // the UI. 290 // the UI.
291 std::vector<base::Closure> callbacks_; 291 std::vector<base::Closure> callbacks_;
292 292
293 base::WeakPtrFactory<ProxyConfigServiceImpl> pointer_factory_; 293 base::WeakPtrFactory<ProxyConfigServiceImpl> pointer_factory_;
294 294
295 DISALLOW_COPY_AND_ASSIGN(ProxyConfigServiceImpl); 295 DISALLOW_COPY_AND_ASSIGN(ProxyConfigServiceImpl);
296 }; 296 };
297 297
298 } // namespace chromeos 298 } // namespace chromeos
299 299
300 #endif // CHROME_BROWSER_CHROMEOS_PROXY_CONFIG_SERVICE_IMPL_H_ 300 #endif // CHROME_BROWSER_CHROMEOS_PROXY_CONFIG_SERVICE_IMPL_H_
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/options/wimax_config_view.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