Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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_CONFIGURATION_POLICY_PROVIDER_MAC_H_ | 5 #ifndef CHROME_BROWSER_POLICY_CONFIGURATION_POLICY_PROVIDER_MAC_H_ |
| 6 #define CHROME_BROWSER_POLICY_CONFIGURATION_POLICY_PROVIDER_MAC_H_ | 6 #define CHROME_BROWSER_POLICY_CONFIGURATION_POLICY_PROVIDER_MAC_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include "base/scoped_ptr.h" | 9 #include "base/scoped_ptr.h" |
| 10 #include "chrome/browser/policy/configuration_policy_store_interface.h" | 10 #include "chrome/browser/policy/configuration_policy_store_interface.h" |
| 11 #include "chrome/browser/policy/file_based_policy_provider.h" | 11 #include "chrome/browser/policy/file_based_policy_provider.h" |
| 12 #include "chrome/browser/preferences_mac.h" | 12 #include "chrome/browser/preferences_mac.h" |
| 13 | 13 |
| 14 namespace policy { | 14 namespace policy { |
| 15 | 15 |
| 16 // A policy loader implementation that read Mac OS X's managed preferences. | 16 // A provider delegate implementation that read Mac OS X's managed preferences. |
|
Mattias Nissler (ping if slow)
2010/12/06 10:26:20
s/read/reads/
danno
2010/12/06 14:05:12
Done.
| |
| 17 class MacPreferencesPolicyLoader : public FileBasedPolicyProvider::Delegate { | 17 class MacPreferencesPolicyProviderDelegate |
| 18 : public FileBasedPolicyProvider::ProviderDelegate { | |
| 18 public: | 19 public: |
| 19 // Takes ownership of |preferences|. | 20 // Takes ownership of |preferences|. |
| 20 MacPreferencesPolicyLoader( | 21 MacPreferencesPolicyProviderDelegate( |
| 21 MacPreferences* preferences, | 22 MacPreferences* preferences, |
| 22 const ConfigurationPolicyProvider::PolicyDefinitionList* policy_list); | 23 const ConfigurationPolicyProvider::PolicyDefinitionList* policy_list); |
| 23 | 24 |
| 24 // FileBasedPolicyLoader::Delegate implementation. | 25 // FileBasedPolicyLoader::Delegate implementation. |
| 25 virtual DictionaryValue* Load(); | 26 virtual DictionaryValue* Load(); |
| 26 virtual base::Time GetLastModification(); | 27 virtual base::Time GetLastModification(); |
| 27 | 28 |
| 28 private: | 29 private: |
| 29 // In order to access the application preferences API, the names and values of | 30 // In order to access the application preferences API, the names and values of |
| 30 // the policies that are recognized must be known to the loader. | 31 // the policies that are recognized must be known to the loader. |
| 31 // Unfortunately, we cannot get the policy list at load time from the | 32 // Unfortunately, we cannot get the policy list at load time from the |
| 32 // provider, because the loader may outlive the provider, so we store our own | 33 // provider, because the loader may outlive the provider, so we store our own |
| 33 // pointer to the list. | 34 // pointer to the list. |
| 34 const ConfigurationPolicyProvider::PolicyDefinitionList* policy_list_; | 35 const ConfigurationPolicyProvider::PolicyDefinitionList* policy_list_; |
| 35 | 36 |
| 36 scoped_ptr<MacPreferences> preferences_; | 37 scoped_ptr<MacPreferences> preferences_; |
| 37 | 38 |
| 38 DISALLOW_COPY_AND_ASSIGN(MacPreferencesPolicyLoader); | 39 DISALLOW_COPY_AND_ASSIGN(MacPreferencesPolicyProviderDelegate); |
| 39 }; | 40 }; |
| 40 | 41 |
| 41 // An implementation of |ConfigurationPolicyProvider| using the mechanism | 42 // An implementation of |ConfigurationPolicyProvider| using the mechanism |
| 42 // provided by Mac OS X's managed preferences. | 43 // provided by Mac OS X's managed preferences. |
| 43 class ConfigurationPolicyProviderMac | 44 class ConfigurationPolicyProviderMac |
| 44 : public FileBasedPolicyProvider { | 45 : public FileBasedPolicyProvider { |
| 45 public: | 46 public: |
| 46 explicit ConfigurationPolicyProviderMac( | 47 explicit ConfigurationPolicyProviderMac( |
| 47 const ConfigurationPolicyProvider::PolicyDefinitionList* policy_list); | 48 const ConfigurationPolicyProvider::PolicyDefinitionList* policy_list); |
| 48 // For testing; takes ownership of |preferences|. | 49 // For testing; takes ownership of |preferences|. |
| 49 ConfigurationPolicyProviderMac( | 50 ConfigurationPolicyProviderMac( |
| 50 const ConfigurationPolicyProvider::PolicyDefinitionList* policy_list, | 51 const ConfigurationPolicyProvider::PolicyDefinitionList* policy_list, |
| 51 MacPreferences* preferences); | 52 MacPreferences* preferences); |
| 52 | 53 |
| 53 DISALLOW_COPY_AND_ASSIGN(ConfigurationPolicyProviderMac); | 54 DISALLOW_COPY_AND_ASSIGN(ConfigurationPolicyProviderMac); |
| 54 }; | 55 }; |
| 55 | 56 |
| 56 } // namespace policy | 57 } // namespace policy |
| 57 | 58 |
| 58 #endif // CHROME_BROWSER_POLICY_CONFIGURATION_POLICY_PROVIDER_MAC_H_ | 59 #endif // CHROME_BROWSER_POLICY_CONFIGURATION_POLICY_PROVIDER_MAC_H_ |
| OLD | NEW |