Add new certificateProvider extension API.
[chromium-blink-merge.git] / chrome / browser / extensions / api / messaging / native_messaging_policy_handler.h
blob220c7c458c35fa3cf1dfbe72ca58b246dbf75959
1 // Copyright 2014 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_EXTENSIONS_API_MESSAGING_NATIVE_MESSAGING_POLICY_HANDLER_H_
6 #define CHROME_BROWSER_EXTENSIONS_API_MESSAGING_NATIVE_MESSAGING_POLICY_HANDLER_H_
8 #include "base/memory/scoped_ptr.h"
9 #include "base/values.h"
10 #include "components/policy/core/browser/configuration_policy_handler.h"
12 namespace policy {
13 class PolicyMap;
14 class PolicyErrorMap;
15 } // namespace policy
17 namespace extensions {
19 // Implements additional checks for policies that are lists of Native Messaging
20 // Hosts.
21 class NativeMessagingHostListPolicyHandler
22 : public policy::TypeCheckingPolicyHandler {
23 public:
24 NativeMessagingHostListPolicyHandler(const char* policy_name,
25 const char* pref_path,
26 bool allow_wildcards);
27 ~NativeMessagingHostListPolicyHandler() override;
29 // ConfigurationPolicyHandler methods:
30 bool CheckPolicySettings(const policy::PolicyMap& policies,
31 policy::PolicyErrorMap* errors) override;
32 void ApplyPolicySettings(const policy::PolicyMap& policies,
33 PrefValueMap* prefs) override;
35 protected:
36 const char* pref_path() const;
38 // Runs sanity checks on the policy value and returns it in |extension_ids|.
39 bool CheckAndGetList(const policy::PolicyMap& policies,
40 policy::PolicyErrorMap* errors,
41 scoped_ptr<base::ListValue>* extension_ids);
43 private:
44 const char* pref_path_;
45 bool allow_wildcards_;
47 DISALLOW_COPY_AND_ASSIGN(NativeMessagingHostListPolicyHandler);
50 } // namespace extensions
52 #endif // CHROME_BROWSER_EXTENSIONS_API_MESSAGING_NATIVE_MESSAGING_POLICY_HANDLER_H_