1 // Copyright 2013 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.
5 #ifndef CHROME_BROWSER_NET_PROXY_POLICY_HANDLER_H_
6 #define CHROME_BROWSER_NET_PROXY_POLICY_HANDLER_H_
10 #include "base/basictypes.h"
11 #include "components/policy/core/browser/configuration_policy_handler.h"
18 // ConfigurationPolicyHandler for the proxy policies.
19 class ProxyPolicyHandler
: public ConfigurationPolicyHandler
{
21 // Constants for the "Proxy Server Mode" defined in the policies.
22 // Note that these diverge from internal presentation defined in
23 // ProxyPrefs::ProxyMode for legacy reasons. The following four
24 // PolicyProxyModeType types were not very precise and had overlapping use
27 // Disable Proxy, connect directly.
28 PROXY_SERVER_MODE
= 0,
29 // Auto detect proxy or use specific PAC script if given.
30 PROXY_AUTO_DETECT_PROXY_SERVER_MODE
= 1,
31 // Use manually configured proxy servers (fixed servers).
32 PROXY_MANUALLY_CONFIGURED_PROXY_SERVER_MODE
= 2,
33 // Use system proxy server.
34 PROXY_USE_SYSTEM_PROXY_SERVER_MODE
= 3,
40 virtual ~ProxyPolicyHandler();
42 // ConfigurationPolicyHandler methods:
43 virtual bool CheckPolicySettings(const PolicyMap
& policies
,
44 PolicyErrorMap
* errors
) OVERRIDE
;
45 virtual void ApplyPolicySettings(const PolicyMap
& policies
,
46 PrefValueMap
* prefs
) OVERRIDE
;
49 const base::Value
* GetProxyPolicyValue(const PolicyMap
& policies
,
50 const char* policy_name
);
52 // Converts the deprecated ProxyServerMode policy value to a ProxyMode value
53 // and places the result in |mode_value|. Returns whether the conversion
55 bool CheckProxyModeAndServerMode(const PolicyMap
& policies
,
56 PolicyErrorMap
* errors
,
57 std::string
* mode_value
);
59 DISALLOW_COPY_AND_ASSIGN(ProxyPolicyHandler
);
64 #endif // CHROME_BROWSER_NET_PROXY_POLICY_HANDLER_H_