Add new certificateProvider extension API.
[chromium-blink-merge.git] / chrome / browser / net / proxy_policy_handler.h
blob08a1c372bf1ae194c7656fb04b7e706c09571560
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_
8 #include <string>
10 #include "base/basictypes.h"
11 #include "components/policy/core/browser/configuration_policy_handler.h"
13 namespace policy {
15 class ProxyMap;
16 class ProxyErrorMap;
18 // ConfigurationPolicyHandler for the proxy policies.
19 class ProxyPolicyHandler : public ConfigurationPolicyHandler {
20 public:
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
25 // cases.
26 enum ProxyModeType {
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,
36 MODE_COUNT
39 ProxyPolicyHandler();
40 ~ProxyPolicyHandler() override;
42 // ConfigurationPolicyHandler methods:
43 bool CheckPolicySettings(const PolicyMap& policies,
44 PolicyErrorMap* errors) override;
45 void ApplyPolicySettings(const PolicyMap& policies,
46 PrefValueMap* prefs) override;
48 private:
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
54 // succeeded.
55 bool CheckProxyModeAndServerMode(const PolicyMap& policies,
56 PolicyErrorMap* errors,
57 std::string* mode_value);
59 DISALLOW_COPY_AND_ASSIGN(ProxyPolicyHandler);
62 } // namespace policy
64 #endif // CHROME_BROWSER_NET_PROXY_POLICY_HANDLER_H_