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. 4 5 #ifndef CHROME_BROWSER_EXTENSIONS_API_MESSAGING_NATIVE_MESSAGING_POLICY_HANDLER_H_ 6 #define CHROME_BROWSER_EXTENSIONS_API_MESSAGING_NATIVE_MESSAGING_POLICY_HANDLER_H_ 7 8 #include <memory> 9 10 #include "base/macros.h" 11 #include "base/values.h" 12 #include "components/policy/core/browser/configuration_policy_handler.h" 13 14 namespace extensions { 15 16 // Implements additional checks for policies that are lists of Native Messaging 17 // Hosts. 18 class NativeMessagingHostListPolicyHandler : public policy::ListPolicyHandler { 19 public: 20 NativeMessagingHostListPolicyHandler(const char* policy_name, 21 const char* pref_path, 22 bool allow_wildcards); 23 ~NativeMessagingHostListPolicyHandler() override; 24 25 protected: 26 // ListPolicyHandler methods: 27 28 // Checks whether |value| contains a valid host name (or a wildcard). 29 bool CheckListEntry(const base::Value& value) override; 30 31 // Sets |prefs| at pref_path() to |filtered_list|. 32 void ApplyList(base::Value filtered_list, PrefValueMap* prefs) override; 33 34 private: 35 const char* pref_path_; 36 bool allow_wildcards_; 37 38 DISALLOW_COPY_AND_ASSIGN(NativeMessagingHostListPolicyHandler); 39 }; 40 41 } // namespace extensions 42 43 #endif // CHROME_BROWSER_EXTENSIONS_API_MESSAGING_NATIVE_MESSAGING_POLICY_HANDLER_H_ 44