| 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 namespace chromeos { | 14 namespace chromeos { |
| 15 | 15 |
| 16 class ProxyCrosSettingsProvider : public CrosSettingsProvider { | 16 class ProxyCrosSettingsProvider : public CrosSettingsProvider { |
| 17 public: | 17 public: |
| 18 ProxyCrosSettingsProvider(); | 18 ProxyCrosSettingsProvider(); |
| 19 // CrosSettingsProvider implementation. | 19 // CrosSettingsProvider implementation. |
| 20 virtual bool Get(const std::string& path, Value** out_value) const OVERRIDE; | 20 virtual bool Get(const std::string& path, Value** out_value) const OVERRIDE; |
| 21 virtual bool HandlesSetting(const std::string& path) const OVERRIDE; | 21 virtual bool HandlesSetting(const std::string& path) const OVERRIDE; |
| 22 | 22 |
| 23 // Set the current network whose proxy settings will be displayed and possibly | 23 // Set the current network whose proxy settings will be displayed and possibly |
| 24 // edited on. | 24 // edited on, with current user profile. |
| 25 void SetCurrentNetwork(const std::string& network); | 25 void SetCurrentNetworkWithProfile(const std::string& network, |
| 26 Profile* profile); |
| 26 | 27 |
| 27 // Make the active network the current one whose proxy settings will be | 28 // Make the active network the current one whose proxy settings will be |
| 28 // displayed and possibly edited on. | 29 // displayed and possibly edited on, with current user profile. |
| 29 void MakeActiveNetworkCurrent(); | 30 void MakeActiveNetworkCurrentWithProfile(Profile* profile); |
| 30 | 31 |
| 31 // Returns name of current network that has been set via SetCurrentNetwork or | 32 // Returns name of current network that has been set via SetCurrentNetwork or |
| 32 // MakeActiveNetworkCurrent. | 33 // MakeActiveNetworkCurrent. |
| 33 const std::string& GetCurrentNetworkName() const; | 34 const std::string& GetCurrentNetworkName() const; |
| 34 | 35 |
| 35 // Returns true if user has selected to use shared proxies. | |
| 36 bool IsUsingSharedProxies() const; | |
| 37 | |
| 38 private: | 36 private: |
| 39 // CrosSettingsProvider implementation. | 37 // CrosSettingsProvider implementation. |
| 40 virtual void DoSet(const std::string& path, Value* value) OVERRIDE; | 38 virtual void DoSet(const std::string& path, Value* value) OVERRIDE; |
| 41 | 39 |
| 42 chromeos::ProxyConfigServiceImpl* GetConfigService() const; | 40 chromeos::ProxyConfigServiceImpl* GetConfigService() const; |
| 43 | 41 |
| 44 net::ProxyServer CreateProxyServerFromHost( | 42 net::ProxyServer CreateProxyServerFromHost( |
| 45 const std::string& host, | 43 const std::string& host, |
| 46 const ProxyConfigServiceImpl::ProxyConfig::ManualProxy& proxy, | 44 const ProxyConfigServiceImpl::ProxyConfig::ManualProxy& proxy, |
| 47 net::ProxyServer::Scheme scheme) const; | 45 net::ProxyServer::Scheme scheme) const; |
| 48 | 46 |
| 49 net::ProxyServer CreateProxyServerFromPort( | 47 net::ProxyServer CreateProxyServerFromPort( |
| 50 uint16 port, | 48 uint16 port, |
| 51 const ProxyConfigServiceImpl::ProxyConfig::ManualProxy& proxy, | 49 const ProxyConfigServiceImpl::ProxyConfig::ManualProxy& proxy, |
| 52 net::ProxyServer::Scheme scheme) const; | 50 net::ProxyServer::Scheme scheme) const; |
| 53 | 51 |
| 54 Value* CreateServerHostValue( | 52 Value* CreateServerHostValue( |
| 55 const ProxyConfigServiceImpl::ProxyConfig::ManualProxy& proxy) const; | 53 const ProxyConfigServiceImpl::ProxyConfig::ManualProxy& proxy) const; |
| 56 | 54 |
| 57 Value* CreateServerPortValue( | 55 Value* CreateServerPortValue( |
| 58 const ProxyConfigServiceImpl::ProxyConfig::ManualProxy& proxy) const; | 56 const ProxyConfigServiceImpl::ProxyConfig::ManualProxy& proxy) const; |
| 59 | 57 |
| 60 DISALLOW_COPY_AND_ASSIGN(ProxyCrosSettingsProvider); | 58 DISALLOW_COPY_AND_ASSIGN(ProxyCrosSettingsProvider); |
| 61 }; | 59 }; |
| 62 | 60 |
| 63 } // namespace chromeos | 61 } // namespace chromeos |
| 64 | 62 |
| 65 #endif // CHROME_BROWSER_CHROMEOS_PROXY_CROS_SETTINGS_PROVIDER_H_ | 63 #endif // CHROME_BROWSER_CHROMEOS_PROXY_CROS_SETTINGS_PROVIDER_H_ |
| OLD | NEW |