| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "base/time.h" | 9 #include "base/time.h" |
| 10 #include "base/values.h" | 10 #include "base/values.h" |
| 11 #include "chrome/browser/policy/file_based_policy_provider.h" | 11 #include "chrome/browser/policy/file_based_policy_provider.h" |
| 12 | 12 |
| 13 class FilePath; | 13 class FilePath; |
| 14 | 14 |
| 15 namespace policy { | 15 namespace policy { |
| 16 | 16 |
| 17 // Policy provider backed by JSON files in a configuration directory. | 17 // Policy provider backed by JSON files in a configuration directory. |
| 18 class ConfigDirPolicyProvider : public FileBasedPolicyProvider { | 18 class ConfigDirPolicyProvider : public FileBasedPolicyProvider { |
| 19 public: | 19 public: |
| 20 ConfigDirPolicyProvider( | 20 ConfigDirPolicyProvider(const PolicyDefinitionList* policy_list, |
| 21 const ConfigurationPolicyProvider::PolicyDefinitionList* policy_list, | 21 const FilePath& config_dir); |
| 22 const FilePath& config_dir); | |
| 23 | 22 |
| 24 private: | 23 private: |
| 25 DISALLOW_COPY_AND_ASSIGN(ConfigDirPolicyProvider); | 24 DISALLOW_COPY_AND_ASSIGN(ConfigDirPolicyProvider); |
| 26 }; | 25 }; |
| 27 | 26 |
| 28 // A provider delegate implementation backed by a set of files in a given | 27 // A provider delegate implementation backed by a set of files in a given |
| 29 // directory. The files should contain JSON-formatted policy settings. They are | 28 // directory. The files should contain JSON-formatted policy settings. They are |
| 30 // merged together and the result is returned via the ProviderDelegate | 29 // merged together and the result is returned via the ProviderDelegate |
| 31 // interface. The files are consulted in lexicographic file name order, so the | 30 // interface. The files are consulted in lexicographic file name order, so the |
| 32 // last value read takes precedence in case of preference key collisions. | 31 // last value read takes precedence in case of preference key collisions. |
| 33 class ConfigDirPolicyProviderDelegate | 32 class ConfigDirPolicyProviderDelegate |
| 34 : public FileBasedPolicyProvider::ProviderDelegate { | 33 : public FileBasedPolicyProvider::ProviderDelegate { |
| 35 public: | 34 public: |
| 36 explicit ConfigDirPolicyProviderDelegate(const FilePath& config_dir); | 35 explicit ConfigDirPolicyProviderDelegate(const FilePath& config_dir); |
| 37 | 36 |
| 38 // FileBasedPolicyProvider::ProviderDelegate implementation. | 37 // FileBasedPolicyProvider::ProviderDelegate implementation. |
| 39 virtual DictionaryValue* Load() OVERRIDE; | 38 virtual DictionaryValue* Load() OVERRIDE; |
| 40 virtual base::Time GetLastModification() OVERRIDE; | 39 virtual base::Time GetLastModification() OVERRIDE; |
| 41 | 40 |
| 42 private: | 41 private: |
| 43 DISALLOW_COPY_AND_ASSIGN(ConfigDirPolicyProviderDelegate); | 42 DISALLOW_COPY_AND_ASSIGN(ConfigDirPolicyProviderDelegate); |
| 44 }; | 43 }; |
| 45 | 44 |
| 46 } // namespace policy | 45 } // namespace policy |
| 47 | 46 |
| 48 #endif // CHROME_BROWSER_POLICY_CONFIG_DIR_POLICY_PROVIDER_H_ | 47 #endif // CHROME_BROWSER_POLICY_CONFIG_DIR_POLICY_PROVIDER_H_ |
| OLD | NEW |