| 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_CONFIGURATION_POLICY_PROVIDER_WIN_H_ | 5 #ifndef CHROME_BROWSER_CONFIGURATION_POLICY_PROVIDER_WIN_H_ |
| 6 #define CHROME_BROWSER_CONFIGURATION_POLICY_PROVIDER_WIN_H_ | 6 #define CHROME_BROWSER_CONFIGURATION_POLICY_PROVIDER_WIN_H_ |
| 7 | 7 |
| 8 #include "chrome/browser/configuration_policy_store.h" | 8 #include "chrome/browser/configuration_policy_store.h" |
| 9 #include "chrome/browser/configuration_policy_provider.h" | 9 #include "chrome/browser/configuration_policy_provider.h" |
| 10 | 10 |
| 11 // An implementation of |ConfigurationPolicyProvider| using the | 11 // An implementation of |ConfigurationPolicyProvider| using the |
| 12 // mechanism provided by Windows Groups Policy. Policy decisions are | 12 // mechanism provided by Windows Groups Policy. Policy decisions are |
| 13 // stored as values in a special section of the Windows Registry. | 13 // stored as values in a special section of the Windows Registry. |
| 14 // On a managed machine in a domain, this portion of the registry is | 14 // On a managed machine in a domain, this portion of the registry is |
| 15 // periodically updated by the Windows Group Policy machinery to contain | 15 // periodically updated by the Windows Group Policy machinery to contain |
| 16 // the latest version of the policy set by administrators. | 16 // the latest version of the policy set by administrators. |
| 17 class WinConfigurationPolicyProvider : public ConfigurationPolicyProvider { | 17 class ConfigurationPolicyProviderWin : public ConfigurationPolicyProvider { |
| 18 public: | 18 public: |
| 19 WinConfigurationPolicyProvider(); | 19 ConfigurationPolicyProviderWin(); |
| 20 virtual ~WinConfigurationPolicyProvider() { } | 20 virtual ~ConfigurationPolicyProviderWin() { } |
| 21 | 21 |
| 22 // ConfigurationPolicyProvider method overrides: | 22 // ConfigurationPolicyProvider method overrides: |
| 23 virtual bool Provide(ConfigurationPolicyStore* store); | 23 virtual bool Provide(ConfigurationPolicyStore* store); |
| 24 | 24 |
| 25 protected: | 25 protected: |
| 26 // The sub key path for Chromiums's Group Policy information in the | 26 // The sub key path for Chromium's Group Policy information in the |
| 27 // Windows registry. | 27 // Windows registry. |
| 28 static const wchar_t kPolicyRegistrySubKey[]; | 28 static const wchar_t kPolicyRegistrySubKey[]; |
| 29 | 29 |
| 30 // Constants specifying the names of policy-specifying registry values | 30 // Constants specifying the names of policy-specifying registry values |
| 31 // in |kChromiumPolicySubKey|. | 31 // in |kChromiumPolicySubKey|. |
| 32 static const wchar_t kHomepageRegistryValueName[]; | 32 static const wchar_t kHomepageRegistryValueName[]; |
| 33 static const wchar_t kHomepageIsNewTabPageRegistryValueName[]; | 33 static const wchar_t kHomepageIsNewTabPageRegistryValueName[]; |
| 34 static const wchar_t kCookiesModeRegistryValueName[]; | 34 static const wchar_t kCookiesModeRegistryValueName[]; |
| 35 | 35 |
| 36 private: | 36 private: |
| 37 // For each Group Policy registry value that maps to a browser policy, there | 37 // For each Group Policy registry value that maps to a browser policy, there |
| 38 // is an entry in |registry_to_policy_map_| of type |RegistryPolicyMapEntry| | 38 // is an entry in |registry_to_policy_map_| of type |RegistryPolicyMapEntry| |
| 39 // that specifies the registry value name and the browser policy that it | 39 // that specifies the registry value name and the browser policy that it |
| 40 // maps to. | 40 // maps to. |
| 41 struct RegistryPolicyMapEntry { | 41 struct RegistryPolicyMapEntry { |
| 42 Value::ValueType value_type; | 42 Value::ValueType value_type; |
| 43 ConfigurationPolicyStore::PolicyType policy_type; | 43 ConfigurationPolicyStore::PolicyType policy_type; |
| 44 const wchar_t* registry_value_name; | 44 const wchar_t* registry_value_name; |
| 45 }; | 45 }; |
| 46 | 46 |
| 47 static const RegistryPolicyMapEntry registry_to_policy_map_[]; | 47 static const RegistryPolicyMapEntry registry_to_policy_map_[]; |
| 48 | 48 |
| 49 // Methods to perfrom type-specific policy lookups in the registry | 49 // Methods to perfrom type-specific policy lookups in the registry. |
| 50 // HKLM is checked fist, then HKLM. | 50 // HKLM is checked first, then HKCU. |
| 51 bool GetRegistryPolicyString(const wchar_t* value_name, string16* result); | 51 bool GetRegistryPolicyString(const wchar_t* value_name, string16* result); |
| 52 bool GetRegistryPolicyBoolean(const wchar_t* value_name, bool* result); | 52 bool GetRegistryPolicyBoolean(const wchar_t* value_name, bool* result); |
| 53 bool GetRegistryPolicyInteger(const wchar_t* value_name, uint32* result); | 53 bool GetRegistryPolicyInteger(const wchar_t* value_name, uint32* result); |
| 54 }; | 54 }; |
| 55 | 55 |
| 56 #endif // CHROME_BROWSER_CONFIGURATION_POLICY_PROVIDER_WIN_H_ | 56 #endif // CHROME_BROWSER_CONFIGURATION_POLICY_PROVIDER_WIN_H_ |
| 57 | 57 |
| OLD | NEW |