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 PolicyMap; | 26 class PolicyMap; |
27 class Schema; | 27 class Schema; |
28 struct PolicyDefinitionList; | |
29 | 28 |
30 // A policy loader that loads policies from the Mac preferences system, and | 29 // A policy loader that loads policies from the Mac preferences system, and |
31 // watches the managed preferences files for updates. | 30 // watches the managed preferences files for updates. |
32 class PolicyLoaderMac : public AsyncPolicyLoader { | 31 class PolicyLoaderMac : public AsyncPolicyLoader { |
33 public: | 32 public: |
34 PolicyLoaderMac(scoped_refptr<base::SequencedTaskRunner> task_runner, | 33 PolicyLoaderMac(scoped_refptr<base::SequencedTaskRunner> task_runner, |
35 const PolicyDefinitionList* policy_list, | |
36 const base::FilePath& managed_policy_path, | 34 const base::FilePath& managed_policy_path, |
37 MacPreferences* preferences); | 35 MacPreferences* preferences); |
38 virtual ~PolicyLoaderMac(); | 36 virtual ~PolicyLoaderMac(); |
39 | 37 |
40 // AsyncPolicyLoader implementation. | 38 // AsyncPolicyLoader implementation. |
41 virtual void InitOnBackgroundThread() OVERRIDE; | 39 virtual void InitOnBackgroundThread() OVERRIDE; |
42 virtual scoped_ptr<PolicyBundle> Load() OVERRIDE; | 40 virtual scoped_ptr<PolicyBundle> Load() OVERRIDE; |
43 virtual base::Time LastModificationTime() OVERRIDE; | 41 virtual base::Time LastModificationTime() OVERRIDE; |
44 | 42 |
45 // Converts a CFPropertyListRef to the equivalent base::Value. CFDictionary | 43 // Converts a CFPropertyListRef to the equivalent base::Value. CFDictionary |
(...skipping 12 matching lines...) Expand all Loading... |
58 PolicyDomain domain, | 56 PolicyDomain domain, |
59 const std::string& domain_name, | 57 const std::string& domain_name, |
60 PolicyBundle* bundle); | 58 PolicyBundle* bundle); |
61 | 59 |
62 // Loads the policies described in |schema| from the bundle identified by | 60 // Loads the policies described in |schema| from the bundle identified by |
63 // |bundle_id_string|, and stores them in |policy|. | 61 // |bundle_id_string|, and stores them in |policy|. |
64 void LoadPolicyForComponent(const std::string& bundle_id_string, | 62 void LoadPolicyForComponent(const std::string& bundle_id_string, |
65 const Schema& schema, | 63 const Schema& schema, |
66 PolicyMap* policy); | 64 PolicyMap* policy); |
67 | 65 |
68 // List of recognized policies. | |
69 const PolicyDefinitionList* policy_list_; | |
70 | |
71 scoped_ptr<MacPreferences> preferences_; | 66 scoped_ptr<MacPreferences> preferences_; |
72 | 67 |
73 // Path to the managed preferences file for the current user, if it could | 68 // Path to the managed preferences file for the current user, if it could |
74 // be found. Updates of this file trigger a policy reload. | 69 // be found. Updates of this file trigger a policy reload. |
75 base::FilePath managed_policy_path_; | 70 base::FilePath managed_policy_path_; |
76 | 71 |
77 // Watches for events on the |managed_policy_path_|. | 72 // Watches for events on the |managed_policy_path_|. |
78 base::FilePathWatcher watcher_; | 73 base::FilePathWatcher watcher_; |
79 | 74 |
80 DISALLOW_COPY_AND_ASSIGN(PolicyLoaderMac); | 75 DISALLOW_COPY_AND_ASSIGN(PolicyLoaderMac); |
81 }; | 76 }; |
82 | 77 |
83 } // namespace policy | 78 } // namespace policy |
84 | 79 |
85 #endif // CHROME_BROWSER_POLICY_POLICY_LOADER_MAC_H_ | 80 #endif // CHROME_BROWSER_POLICY_POLICY_LOADER_MAC_H_ |
OLD | NEW |