| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_UI_PROXY_CONFIG_SERVICE_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_UI_PROXY_CONFIG_SERVICE_H_ |
| 6 #define CHROME_BROWSER_CHROMEOS_UI_PROXY_CONFIG_SERVICE_H_ | 6 #define CHROME_BROWSER_CHROMEOS_UI_PROXY_CONFIG_SERVICE_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 // GetProxyConfig and SetProxyConfig. | 21 // GetProxyConfig and SetProxyConfig. |
| 22 // | 22 // |
| 23 // Before reading/setting a proxy config, a network has to be selected using | 23 // Before reading/setting a proxy config, a network has to be selected using |
| 24 // either SetCurrentNetwork (any remembered network) or | 24 // either SetCurrentNetwork (any remembered network) or |
| 25 // MakeActiveNetworkCurrent. | 25 // MakeActiveNetworkCurrent. |
| 26 class UIProxyConfigService { | 26 class UIProxyConfigService { |
| 27 public: | 27 public: |
| 28 UIProxyConfigService(); | 28 UIProxyConfigService(); |
| 29 ~UIProxyConfigService(); | 29 ~UIProxyConfigService(); |
| 30 | 30 |
| 31 void SetPrefs(PrefService* prefs); | 31 // |signin_screen| indicates whether this object is used for the |
| 32 // signin screen, in which case proxies of (shared) networks are |
| 33 // unconditionally respected. After signin, proxy settings of shared networks |
| 34 // may be ignored, e.g. depending on the kUseSharedProxies flag. After this |
| 35 // call, proxy settings are read from |
| 36 // |prefs|. |
| 37 void SetPrefs(bool signin_screen, PrefService* prefs); |
| 32 | 38 |
| 33 // Called by UI to set the network with service path |current_network| to be | 39 // Called by UI to set the network with service path |current_network| to be |
| 34 // displayed or edited. Subsequent Set*/Get* methods will use this | 40 // displayed or edited. Subsequent Set*/Get* methods will use this |
| 35 // network, until this method is called again. | 41 // network, until this method is called again. |
| 36 void SetCurrentNetwork(const std::string& current_network); | 42 void SetCurrentNetwork(const std::string& current_network); |
| 37 | 43 |
| 38 // Called from UI to retrieve the stored proxy configuration, which is either | 44 // Called from UI to retrieve the stored proxy configuration, which is either |
| 39 // the last proxy config of the current network or the one last set by | 45 // the last proxy config of the current network or the one last set by |
| 40 // SetProxyConfig. | 46 // SetProxyConfig. |
| 41 void GetProxyConfig(UIProxyConfig* config) const; | 47 void GetProxyConfig(UIProxyConfig* config) const; |
| 42 | 48 |
| 43 // Called from UI to update proxy configuration for different modes. Stores | 49 // Called from UI to update proxy configuration for different modes. Stores |
| 44 // and persists |config| to shill for the current network. | 50 // and persists |config| to shill for the current network. |
| 45 void SetProxyConfig(const UIProxyConfig& config); | 51 void SetProxyConfig(const UIProxyConfig& config); |
| 46 | 52 |
| 47 private: | 53 private: |
| 48 // Determines effective proxy config based on prefs from config tracker, | 54 // Determines effective proxy config based on prefs from config tracker, |
| 49 // |network| and if user is using shared proxies. The effective config is | 55 // |network| and if user is using shared proxies. The effective config is |
| 50 // stored in |current_ui_config_| but not activated on network stack, and | 56 // stored in |current_ui_config_| but not activated on network stack, and |
| 51 // hence, not picked up by observers. | 57 // hence, not picked up by observers. |
| 52 void DetermineEffectiveConfig(const NetworkState& network); | 58 void DetermineEffectiveConfig(const NetworkState& network); |
| 53 | 59 |
| 54 // Service path of network whose proxy configuration is being displayed or | 60 // Service path of network whose proxy configuration is being displayed or |
| 55 // edited via UI. | 61 // edited via UI. |
| 56 std::string current_ui_network_; | 62 std::string current_ui_network_; |
| 57 | 63 |
| 58 // Proxy configuration of |current_ui_network_|. | 64 // Proxy configuration of |current_ui_network_|. |
| 59 UIProxyConfig current_ui_config_; | 65 UIProxyConfig current_ui_config_; |
| 60 | 66 |
| 67 bool signin_screen_; |
| 61 PrefService* pref_service_; | 68 PrefService* pref_service_; |
| 62 | 69 |
| 63 DISALLOW_COPY_AND_ASSIGN(UIProxyConfigService); | 70 DISALLOW_COPY_AND_ASSIGN(UIProxyConfigService); |
| 64 }; | 71 }; |
| 65 | 72 |
| 66 } // namespace chromeos | 73 } // namespace chromeos |
| 67 | 74 |
| 68 #endif // CHROME_BROWSER_CHROMEOS_UI_PROXY_CONFIG_SERVICE_H_ | 75 #endif // CHROME_BROWSER_CHROMEOS_UI_PROXY_CONFIG_SERVICE_H_ |
| OLD | NEW |