Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(243)

Side by Side Diff: chrome/browser/policy/policy_loader_mac.h

Issue 10496013: Implement the mac policy provider based on the AsyncPolicyLoader. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Renamed to PolicyLoaderMac Created 8 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef CHROME_BROWSER_POLICY_POLICY_LOADER_MAC_H_
6 #define CHROME_BROWSER_POLICY_POLICY_LOADER_MAC_H_
7 #pragma once
8
9 #include <CoreFoundation/CoreFoundation.h>
10
11 #include "base/file_path.h"
12 #include "base/files/file_path_watcher.h"
13 #include "chrome/browser/policy/async_policy_loader.h"
14
15 class MacPreferences;
16
17 namespace base {
18 class Value;
19 } // namespace base
20
21 namespace policy {
22
23 struct PolicyDefinitionList;
24
25 // A policy loader that loads policies from the Mac preferences system, and
26 // watches the managed preferences files for updates.
27 class PolicyLoaderMac : public AsyncPolicyLoader {
28 public:
29 PolicyLoaderMac(const PolicyDefinitionList* policy_list,
30 MacPreferences* preferences);
31 virtual ~PolicyLoaderMac();
32
33 // AsyncPolicyLoader implementation.
34 virtual void InitOnFile() OVERRIDE;
35 virtual scoped_ptr<PolicyBundle> Load() OVERRIDE;
36 virtual base::Time LastModificationTime() OVERRIDE;
37
38 // Converts a CFPropertyListRef to the equivalent base::Value. CFDictionary
39 // entries whose key is not a CFStringRef are ignored.
40 // The returned value is owned by the caller.
41 // Returns NULL if an invalid CFType was found, such as CFDate or CFData.
42 static base::Value* CreateValueFromProperty(CFPropertyListRef property);
43
44 private:
45 // Callback for the FilePathWatcher.
46 void OnFileUpdated(const FilePath& path, bool error);
47
48 // List of recognized policies.
49 const PolicyDefinitionList* policy_list_;
50
51 scoped_ptr<MacPreferences> preferences_;
52
53 // Path to the managed preferences file for the current user, if it could
54 // be found. Updates of this file trigger a policy reload.
55 FilePath managed_policy_path_;
56
57 // Watches for events on the |managed_policy_path_|.
58 base::files::FilePathWatcher watcher_;
59
60 DISALLOW_COPY_AND_ASSIGN(PolicyLoaderMac);
61 };
62
63 } // namespace policy
64
65 #endif // CHROME_BROWSER_POLICY_POLICY_LOADER_MAC_H_
OLDNEW
« no previous file with comments | « chrome/browser/policy/configuration_policy_provider_test.cc ('k') | chrome/browser/policy/policy_loader_mac.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698