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_
10 #include "base/basictypes.h"
11 #include "chrome/browser/chromeos/ui_proxy_config.h"
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
{
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
35 void SetPrefs(PrefService
* profile_prefs
, PrefService
* local_state_prefs
);
37 // Called by UI to set the network with service path |current_network| to be
38 // displayed or edited. Subsequent Set*/Get* methods will use this
39 // network, until this method is called again.
40 void SetCurrentNetwork(const std::string
& current_network
);
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
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
);
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 FavoriteState
& network
);
60 // Service path of network whose proxy configuration is being displayed or
62 std::string current_ui_network_
;
64 // Proxy configuration of |current_ui_network_|.
65 UIProxyConfig current_ui_config_
;
70 PrefService
* profile_prefs_
;
73 PrefService
* local_state_prefs_
;
75 DISALLOW_COPY_AND_ASSIGN(UIProxyConfigService
);
78 } // namespace chromeos
80 #endif // CHROME_BROWSER_CHROMEOS_UI_PROXY_CONFIG_SERVICE_H_