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

Side by Side Diff: chrome/browser/policy/configuration_policy_provider_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_CONFIGURATION_POLICY_PROVIDER_MAC_H_
6 #define CHROME_BROWSER_POLICY_CONFIGURATION_POLICY_PROVIDER_MAC_H_
7 #pragma once
8
9 #include <CoreFoundation/CoreFoundation.h>
10
11 #include "base/memory/scoped_ptr.h"
12 #include "chrome/browser/policy/file_based_policy_provider.h"
13
14 class MacPreferences;
15
16 namespace base {
17 class Value;
18 }
19
20 namespace policy {
21
22 // A provider delegate implementation that reads Mac OS X's managed preferences.
23 class MacPreferencesPolicyProviderDelegate
24 : public FileBasedPolicyProvider::ProviderDelegate {
25 public:
26 // Takes ownership of |preferences|.
27 MacPreferencesPolicyProviderDelegate(
28 MacPreferences* preferences,
29 const PolicyDefinitionList* policy_list);
30 virtual ~MacPreferencesPolicyProviderDelegate();
31
32 // FileBasedPolicyLoader::Delegate implementation.
33 virtual scoped_ptr<PolicyBundle> Load() OVERRIDE;
34 virtual base::Time GetLastModification() OVERRIDE;
35
36 // Converts a CFPropertyListRef to the equivalent base::Value. CFDictionary
37 // entries whose key is not a CFStringRef are ignored.
38 // The returned value is owned by the caller.
39 // Returns NULL if an invalid CFType was found, such as CFDate or CFData.
40 static base::Value* CreateValueFromProperty(CFPropertyListRef property);
41
42 private:
43 // In order to access the application preferences API, the names and values of
44 // the policies that are recognized must be known to the loader.
45 // Unfortunately, we cannot get the policy list at load time from the
46 // provider, because the loader may outlive the provider, so we store our own
47 // pointer to the list.
48 const PolicyDefinitionList* policy_list_;
49
50 scoped_ptr<MacPreferences> preferences_;
51
52 DISALLOW_COPY_AND_ASSIGN(MacPreferencesPolicyProviderDelegate);
53 };
54
55 // An implementation of |ConfigurationPolicyProvider| using the mechanism
56 // provided by Mac OS X's managed preferences.
57 class ConfigurationPolicyProviderMac : public FileBasedPolicyProvider {
58 public:
59 explicit ConfigurationPolicyProviderMac(
60 const PolicyDefinitionList* policy_list);
61
62 // For testing; takes ownership of |preferences|.
63 ConfigurationPolicyProviderMac(const PolicyDefinitionList* policy_list,
64 MacPreferences* preferences);
65
66 DISALLOW_COPY_AND_ASSIGN(ConfigurationPolicyProviderMac);
67 };
68
69 } // namespace policy
70
71 #endif // CHROME_BROWSER_POLICY_CONFIGURATION_POLICY_PROVIDER_MAC_H_
OLDNEW
« no previous file with comments | « chrome/browser/policy/browser_policy_connector.cc ('k') | chrome/browser/policy/configuration_policy_provider_test.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698