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; | 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(const char* port_cache_key, std::string* server_uri); | 29 net::ProxyServer CreateProxyServerFromHost( |
| 30 const std::string& host, |
| 31 const ProxyConfigServiceImpl::ProxyConfig::ManualProxy& proxy, |
| 32 net::ProxyServer::Scheme scheme) const; |
30 | 33 |
31 void FormServerUriIfValid(const char* host_cache_key, | 34 net::ProxyServer CreateProxyServerFromPort( |
32 const std::string& port_num, std::string* server_uri); | 35 uint16 port, |
| 36 const ProxyConfigServiceImpl::ProxyConfig::ManualProxy& proxy, |
| 37 net::ProxyServer::Scheme scheme) const; |
33 | 38 |
34 Value* CreateServerHostValue( | 39 Value* CreateServerHostValue( |
35 const ProxyConfigServiceImpl::ProxyConfig::ManualProxy& proxy) const; | 40 const ProxyConfigServiceImpl::ProxyConfig::ManualProxy& proxy) const; |
36 | 41 |
37 Value* CreateServerPortValue( | 42 Value* CreateServerPortValue( |
38 const ProxyConfigServiceImpl::ProxyConfig::ManualProxy& proxy) const; | 43 const ProxyConfigServiceImpl::ProxyConfig::ManualProxy& proxy) const; |
39 | 44 |
40 void SetCache(const std::string& key, const Value* value); | |
41 | |
42 // A cache to keep whatever user typed. | |
43 DictionaryValue cache_; | |
44 | |
45 DISALLOW_COPY_AND_ASSIGN(ProxyCrosSettingsProvider); | 45 DISALLOW_COPY_AND_ASSIGN(ProxyCrosSettingsProvider); |
46 }; | 46 }; |
47 | 47 |
48 } // namespace chromeos | 48 } // namespace chromeos |
49 | 49 |
50 #endif // CHROME_BROWSER_CHROMEOS_PROXY_CROS_SETTINGS_PROVIDER_H_ | 50 #endif // CHROME_BROWSER_CHROMEOS_PROXY_CROS_SETTINGS_PROVIDER_H_ |
OLD | NEW |