Revert of Add button to add new FSP services to Files app. (patchset #8 id:140001...
[chromium-blink-merge.git] / chrome / browser / chromeos / ui_proxy_config_service.h
bloba85e1c3595b3c032bae968d93da0cd21cf757c57
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
3 // found in the LICENSE file.
5 #ifndef CHROME_BROWSER_CHROMEOS_UI_PROXY_CONFIG_SERVICE_H_
6 #define CHROME_BROWSER_CHROMEOS_UI_PROXY_CONFIG_SERVICE_H_
8 #include <string>
10 #include "base/basictypes.h"
11 #include "chrome/browser/chromeos/ui_proxy_config.h"
13 class PrefService;
15 namespace chromeos {
17 class NetworkState;
19 // This class is only accessed from the UI via Profile::GetProxyConfigTracker to
20 // allow the user to read and modify the proxy configuration via
21 // GetProxyConfig and SetProxyConfig.
23 // Before reading/setting a proxy config, a network has to be selected using
24 // either SetCurrentNetwork (any remembered network) or
25 // MakeActiveNetworkCurrent.
26 class UIProxyConfigService {
27 public:
28 UIProxyConfigService();
29 ~UIProxyConfigService();
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,
33 // |profile_prefs| must be NULL because sign-in screen should depend only on
34 // shared settings.
35 void SetPrefs(PrefService* profile_prefs, PrefService* local_state_prefs);
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
39 // network, until this method is called again.
40 void SetCurrentNetworkGuid(const std::string& current_guid);
42 void UpdateFromPrefs();
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
46 // SetProxyConfig.
47 void GetProxyConfig(UIProxyConfig* config) const;
49 // Called from UI to update proxy configuration for different modes. Stores
50 // and persists |config| to shill for the current network.
51 void SetProxyConfig(const UIProxyConfig& config);
53 private:
54 // Determines effective proxy config based on prefs from config tracker,
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
57 // hence, not picked up by observers.
58 void DetermineEffectiveConfig(const NetworkState& network);
60 // GUID of network whose proxy configuration is being displayed or
61 // edited via UI.
62 std::string current_ui_network_guid_;
64 // Proxy configuration of |current_ui_network_|.
65 UIProxyConfig current_ui_config_;
67 // Not owned.
68 PrefService* profile_prefs_;
70 // Not owned.
71 PrefService* local_state_prefs_;
73 DISALLOW_COPY_AND_ASSIGN(UIProxyConfigService);
76 } // namespace chromeos
78 #endif // CHROME_BROWSER_CHROMEOS_UI_PROXY_CONFIG_SERVICE_H_