| 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 16 matching lines...) Expand all Loading... |
| 27 public: | 27 public: |
| 28 UIProxyConfigService(); | 28 UIProxyConfigService(); |
| 29 ~UIProxyConfigService(); | 29 ~UIProxyConfigService(); |
| 30 | 30 |
| 31 // After this call, proxy settings are read from |profile_prefs| and | 31 // After this call, proxy settings are read from |profile_prefs| and |
| 32 // |local_state_prefs|. In case of usage for the sign-in screen, | 32 // |local_state_prefs|. In case of usage for the sign-in screen, |
| 33 // |profile_prefs| must be NULL because sign-in screen should depend only on | 33 // |profile_prefs| must be NULL because sign-in screen should depend only on |
| 34 // shared settings. | 34 // shared settings. |
| 35 void SetPrefs(PrefService* profile_prefs, PrefService* local_state_prefs); | 35 void SetPrefs(PrefService* profile_prefs, PrefService* local_state_prefs); |
| 36 | 36 |
| 37 // Called by UI to set the network with service path |current_network| to be | 37 // Called by UI to set the network with GUID |current_guid| to be |
| 38 // displayed or edited. Subsequent Set*/Get* methods will use this | 38 // displayed or edited. Subsequent Set*/Get* methods will use this |
| 39 // network, until this method is called again. | 39 // network, until this method is called again. |
| 40 void SetCurrentNetwork(const std::string& current_network); | 40 void SetCurrentNetworkGuid(const std::string& current_guid); |
| 41 | 41 |
| 42 void UpdateFromPrefs(); | 42 void UpdateFromPrefs(); |
| 43 | 43 |
| 44 // 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 |
| 45 // 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 |
| 46 // SetProxyConfig. | 46 // SetProxyConfig. |
| 47 void GetProxyConfig(UIProxyConfig* config) const; | 47 void GetProxyConfig(UIProxyConfig* config) const; |
| 48 | 48 |
| 49 // Called from UI to update proxy configuration for different modes. Stores | 49 // Called from UI to update proxy configuration for different modes. Stores |
| 50 // and persists |config| to shill for the current network. | 50 // and persists |config| to shill for the current network. |
| 51 void SetProxyConfig(const UIProxyConfig& config); | 51 void SetProxyConfig(const UIProxyConfig& config); |
| 52 | 52 |
| 53 private: | 53 private: |
| 54 // Determines effective proxy config based on prefs from config tracker, | 54 // Determines effective proxy config based on prefs from config tracker, |
| 55 // |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 |
| 56 // 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 |
| 57 // hence, not picked up by observers. | 57 // hence, not picked up by observers. |
| 58 void DetermineEffectiveConfig(const NetworkState& network); | 58 void DetermineEffectiveConfig(const NetworkState& network); |
| 59 | 59 |
| 60 // Service path of network whose proxy configuration is being displayed or | 60 // GUID of network whose proxy configuration is being displayed or |
| 61 // edited via UI. | 61 // edited via UI. |
| 62 std::string current_ui_network_; | 62 std::string current_ui_network_guid_; |
| 63 | 63 |
| 64 // Proxy configuration of |current_ui_network_|. | 64 // Proxy configuration of |current_ui_network_|. |
| 65 UIProxyConfig current_ui_config_; | 65 UIProxyConfig current_ui_config_; |
| 66 | 66 |
| 67 // Not owned. | 67 // Not owned. |
| 68 PrefService* profile_prefs_; | 68 PrefService* profile_prefs_; |
| 69 | 69 |
| 70 // Not owned. | 70 // Not owned. |
| 71 PrefService* local_state_prefs_; | 71 PrefService* local_state_prefs_; |
| 72 | 72 |
| 73 DISALLOW_COPY_AND_ASSIGN(UIProxyConfigService); | 73 DISALLOW_COPY_AND_ASSIGN(UIProxyConfigService); |
| 74 }; | 74 }; |
| 75 | 75 |
| 76 } // namespace chromeos | 76 } // namespace chromeos |
| 77 | 77 |
| 78 #endif // CHROME_BROWSER_CHROMEOS_UI_PROXY_CONFIG_SERVICE_H_ | 78 #endif // CHROME_BROWSER_CHROMEOS_UI_PROXY_CONFIG_SERVICE_H_ |
| OLD | NEW |