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 COMPONENTS_POLICY_CORE_COMMON_POLICY_LOADER_MAC_H_ | 5 #ifndef COMPONENTS_POLICY_CORE_COMMON_POLICY_LOADER_MAC_H_ |
6 #define COMPONENTS_POLICY_CORE_COMMON_POLICY_LOADER_MAC_H_ | 6 #define COMPONENTS_POLICY_CORE_COMMON_POLICY_LOADER_MAC_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
(...skipping 15 matching lines...) Expand all Loading... |
26 class PolicyMap; | 26 class PolicyMap; |
27 class Schema; | 27 class Schema; |
28 | 28 |
29 // 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 |
30 // watches the managed preferences files for updates. | 30 // watches the managed preferences files for updates. |
31 class POLICY_EXPORT PolicyLoaderMac : public AsyncPolicyLoader { | 31 class POLICY_EXPORT PolicyLoaderMac : public AsyncPolicyLoader { |
32 public: | 32 public: |
33 PolicyLoaderMac(scoped_refptr<base::SequencedTaskRunner> task_runner, | 33 PolicyLoaderMac(scoped_refptr<base::SequencedTaskRunner> task_runner, |
34 const base::FilePath& managed_policy_path, | 34 const base::FilePath& managed_policy_path, |
35 MacPreferences* preferences); | 35 MacPreferences* preferences); |
| 36 |
| 37 // |application_id| will be passed into Mac's Preference Utilities API |
| 38 // instead of the default value of kCFPreferencesCurrentApplication. |
| 39 PolicyLoaderMac(scoped_refptr<base::SequencedTaskRunner> task_runner, |
| 40 const base::FilePath& managed_policy_path, |
| 41 MacPreferences* preferences, |
| 42 CFStringRef application_id); |
| 43 |
36 ~PolicyLoaderMac() override; | 44 ~PolicyLoaderMac() override; |
37 | 45 |
38 // AsyncPolicyLoader implementation. | 46 // AsyncPolicyLoader implementation. |
39 void InitOnBackgroundThread() override; | 47 void InitOnBackgroundThread() override; |
40 scoped_ptr<PolicyBundle> Load() override; | 48 scoped_ptr<PolicyBundle> Load() override; |
41 base::Time LastModificationTime() override; | 49 base::Time LastModificationTime() override; |
42 | 50 |
43 private: | 51 private: |
44 // Callback for the FilePathWatcher. | 52 // Callback for the FilePathWatcher. |
45 void OnFileUpdated(const base::FilePath& path, bool error); | 53 void OnFileUpdated(const base::FilePath& path, bool error); |
(...skipping 13 matching lines...) Expand all Loading... |
59 | 67 |
60 scoped_ptr<MacPreferences> preferences_; | 68 scoped_ptr<MacPreferences> preferences_; |
61 | 69 |
62 // Path to the managed preferences file for the current user, if it could | 70 // Path to the managed preferences file for the current user, if it could |
63 // be found. Updates of this file trigger a policy reload. | 71 // be found. Updates of this file trigger a policy reload. |
64 base::FilePath managed_policy_path_; | 72 base::FilePath managed_policy_path_; |
65 | 73 |
66 // Watches for events on the |managed_policy_path_|. | 74 // Watches for events on the |managed_policy_path_|. |
67 base::FilePathWatcher watcher_; | 75 base::FilePathWatcher watcher_; |
68 | 76 |
| 77 // Application ID to pass into Mac's Preference Utilities API. |
| 78 CFStringRef application_id_; |
| 79 |
69 DISALLOW_COPY_AND_ASSIGN(PolicyLoaderMac); | 80 DISALLOW_COPY_AND_ASSIGN(PolicyLoaderMac); |
70 }; | 81 }; |
71 | 82 |
72 } // namespace policy | 83 } // namespace policy |
73 | 84 |
74 #endif // COMPONENTS_POLICY_CORE_COMMON_POLICY_LOADER_MAC_H_ | 85 #endif // COMPONENTS_POLICY_CORE_COMMON_POLICY_LOADER_MAC_H_ |
OLD | NEW |