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