OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_CROS_SETTINGS_PROVIDER_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_PROXY_CROS_SETTINGS_PROVIDER_H_ |
6 #define CHROME_BROWSER_CHROMEOS_PROXY_CROS_SETTINGS_PROVIDER_H_ | 6 #define CHROME_BROWSER_CHROMEOS_PROXY_CROS_SETTINGS_PROVIDER_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "base/memory/singleton.h" | 9 #include "base/memory/singleton.h" |
10 #include "base/values.h" | 10 #include "base/values.h" |
11 #include "chrome/browser/chromeos/cros_settings_provider.h" | 11 #include "chrome/browser/chromeos/cros_settings_provider.h" |
12 #include "chrome/browser/chromeos/proxy_config_service_impl.h" | 12 #include "chrome/browser/chromeos/proxy_config_service_impl.h" |
13 | 13 |
| 14 class Profile; |
| 15 |
14 namespace chromeos { | 16 namespace chromeos { |
15 | 17 |
16 class ProxyCrosSettingsProvider : public CrosSettingsProvider { | 18 class ProxyCrosSettingsProvider : public CrosSettingsProvider { |
17 public: | 19 public: |
18 ProxyCrosSettingsProvider(); | 20 explicit ProxyCrosSettingsProvider(Profile* profile); |
19 // CrosSettingsProvider implementation. | 21 // CrosSettingsProvider implementation. |
20 virtual bool Get(const std::string& path, Value** out_value) const OVERRIDE; | 22 virtual bool Get(const std::string& path, Value** out_value) const OVERRIDE; |
21 virtual bool HandlesSetting(const std::string& path) const OVERRIDE; | 23 virtual bool HandlesSetting(const std::string& path) const OVERRIDE; |
22 | 24 |
23 // Set the current network whose proxy settings will be displayed and possibly | 25 // Set the current network whose proxy settings will be displayed and possibly |
24 // edited on. | 26 // edited on. |
25 void SetCurrentNetwork(const std::string& network); | 27 void SetCurrentNetwork(const std::string& network); |
26 | 28 |
27 // Make the active network the current one whose proxy settings will be | 29 // Make the active network the current one whose proxy settings will be |
28 // displayed and possibly edited on. | 30 // displayed and possibly edited on. |
29 void MakeActiveNetworkCurrent(); | 31 void MakeActiveNetworkCurrent(); |
30 | 32 |
31 // Returns name of current network that has been set via SetCurrentNetwork or | |
32 // MakeActiveNetworkCurrent. | |
33 const std::string& GetCurrentNetworkName() const; | |
34 | |
35 // Returns true if user has selected to use shared proxies. | |
36 bool IsUsingSharedProxies() const; | |
37 | |
38 private: | 33 private: |
39 // CrosSettingsProvider implementation. | 34 // CrosSettingsProvider implementation. |
40 virtual void DoSet(const std::string& path, Value* value) OVERRIDE; | 35 virtual void DoSet(const std::string& path, Value* value) OVERRIDE; |
41 | 36 |
42 chromeos::ProxyConfigServiceImpl* GetConfigService() const; | 37 chromeos::ProxyConfigServiceImpl* GetConfigService() const; |
43 | 38 |
44 net::ProxyServer CreateProxyServerFromHost( | 39 net::ProxyServer CreateProxyServerFromHost( |
45 const std::string& host, | 40 const std::string& host, |
46 const ProxyConfigServiceImpl::ProxyConfig::ManualProxy& proxy, | 41 const ProxyConfigServiceImpl::ProxyConfig::ManualProxy& proxy, |
47 net::ProxyServer::Scheme scheme) const; | 42 net::ProxyServer::Scheme scheme) const; |
48 | 43 |
49 net::ProxyServer CreateProxyServerFromPort( | 44 net::ProxyServer CreateProxyServerFromPort( |
50 uint16 port, | 45 uint16 port, |
51 const ProxyConfigServiceImpl::ProxyConfig::ManualProxy& proxy, | 46 const ProxyConfigServiceImpl::ProxyConfig::ManualProxy& proxy, |
52 net::ProxyServer::Scheme scheme) const; | 47 net::ProxyServer::Scheme scheme) const; |
53 | 48 |
54 Value* CreateServerHostValue( | 49 Value* CreateServerHostValue( |
55 const ProxyConfigServiceImpl::ProxyConfig::ManualProxy& proxy) const; | 50 const ProxyConfigServiceImpl::ProxyConfig::ManualProxy& proxy) const; |
56 | 51 |
57 Value* CreateServerPortValue( | 52 Value* CreateServerPortValue( |
58 const ProxyConfigServiceImpl::ProxyConfig::ManualProxy& proxy) const; | 53 const ProxyConfigServiceImpl::ProxyConfig::ManualProxy& proxy) const; |
59 | 54 |
| 55 Profile* profile_; // Weak ptr. |
| 56 |
60 DISALLOW_COPY_AND_ASSIGN(ProxyCrosSettingsProvider); | 57 DISALLOW_COPY_AND_ASSIGN(ProxyCrosSettingsProvider); |
61 }; | 58 }; |
62 | 59 |
63 } // namespace chromeos | 60 } // namespace chromeos |
64 | 61 |
65 #endif // CHROME_BROWSER_CHROMEOS_PROXY_CROS_SETTINGS_PROVIDER_H_ | 62 #endif // CHROME_BROWSER_CHROMEOS_PROXY_CROS_SETTINGS_PROVIDER_H_ |
OLD | NEW |