OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 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_LOADER_H_ | 5 #ifndef COMPONENTS_POLICY_CORE_COMMON_CONFIG_DIR_POLICY_LOADER_H_ |
6 #define CHROME_BROWSER_POLICY_CONFIG_DIR_POLICY_LOADER_H_ | 6 #define COMPONENTS_POLICY_CORE_COMMON_CONFIG_DIR_POLICY_LOADER_H_ |
7 | 7 |
8 #include "base/files/file_path.h" | 8 #include "base/files/file_path.h" |
9 #include "base/files/file_path_watcher.h" | 9 #include "base/files/file_path_watcher.h" |
10 #include "components/policy/core/common/async_policy_loader.h" | 10 #include "components/policy/core/common/async_policy_loader.h" |
11 #include "components/policy/core/common/policy_types.h" | 11 #include "components/policy/core/common/policy_types.h" |
| 12 #include "components/policy/policy_export.h" |
12 | 13 |
13 namespace base { | 14 namespace base { |
14 class Value; | 15 class Value; |
15 } | 16 } |
16 | 17 |
17 namespace policy { | 18 namespace policy { |
18 | 19 |
19 // A policy loader implementation backed by a set of files in a given | 20 // A policy loader implementation backed by a set of files in a given |
20 // directory. The files should contain JSON-formatted policy settings. They are | 21 // directory. The files should contain JSON-formatted policy settings. They are |
21 // merged together and the result is returned in a PolicyBundle. | 22 // merged together and the result is returned in a PolicyBundle. |
22 // The files are consulted in lexicographic file name order, so the | 23 // The files are consulted in lexicographic file name order, so the |
23 // last value read takes precedence in case of policy key collisions. | 24 // last value read takes precedence in case of policy key collisions. |
24 class ConfigDirPolicyLoader : public AsyncPolicyLoader { | 25 class POLICY_EXPORT ConfigDirPolicyLoader : public AsyncPolicyLoader { |
25 public: | 26 public: |
26 ConfigDirPolicyLoader(scoped_refptr<base::SequencedTaskRunner> task_runner, | 27 ConfigDirPolicyLoader(scoped_refptr<base::SequencedTaskRunner> task_runner, |
27 const base::FilePath& config_dir, | 28 const base::FilePath& config_dir, |
28 PolicyScope scope); | 29 PolicyScope scope); |
29 virtual ~ConfigDirPolicyLoader(); | 30 virtual ~ConfigDirPolicyLoader(); |
30 | 31 |
31 // AsyncPolicyLoader implementation. | 32 // AsyncPolicyLoader implementation. |
32 virtual void InitOnBackgroundThread() OVERRIDE; | 33 virtual void InitOnBackgroundThread() OVERRIDE; |
33 virtual scoped_ptr<PolicyBundle> Load() OVERRIDE; | 34 virtual scoped_ptr<PolicyBundle> Load() OVERRIDE; |
34 virtual base::Time LastModificationTime() OVERRIDE; | 35 virtual base::Time LastModificationTime() OVERRIDE; |
(...skipping 21 matching lines...) Expand all Loading... |
56 // Watchers for events on the mandatory and recommended subdirectories of | 57 // Watchers for events on the mandatory and recommended subdirectories of |
57 // |config_dir_|. | 58 // |config_dir_|. |
58 base::FilePathWatcher mandatory_watcher_; | 59 base::FilePathWatcher mandatory_watcher_; |
59 base::FilePathWatcher recommended_watcher_; | 60 base::FilePathWatcher recommended_watcher_; |
60 | 61 |
61 DISALLOW_COPY_AND_ASSIGN(ConfigDirPolicyLoader); | 62 DISALLOW_COPY_AND_ASSIGN(ConfigDirPolicyLoader); |
62 }; | 63 }; |
63 | 64 |
64 } // namespace policy | 65 } // namespace policy |
65 | 66 |
66 #endif // CHROME_BROWSER_POLICY_CONFIG_DIR_POLICY_LOADER_H_ | 67 #endif // COMPONENTS_POLICY_CORE_COMMON_CONFIG_DIR_POLICY_LOADER_H_ |
OLD | NEW |