OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CHROME_BROWSER_POLICY_CONFIG_DIR_POLICY_PROVIDER_H_ | 5 #ifndef CHROME_BROWSER_POLICY_CONFIG_DIR_POLICY_PROVIDER_H_ |
6 #define CHROME_BROWSER_POLICY_CONFIG_DIR_POLICY_PROVIDER_H_ | 6 #define CHROME_BROWSER_POLICY_CONFIG_DIR_POLICY_PROVIDER_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "chrome/browser/policy/file_based_policy_provider.h" | 9 #include "chrome/browser/policy/file_based_policy_provider.h" |
10 | 10 |
11 namespace policy { | 11 namespace policy { |
12 | 12 |
13 // A policy loader implementation backed by a set of files in a given directory. | |
14 // The files should contain JSON-formatted policy settings. They are merged | |
15 // together and the result is returned via the PolicyLoader interface. The files | |
16 // are consulted in lexicographic file name order, so the last value read takes | |
17 // precedence in case of preference key collisions. | |
18 class ConfigDirPolicyLoader : public FileBasedPolicyProvider::Delegate { | |
19 public: | |
20 explicit ConfigDirPolicyLoader(const FilePath& config_dir); | |
21 | |
22 // FileBasedPolicyLoader::Delegate implementation. | |
23 virtual DictionaryValue* Load(); | |
24 virtual base::Time GetLastModification(); | |
25 | |
26 private: | |
27 DISALLOW_COPY_AND_ASSIGN(ConfigDirPolicyLoader); | |
28 }; | |
29 | |
30 // Policy provider backed by JSON files in a configuration directory. | 13 // Policy provider backed by JSON files in a configuration directory. |
31 class ConfigDirPolicyProvider : public FileBasedPolicyProvider { | 14 class ConfigDirPolicyProvider : public FileBasedPolicyProvider { |
32 public: | 15 public: |
33 ConfigDirPolicyProvider( | 16 ConfigDirPolicyProvider( |
34 const ConfigurationPolicyProvider::PolicyDefinitionList* policy_list, | 17 const ConfigurationPolicyProvider::PolicyDefinitionList* policy_list, |
35 const FilePath& config_dir); | 18 const FilePath& config_dir); |
36 | 19 |
37 private: | 20 private: |
38 DISALLOW_COPY_AND_ASSIGN(ConfigDirPolicyProvider); | 21 DISALLOW_COPY_AND_ASSIGN(ConfigDirPolicyProvider); |
39 }; | 22 }; |
40 | 23 |
| 24 // A provider delegate implementation backed by a set of files in a given |
| 25 // directory. The files should contain JSON-formatted policy settings. They are |
| 26 // merged together and the result is returned via the ProviderDelegate |
| 27 // interface. The files are consulted in lexicographic file name order, so the |
| 28 // last value read takes precedence in case of preference key collisions. |
| 29 class ConfigDirPolicyProviderDelegate |
| 30 : public FileBasedPolicyProvider::ProviderDelegate { |
| 31 public: |
| 32 explicit ConfigDirPolicyProviderDelegate(const FilePath& config_dir); |
| 33 |
| 34 // FileBasedPolicyProvider::ProviderDelegate implementation. |
| 35 virtual DictionaryValue* Load(); |
| 36 virtual base::Time GetLastModification(); |
| 37 |
| 38 private: |
| 39 DISALLOW_COPY_AND_ASSIGN(ConfigDirPolicyProviderDelegate); |
| 40 }; |
| 41 |
41 } // namespace policy | 42 } // namespace policy |
42 | 43 |
43 #endif // CHROME_BROWSER_POLICY_CONFIG_DIR_POLICY_PROVIDER_H_ | 44 #endif // CHROME_BROWSER_POLICY_CONFIG_DIR_POLICY_PROVIDER_H_ |
OLD | NEW |