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

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

Issue 15038007: Load policy for extensions at the Mac policy provider. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 7 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 | Annotate | Revision Log
OLDNEW
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>
9
8 #include <CoreFoundation/CoreFoundation.h> 10 #include <CoreFoundation/CoreFoundation.h>
9 11
10 #include "base/files/file_path.h" 12 #include "base/files/file_path.h"
11 #include "base/files/file_path_watcher.h" 13 #include "base/files/file_path_watcher.h"
12 #include "chrome/browser/policy/async_policy_loader.h" 14 #include "chrome/browser/policy/async_policy_loader.h"
13 15
14 class MacPreferences; 16 class MacPreferences;
15 17
16 namespace base { 18 namespace base {
17 class Value; 19 class Value;
18 } // namespace base 20 } // namespace base
19 21
20 namespace policy { 22 namespace policy {
21 23
24 class PolicyMap;
25 class PolicySchema;
22 struct PolicyDefinitionList; 26 struct PolicyDefinitionList;
23 27
24 // A policy loader that loads policies from the Mac preferences system, and 28 // A policy loader that loads policies from the Mac preferences system, and
25 // watches the managed preferences files for updates. 29 // watches the managed preferences files for updates.
26 class PolicyLoaderMac : public AsyncPolicyLoader { 30 class PolicyLoaderMac : public AsyncPolicyLoader {
27 public: 31 public:
28 PolicyLoaderMac(const PolicyDefinitionList* policy_list, 32 PolicyLoaderMac(const PolicyDefinitionList* policy_list,
29 MacPreferences* preferences); 33 MacPreferences* preferences);
30 virtual ~PolicyLoaderMac(); 34 virtual ~PolicyLoaderMac();
31 35
32 // AsyncPolicyLoader implementation. 36 // AsyncPolicyLoader implementation.
33 virtual void InitOnFile() OVERRIDE; 37 virtual void InitOnFile() OVERRIDE;
34 virtual scoped_ptr<PolicyBundle> Load() OVERRIDE; 38 virtual scoped_ptr<PolicyBundle> Load() OVERRIDE;
35 virtual base::Time LastModificationTime() OVERRIDE; 39 virtual base::Time LastModificationTime() OVERRIDE;
36 40
37 // Converts a CFPropertyListRef to the equivalent base::Value. CFDictionary 41 // Converts a CFPropertyListRef to the equivalent base::Value. CFDictionary
38 // entries whose key is not a CFStringRef are ignored. 42 // entries whose key is not a CFStringRef are ignored.
39 // The returned value is owned by the caller. 43 // The returned value is owned by the caller.
40 // Returns NULL if an invalid CFType was found, such as CFDate or CFData. 44 // Returns NULL if an invalid CFType was found, such as CFDate or CFData.
41 static base::Value* CreateValueFromProperty(CFPropertyListRef property); 45 static base::Value* CreateValueFromProperty(CFPropertyListRef property);
42 46
43 private: 47 private:
44 // Callback for the FilePathWatcher. 48 // Callback for the FilePathWatcher.
45 void OnFileUpdated(const base::FilePath& path, bool error); 49 void OnFileUpdated(const base::FilePath& path, bool error);
46 50
51 // Loads the policies described in |schema| from the bundle identified by
52 // |bundle_id_string|, and stores them in |policy|.
53 void LoadComponentPolicy(const std::string& bundle_id_string,
54 const PolicySchema* schema,
55 PolicyMap* policy);
56
47 // List of recognized policies. 57 // List of recognized policies.
48 const PolicyDefinitionList* policy_list_; 58 const PolicyDefinitionList* policy_list_;
49 59
50 scoped_ptr<MacPreferences> preferences_; 60 scoped_ptr<MacPreferences> preferences_;
51 61
52 // Path to the managed preferences file for the current user, if it could 62 // Path to the managed preferences file for the current user, if it could
53 // be found. Updates of this file trigger a policy reload. 63 // be found. Updates of this file trigger a policy reload.
54 base::FilePath managed_policy_path_; 64 base::FilePath managed_policy_path_;
55 65
56 // Watches for events on the |managed_policy_path_|. 66 // Watches for events on the |managed_policy_path_|.
57 base::FilePathWatcher watcher_; 67 base::FilePathWatcher watcher_;
58 68
59 DISALLOW_COPY_AND_ASSIGN(PolicyLoaderMac); 69 DISALLOW_COPY_AND_ASSIGN(PolicyLoaderMac);
60 }; 70 };
61 71
62 } // namespace policy 72 } // namespace policy
63 73
64 #endif // CHROME_BROWSER_POLICY_POLICY_LOADER_MAC_H_ 74 #endif // CHROME_BROWSER_POLICY_POLICY_LOADER_MAC_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/policy/policy_loader_mac.cc » ('j') | chrome/browser/policy/policy_loader_mac.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698