| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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_CROS_SETTINGS_PROVIDER_PROXY_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_CROS_SETTINGS_PROVIDER_PROXY_H_ |
| 6 #define CHROME_BROWSER_CHROMEOS_CROS_SETTINGS_PROVIDER_PROXY_H_ | 6 #define CHROME_BROWSER_CHROMEOS_CROS_SETTINGS_PROVIDER_PROXY_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include "base/singleton.h" | 9 #include "base/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 CrosSettingsProviderProxy : public CrosSettingsProvider { | 16 class CrosSettingsProviderProxy : public CrosSettingsProvider { |
| 17 public: | 17 public: |
| 18 CrosSettingsProviderProxy(); | 18 CrosSettingsProviderProxy(); |
| 19 // CrosSettingsProvider implementation. | 19 // CrosSettingsProvider implementation. |
| 20 virtual bool Get(const std::string& path, Value** out_value) const; | 20 virtual bool Get(const std::string& path, Value** out_value) const; |
| 21 virtual bool HandlesSetting(const std::string& path); | 21 virtual bool HandlesSetting(const std::string& path); |
| 22 | 22 |
| 23 private: | 23 private: |
| 24 // CrosSettingsProvider implementation. | 24 // CrosSettingsProvider implementation. |
| 25 virtual void DoSet(const std::string& path, Value* value); | 25 virtual void DoSet(const std::string& path, Value* value); |
| 26 | 26 |
| 27 chromeos::ProxyConfigServiceImpl* GetConfigService() const; | 27 chromeos::ProxyConfigServiceImpl* GetConfigService() const; |
| 28 | 28 |
| 29 void AppendPortIfValid( | 29 void AppendPortIfValid(const char* port_cache_key, std::string* server_uri); |
| 30 const ProxyConfigServiceImpl::ProxyConfig::ManualProxy& proxy, | |
| 31 std::string* server_uri); | |
| 32 | 30 |
| 33 bool FormServerUriIfValid( | 31 void FormServerUriIfValid(const char* host_cache_key, |
| 34 const ProxyConfigServiceImpl::ProxyConfig::ManualProxy& proxy, | |
| 35 const std::string& port_num, std::string* server_uri); | 32 const std::string& port_num, std::string* server_uri); |
| 36 | 33 |
| 37 Value* CreateServerHostValue( | 34 Value* CreateServerHostValue( |
| 38 const ProxyConfigServiceImpl::ProxyConfig::ManualProxy& proxy) const; | 35 const ProxyConfigServiceImpl::ProxyConfig::ManualProxy& proxy) const; |
| 39 | 36 |
| 40 Value* CreateServerPortValue( | 37 Value* CreateServerPortValue( |
| 41 const ProxyConfigServiceImpl::ProxyConfig::ManualProxy& proxy) const; | 38 const ProxyConfigServiceImpl::ProxyConfig::ManualProxy& proxy) const; |
| 42 | 39 |
| 40 void SetCache(const std::string& key, const Value* value); |
| 41 |
| 42 // A cache to keep whatever user typed. |
| 43 DictionaryValue cache_; |
| 44 |
| 43 DISALLOW_COPY_AND_ASSIGN(CrosSettingsProviderProxy); | 45 DISALLOW_COPY_AND_ASSIGN(CrosSettingsProviderProxy); |
| 44 }; | 46 }; |
| 45 | 47 |
| 46 } // namespace chromeos | 48 } // namespace chromeos |
| 47 | 49 |
| 48 #endif // CHROME_BROWSER_CHROMEOS_CROS_SETTINGS_PROVIDER_PROXY_H_ | 50 #endif // CHROME_BROWSER_CHROMEOS_CROS_SETTINGS_PROVIDER_PROXY_H_ |
| OLD | NEW |