| OLD | NEW |
| (Empty) |
| 1 // Copyright (c) 2012 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_POLICY_CONFIG_DIR_POLICY_PROVIDER_H_ | |
| 6 #define CHROME_BROWSER_POLICY_CONFIG_DIR_POLICY_PROVIDER_H_ | |
| 7 #pragma once | |
| 8 | |
| 9 #include "base/time.h" | |
| 10 #include "chrome/browser/policy/file_based_policy_provider.h" | |
| 11 | |
| 12 class FilePath; | |
| 13 | |
| 14 namespace base { | |
| 15 class Value; | |
| 16 } | |
| 17 | |
| 18 namespace policy { | |
| 19 | |
| 20 class PolicyBundle; | |
| 21 | |
| 22 // Policy provider backed by JSON files in a configuration directory. | |
| 23 class ConfigDirPolicyProvider : public FileBasedPolicyProvider { | |
| 24 public: | |
| 25 ConfigDirPolicyProvider(const PolicyDefinitionList* policy_list, | |
| 26 PolicyLevel level, | |
| 27 PolicyScope scope, | |
| 28 const FilePath& config_dir); | |
| 29 | |
| 30 private: | |
| 31 DISALLOW_COPY_AND_ASSIGN(ConfigDirPolicyProvider); | |
| 32 }; | |
| 33 | |
| 34 // A provider delegate implementation backed by a set of files in a given | |
| 35 // directory. The files should contain JSON-formatted policy settings. They are | |
| 36 // merged together and the result is returned via the ProviderDelegate | |
| 37 // interface. The files are consulted in lexicographic file name order, so the | |
| 38 // last value read takes precedence in case of preference key collisions. | |
| 39 class ConfigDirPolicyProviderDelegate | |
| 40 : public FileBasedPolicyProvider::ProviderDelegate { | |
| 41 public: | |
| 42 ConfigDirPolicyProviderDelegate(const FilePath& config_dir, | |
| 43 PolicyLevel level, | |
| 44 PolicyScope scope); | |
| 45 | |
| 46 // FileBasedPolicyProvider::ProviderDelegate implementation. | |
| 47 virtual scoped_ptr<PolicyBundle> Load() OVERRIDE; | |
| 48 virtual base::Time GetLastModification() OVERRIDE; | |
| 49 | |
| 50 private: | |
| 51 // Merges the 3rd party |policies| into the |bundle|. | |
| 52 void Merge3rdPartyPolicy(PolicyBundle* bundle, | |
| 53 const base::Value* policies); | |
| 54 | |
| 55 // Policies loaded by this provider will have these attributes. | |
| 56 PolicyLevel level_; | |
| 57 PolicyScope scope_; | |
| 58 | |
| 59 DISALLOW_COPY_AND_ASSIGN(ConfigDirPolicyProviderDelegate); | |
| 60 }; | |
| 61 | |
| 62 } // namespace policy | |
| 63 | |
| 64 #endif // CHROME_BROWSER_POLICY_CONFIG_DIR_POLICY_PROVIDER_H_ | |
| OLD | NEW |