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_POLICY_LOADER_MAC_H_ | 5 #ifndef CHROME_BROWSER_POLICY_POLICY_LOADER_MAC_H_ |
6 #define CHROME_BROWSER_POLICY_POLICY_LOADER_MAC_H_ | 6 #define CHROME_BROWSER_POLICY_POLICY_LOADER_MAC_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include <CoreFoundation/CoreFoundation.h> | 10 #include <CoreFoundation/CoreFoundation.h> |
11 | 11 |
12 #include "base/files/file_path.h" | 12 #include "base/files/file_path.h" |
13 #include "base/files/file_path_watcher.h" | 13 #include "base/files/file_path_watcher.h" |
14 #include "base/memory/ref_counted.h" | 14 #include "base/memory/ref_counted.h" |
15 #include "chrome/browser/policy/async_policy_loader.h" | 15 #include "chrome/browser/policy/async_policy_loader.h" |
16 | 16 |
17 class MacPreferences; | 17 class MacPreferences; |
18 | 18 |
19 namespace base { | 19 namespace base { |
20 class SequencedTaskRunner; | 20 class SequencedTaskRunner; |
21 class Value; | 21 class Value; |
22 } // namespace base | 22 } // namespace base |
23 | 23 |
24 namespace policy { | 24 namespace policy { |
25 | 25 |
26 class PolicyDomainDescriptor; | 26 class PolicyDomainDescriptor; |
27 class PolicyMap; | 27 class PolicyMap; |
28 class PolicySchema; | 28 class Schema; |
29 struct PolicyDefinitionList; | 29 struct PolicyDefinitionList; |
30 | 30 |
31 // A policy loader that loads policies from the Mac preferences system, and | 31 // A policy loader that loads policies from the Mac preferences system, and |
32 // watches the managed preferences files for updates. | 32 // watches the managed preferences files for updates. |
33 class PolicyLoaderMac : public AsyncPolicyLoader { | 33 class PolicyLoaderMac : public AsyncPolicyLoader { |
34 public: | 34 public: |
35 PolicyLoaderMac(scoped_refptr<base::SequencedTaskRunner> task_runner, | 35 PolicyLoaderMac(scoped_refptr<base::SequencedTaskRunner> task_runner, |
36 const PolicyDefinitionList* policy_list, | 36 const PolicyDefinitionList* policy_list, |
37 const base::FilePath& managed_policy_path, | 37 const base::FilePath& managed_policy_path, |
38 MacPreferences* preferences); | 38 MacPreferences* preferences); |
(...skipping 17 matching lines...) Expand all Loading... |
56 // Loads policies for the components described in |descriptor|, which belong | 56 // Loads policies for the components described in |descriptor|, which belong |
57 // to the domain |domain_name|, and stores them in the |bundle|. | 57 // to the domain |domain_name|, and stores them in the |bundle|. |
58 void LoadPolicyForDomain( | 58 void LoadPolicyForDomain( |
59 scoped_refptr<const PolicyDomainDescriptor> descriptor, | 59 scoped_refptr<const PolicyDomainDescriptor> descriptor, |
60 const std::string& domain_name, | 60 const std::string& domain_name, |
61 PolicyBundle* bundle); | 61 PolicyBundle* bundle); |
62 | 62 |
63 // Loads the policies described in |schema| from the bundle identified by | 63 // Loads the policies described in |schema| from the bundle identified by |
64 // |bundle_id_string|, and stores them in |policy|. | 64 // |bundle_id_string|, and stores them in |policy|. |
65 void LoadPolicyForComponent(const std::string& bundle_id_string, | 65 void LoadPolicyForComponent(const std::string& bundle_id_string, |
66 const PolicySchema* schema, | 66 Schema schema, |
67 PolicyMap* policy); | 67 PolicyMap* policy); |
68 | 68 |
69 // List of recognized policies. | 69 // List of recognized policies. |
70 const PolicyDefinitionList* policy_list_; | 70 const PolicyDefinitionList* policy_list_; |
71 | 71 |
72 scoped_ptr<MacPreferences> preferences_; | 72 scoped_ptr<MacPreferences> preferences_; |
73 | 73 |
74 // Path to the managed preferences file for the current user, if it could | 74 // Path to the managed preferences file for the current user, if it could |
75 // be found. Updates of this file trigger a policy reload. | 75 // be found. Updates of this file trigger a policy reload. |
76 base::FilePath managed_policy_path_; | 76 base::FilePath managed_policy_path_; |
77 | 77 |
78 // Watches for events on the |managed_policy_path_|. | 78 // Watches for events on the |managed_policy_path_|. |
79 base::FilePathWatcher watcher_; | 79 base::FilePathWatcher watcher_; |
80 | 80 |
81 DISALLOW_COPY_AND_ASSIGN(PolicyLoaderMac); | 81 DISALLOW_COPY_AND_ASSIGN(PolicyLoaderMac); |
82 }; | 82 }; |
83 | 83 |
84 } // namespace policy | 84 } // namespace policy |
85 | 85 |
86 #endif // CHROME_BROWSER_POLICY_POLICY_LOADER_MAC_H_ | 86 #endif // CHROME_BROWSER_POLICY_POLICY_LOADER_MAC_H_ |
OLD | NEW |