summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjoaodasilva@chromium.org <joaodasilva@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-12-01 13:14:50 +0000
committerjoaodasilva@chromium.org <joaodasilva@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-12-01 13:14:50 +0000
commit6fd9df6e95ede5d08f70bade7bc36767739865d5 (patch)
tree7ac69d3bf44d7e02572bad29650829564add1076
parent3fc40c14495f094dbb47ae4237e8d013304de0f4 (diff)
downloadchromium_src-6fd9df6e95ede5d08f70bade7bc36767739865d5.zip
chromium_src-6fd9df6e95ede5d08f70bade7bc36767739865d5.tar.gz
chromium_src-6fd9df6e95ede5d08f70bade7bc36767739865d5.tar.bz2
Added recommended pref store on Windows.
BUG=49941 TEST=Set policies for Chromium/Chrome in a registry subkey named "Recommended". Those policies become the default values and can be overridden by the user. Review URL: http://codereview.chromium.org/8551010 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@112456 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/app/breakpad_win.cc13
-rw-r--r--chrome/app/chrome_main_delegate.cc6
-rw-r--r--chrome/browser/policy/browser_policy_connector.cc9
-rw-r--r--chrome/browser/policy/configuration_policy_provider_delegate_win.cc17
-rw-r--r--chrome/browser/policy/configuration_policy_provider_delegate_win.h7
-rw-r--r--chrome/browser/policy/configuration_policy_provider_win.cc6
-rw-r--r--chrome/browser/policy/configuration_policy_provider_win.h5
-rw-r--r--chrome/browser/policy/configuration_policy_provider_win_unittest.cc22
-rwxr-xr-xchrome/tools/build/generate_policy_source.py61
-rw-r--r--chrome_frame/policy_settings.cc6
-rw-r--r--chrome_frame/test/policy_settings_unittest.cc4
11 files changed, 92 insertions, 64 deletions
diff --git a/chrome/app/breakpad_win.cc b/chrome/app/breakpad_win.cc
index 58a9d27..57f9d6f 100644
--- a/chrome/app/breakpad_win.cc
+++ b/chrome/app/breakpad_win.cc
@@ -564,17 +564,16 @@ extern "C" int __declspec(dllexport) CrashForException(
static bool MetricsReportingControlledByPolicy(bool* result) {
std::wstring key_name = UTF8ToWide(policy::key::kMetricsReportingEnabled);
DWORD value = 0;
- // TODO(joshia): why hkcu_policy_key opens HKEY_LOCAL_MACHINE?
- base::win::RegKey hkcu_policy_key(HKEY_LOCAL_MACHINE,
- policy::kRegistrySubKey, KEY_READ);
- if (hkcu_policy_key.ReadValueDW(key_name.c_str(), &value) == ERROR_SUCCESS) {
+ base::win::RegKey hklm_policy_key(HKEY_LOCAL_MACHINE,
+ policy::kRegistryMandatorySubKey, KEY_READ);
+ if (hklm_policy_key.ReadValueDW(key_name.c_str(), &value) == ERROR_SUCCESS) {
*result = value != 0;
return true;
}
- base::win::RegKey hklm_policy_key(HKEY_CURRENT_USER,
- policy::kRegistrySubKey, KEY_READ);
- if (hklm_policy_key.ReadValueDW(key_name.c_str(), &value) == ERROR_SUCCESS) {
+ base::win::RegKey hkcu_policy_key(HKEY_CURRENT_USER,
+ policy::kRegistryMandatorySubKey, KEY_READ);
+ if (hkcu_policy_key.ReadValueDW(key_name.c_str(), &value) == ERROR_SUCCESS) {
*result = value != 0;
return true;
}
diff --git a/chrome/app/chrome_main_delegate.cc b/chrome/app/chrome_main_delegate.cc
index 257f354..5c96e27 100644
--- a/chrome/app/chrome_main_delegate.cc
+++ b/chrome/app/chrome_main_delegate.cc
@@ -139,8 +139,10 @@ bool LoadUserDataDirPolicyFromRegistry(HKEY hive,
FilePath* user_data_dir) {
std::wstring value;
- base::win::RegKey hklm_policy_key(hive, policy::kRegistrySubKey, KEY_READ);
- if (hklm_policy_key.ReadValue(key_name.c_str(), &value) == ERROR_SUCCESS) {
+ base::win::RegKey policy_key(hive,
+ policy::kRegistryMandatorySubKey,
+ KEY_READ);
+ if (policy_key.ReadValue(key_name.c_str(), &value) == ERROR_SUCCESS) {
*user_data_dir = FilePath(policy::path_parser::ExpandPathVariables(value));
return true;
}
diff --git a/chrome/browser/policy/browser_policy_connector.cc b/chrome/browser/policy/browser_policy_connector.cc
index ef85d68..03af03a 100644
--- a/chrome/browser/policy/browser_policy_connector.cc
+++ b/chrome/browser/policy/browser_policy_connector.cc
@@ -443,7 +443,8 @@ ConfigurationPolicyProvider*
BrowserPolicyConnector::CreateManagedPlatformProvider() {
const PolicyDefinitionList* policy_list = GetChromePolicyDefinitionList();
#if defined(OS_WIN)
- return new ConfigurationPolicyProviderWin(policy_list);
+ return new ConfigurationPolicyProviderWin(policy_list,
+ policy::kRegistryMandatorySubKey);
#elif defined(OS_MACOSX)
return new ConfigurationPolicyProviderMac(policy_list);
#elif defined(OS_POSIX)
@@ -463,7 +464,11 @@ ConfigurationPolicyProvider*
// static
ConfigurationPolicyProvider*
BrowserPolicyConnector::CreateRecommendedPlatformProvider() {
-#if defined(OS_POSIX) && !defined(OS_MACOSX)
+#if defined(OS_WIN)
+ const PolicyDefinitionList* policy_list = GetChromePolicyDefinitionList();
+ return new ConfigurationPolicyProviderWin(policy_list,
+ policy::kRegistryRecommendedSubKey);
+#elif defined(OS_POSIX) && !defined(OS_MACOSX)
const PolicyDefinitionList* policy_list = GetChromePolicyDefinitionList();
FilePath config_dir_path;
if (PathService::Get(chrome::DIR_POLICY_FILES, &config_dir_path)) {
diff --git a/chrome/browser/policy/configuration_policy_provider_delegate_win.cc b/chrome/browser/policy/configuration_policy_provider_delegate_win.cc
index a7f47cb..042dc98 100644
--- a/chrome/browser/policy/configuration_policy_provider_delegate_win.cc
+++ b/chrome/browser/policy/configuration_policy_provider_delegate_win.cc
@@ -46,9 +46,10 @@ bool ReadRegistryStringValue(RegKey* key, const string16& name,
namespace policy {
ConfigurationPolicyProviderDelegateWin::ConfigurationPolicyProviderDelegateWin(
- const PolicyDefinitionList* policy_definition_list)
- : policy_definition_list_(policy_definition_list) {
-}
+ const PolicyDefinitionList* policy_definition_list,
+ const string16& registry_key)
+ : policy_definition_list_(policy_definition_list),
+ registry_key_(registry_key) {}
DictionaryValue* ConfigurationPolicyProviderDelegateWin::Load() {
DictionaryValue* result = new DictionaryValue();
@@ -94,13 +95,13 @@ DictionaryValue* ConfigurationPolicyProviderDelegateWin::Load() {
bool ConfigurationPolicyProviderDelegateWin::GetRegistryPolicyString(
const string16& name, string16* result) const {
- RegKey policy_key(HKEY_LOCAL_MACHINE, kRegistrySubKey, KEY_READ);
+ RegKey policy_key(HKEY_LOCAL_MACHINE, registry_key_.c_str(), KEY_READ);
// First try the global policy.
if (ReadRegistryStringValue(&policy_key, name, result))
return true;
// Fall back on user-specific policy.
- if (policy_key.Open(HKEY_CURRENT_USER, kRegistrySubKey,
+ if (policy_key.Open(HKEY_CURRENT_USER, registry_key_.c_str(),
KEY_READ) != ERROR_SUCCESS)
return false;
return ReadRegistryStringValue(&policy_key, name, result);
@@ -108,7 +109,7 @@ bool ConfigurationPolicyProviderDelegateWin::GetRegistryPolicyString(
bool ConfigurationPolicyProviderDelegateWin::GetRegistryPolicyStringList(
const string16& key, ListValue* result) const {
- string16 path = string16(kRegistrySubKey);
+ string16 path = registry_key_;
path += ASCIIToUTF16("\\") + key;
RegKey policy_key;
if (policy_key.Open(HKEY_LOCAL_MACHINE, path.c_str(), KEY_READ) !=
@@ -139,13 +140,13 @@ bool ConfigurationPolicyProviderDelegateWin::GetRegistryPolicyBoolean(
bool ConfigurationPolicyProviderDelegateWin::GetRegistryPolicyInteger(
const string16& value_name, uint32* result) const {
DWORD value = 0;
- RegKey policy_key(HKEY_LOCAL_MACHINE, kRegistrySubKey, KEY_READ);
+ RegKey policy_key(HKEY_LOCAL_MACHINE, registry_key_.c_str(), KEY_READ);
if (policy_key.ReadValueDW(value_name.c_str(), &value) == ERROR_SUCCESS) {
*result = value;
return true;
}
- if (policy_key.Open(HKEY_CURRENT_USER, kRegistrySubKey, KEY_READ) ==
+ if (policy_key.Open(HKEY_CURRENT_USER, registry_key_.c_str(), KEY_READ) ==
ERROR_SUCCESS) {
if (policy_key.ReadValueDW(value_name.c_str(), &value) == ERROR_SUCCESS) {
*result = value;
diff --git a/chrome/browser/policy/configuration_policy_provider_delegate_win.h b/chrome/browser/policy/configuration_policy_provider_delegate_win.h
index 2685591..3420485 100644
--- a/chrome/browser/policy/configuration_policy_provider_delegate_win.h
+++ b/chrome/browser/policy/configuration_policy_provider_delegate_win.h
@@ -6,6 +6,7 @@
#define CHROME_BROWSER_POLICY_CONFIGURATION_POLICY_PROVIDER_DELEGATE_WIN_H_
#pragma once
+#include "base/string16.h"
#include "chrome/browser/policy/asynchronous_policy_provider.h"
namespace policy {
@@ -13,8 +14,9 @@ namespace policy {
class ConfigurationPolicyProviderDelegateWin
: public AsynchronousPolicyProvider::Delegate {
public:
- explicit ConfigurationPolicyProviderDelegateWin(
- const PolicyDefinitionList* policy_definition_list);
+ ConfigurationPolicyProviderDelegateWin(
+ const PolicyDefinitionList* policy_definition_list,
+ const string16& registry_key);
virtual ~ConfigurationPolicyProviderDelegateWin() {}
// AsynchronousPolicyProvider::Delegate overrides:
@@ -36,6 +38,7 @@ class ConfigurationPolicyProviderDelegateWin
uint32* result) const;
const PolicyDefinitionList* policy_definition_list_;
+ const string16 registry_key_;
DISALLOW_COPY_AND_ASSIGN(ConfigurationPolicyProviderDelegateWin);
};
diff --git a/chrome/browser/policy/configuration_policy_provider_win.cc b/chrome/browser/policy/configuration_policy_provider_win.cc
index bb4b39d..f968e2c 100644
--- a/chrome/browser/policy/configuration_policy_provider_win.cc
+++ b/chrome/browser/policy/configuration_policy_provider_win.cc
@@ -18,11 +18,13 @@ const int kReloadIntervalMinutes = 15;
} // namespace
ConfigurationPolicyProviderWin::ConfigurationPolicyProviderWin(
- const PolicyDefinitionList* policy_list)
+ const PolicyDefinitionList* policy_list,
+ const string16& registry_key)
: AsynchronousPolicyProvider(
policy_list,
new ConfigurationPolicyLoaderWin(
- new ConfigurationPolicyProviderDelegateWin(policy_list),
+ new ConfigurationPolicyProviderDelegateWin(policy_list,
+ registry_key),
kReloadIntervalMinutes)) {}
} // namespace policy
diff --git a/chrome/browser/policy/configuration_policy_provider_win.h b/chrome/browser/policy/configuration_policy_provider_win.h
index 31e4a2b..1f8755b 100644
--- a/chrome/browser/policy/configuration_policy_provider_win.h
+++ b/chrome/browser/policy/configuration_policy_provider_win.h
@@ -6,6 +6,7 @@
#define CHROME_BROWSER_POLICY_CONFIGURATION_POLICY_PROVIDER_WIN_H_
#pragma once
+#include "base/string16.h"
#include "chrome/browser/policy/asynchronous_policy_provider.h"
namespace policy {
@@ -18,8 +19,8 @@ namespace policy {
// the latest version of the policy set by administrators.
class ConfigurationPolicyProviderWin : public AsynchronousPolicyProvider {
public:
- explicit ConfigurationPolicyProviderWin(
- const PolicyDefinitionList* policy_list);
+ ConfigurationPolicyProviderWin(const PolicyDefinitionList* policy_list,
+ const string16& registry_key);
virtual ~ConfigurationPolicyProviderWin() {}
private:
diff --git a/chrome/browser/policy/configuration_policy_provider_win_unittest.cc b/chrome/browser/policy/configuration_policy_provider_win_unittest.cc
index 7f5093c..7e54902 100644
--- a/chrome/browser/policy/configuration_policy_provider_win_unittest.cc
+++ b/chrome/browser/policy/configuration_policy_provider_win_unittest.cc
@@ -135,28 +135,29 @@ void TestHarness::SetUp() {}
AsynchronousPolicyProvider* TestHarness::CreateProvider(
const PolicyDefinitionList* policy_definition_list) {
- return new ConfigurationPolicyProviderWin(policy_definition_list);
+ return new ConfigurationPolicyProviderWin(policy_definition_list,
+ policy::kRegistryMandatorySubKey);
}
void TestHarness::InstallEmptyPolicy() {}
void TestHarness::InstallStringPolicy(const std::string& policy_name,
const std::string& policy_value) {
- RegKey key(hive_, policy::kRegistrySubKey, KEY_ALL_ACCESS);
+ RegKey key(hive_, policy::kRegistryMandatorySubKey, KEY_ALL_ACCESS);
key.WriteValue(UTF8ToUTF16(policy_name).c_str(),
UTF8ToUTF16(policy_value).c_str());
}
void TestHarness::InstallIntegerPolicy(const std::string& policy_name,
int policy_value) {
- RegKey key(hive_, policy::kRegistrySubKey, KEY_ALL_ACCESS);
+ RegKey key(hive_, policy::kRegistryMandatorySubKey, KEY_ALL_ACCESS);
key.WriteValue(UTF8ToUTF16(policy_name).c_str(),
static_cast<DWORD>(policy_value));
}
void TestHarness::InstallBooleanPolicy(const std::string& policy_name,
bool policy_value) {
- RegKey key(hive_, policy::kRegistrySubKey, KEY_ALL_ACCESS);
+ RegKey key(hive_, policy::kRegistryMandatorySubKey, KEY_ALL_ACCESS);
key.WriteValue(UTF8ToUTF16(policy_name).c_str(),
static_cast<DWORD>(policy_value));
}
@@ -164,7 +165,7 @@ void TestHarness::InstallBooleanPolicy(const std::string& policy_name,
void TestHarness::InstallStringListPolicy(const std::string& policy_name,
const ListValue* policy_value) {
RegKey key(hive_,
- (string16(policy::kRegistrySubKey) + ASCIIToUTF16("\\") +
+ (string16(policy::kRegistryMandatorySubKey) + ASCIIToUTF16("\\") +
UTF8ToUTF16(policy_name)).c_str(),
KEY_ALL_ACCESS);
int index = 1;
@@ -202,7 +203,8 @@ INSTANTIATE_TEST_CASE_P(
class ConfigurationPolicyProviderWinTest : public AsynchronousPolicyTestBase {
protected:
ConfigurationPolicyProviderWinTest()
- : provider_(&test_policy_definitions::kList) {}
+ : provider_(&test_policy_definitions::kList,
+ policy::kRegistryMandatorySubKey) {}
virtual ~ConfigurationPolicyProviderWinTest() {}
ScopedGroupPolicyRegistrySandbox registry_sandbox_;
@@ -210,10 +212,14 @@ class ConfigurationPolicyProviderWinTest : public AsynchronousPolicyTestBase {
};
TEST_F(ConfigurationPolicyProviderWinTest, HKLMOverHKCU) {
- RegKey hklm_key(HKEY_LOCAL_MACHINE, policy::kRegistrySubKey, KEY_ALL_ACCESS);
+ RegKey hklm_key(HKEY_LOCAL_MACHINE,
+ policy::kRegistryMandatorySubKey,
+ KEY_ALL_ACCESS);
hklm_key.WriteValue(UTF8ToUTF16(test_policy_definitions::kKeyString).c_str(),
UTF8ToUTF16("hklm").c_str());
- RegKey hkcu_key(HKEY_CURRENT_USER, policy::kRegistrySubKey, KEY_ALL_ACCESS);
+ RegKey hkcu_key(HKEY_CURRENT_USER,
+ policy::kRegistryMandatorySubKey,
+ KEY_ALL_ACCESS);
hkcu_key.WriteValue(UTF8ToUTF16(test_policy_definitions::kKeyString).c_str(),
UTF8ToUTF16("hkcu").c_str());
diff --git a/chrome/tools/build/generate_policy_source.py b/chrome/tools/build/generate_policy_source.py
index e405713..31d6960 100755
--- a/chrome/tools/build/generate_policy_source.py
+++ b/chrome/tools/build/generate_policy_source.py
@@ -12,11 +12,13 @@ template is the path to a .json policy template file.'''
from __future__ import with_statement
from optparse import OptionParser
-import sys;
+import sys
-CHROME_SUBKEY = 'SOFTWARE\\\\Policies\\\\Google\\\\Chrome';
-CHROMIUM_SUBKEY = 'SOFTWARE\\\\Policies\\\\Chromium';
+CHROME_MANDATORY_SUBKEY = 'SOFTWARE\\\\Policies\\\\Google\\\\Chrome'
+CHROME_RECOMMENDED_SUBKEY = CHROME_MANDATORY_SUBKEY + '\\\\Recommended'
+CHROMIUM_MANDATORY_SUBKEY = 'SOFTWARE\\\\Policies\\\\Chromium'
+CHROMIUM_RECOMMENDED_SUBKEY = CHROMIUM_MANDATORY_SUBKEY + '\\\\Recommended'
TYPE_MAP = {
'int': 'TYPE_INTEGER',
@@ -29,36 +31,36 @@ TYPE_MAP = {
def main():
- parser = OptionParser(usage=__doc__);
+ parser = OptionParser(usage=__doc__)
parser.add_option("--pch", "--policy-constants-header", dest="header_path",
help="generate header file of policy constants",
- metavar="FILE");
+ metavar="FILE")
parser.add_option("--pcc", "--policy-constants-source", dest="source_path",
help="generate source file of policy constants",
- metavar="FILE");
+ metavar="FILE")
parser.add_option("--pth", "--policy-type-header", dest="type_path",
help="generate header file for policy type enumeration",
- metavar="FILE");
+ metavar="FILE")
parser.add_option("--ppb", "--policy-protobuf", dest="proto_path",
help="generate cloud policy protobuf file",
- metavar="FILE");
+ metavar="FILE")
parser.add_option("--ppd", "--protobuf-decoder", dest="decoder_path",
help="generate C++ code decoding the policy protobuf",
- metavar="FILE");
+ metavar="FILE")
- (opts, args) = parser.parse_args();
+ (opts, args) = parser.parse_args()
if len(args) != 3:
print "exactly platform, chromium_os flag and input file must be specified."
parser.print_help()
return 2
- template_file_contents = _LoadJSONFile(args[2]);
+ template_file_contents = _LoadJSONFile(args[2])
if opts.header_path is not None:
- _WritePolicyConstantHeader(template_file_contents, args, opts);
+ _WritePolicyConstantHeader(template_file_contents, args, opts)
if opts.source_path is not None:
- _WritePolicyConstantSource(template_file_contents, args, opts);
+ _WritePolicyConstantSource(template_file_contents, args, opts)
if opts.type_path is not None:
- _WritePolicyTypeEnumerationHeader(template_file_contents, args, opts);
+ _WritePolicyTypeEnumerationHeader(template_file_contents, args, opts)
if opts.proto_path is not None:
_WriteProtobuf(template_file_contents, args, opts.proto_path)
if opts.decoder_path is not None:
@@ -90,7 +92,7 @@ def _GetPolicyDetails(policy):
def _GetPolicyList(template_file_contents):
- policies = [];
+ policies = []
for policy in template_file_contents['policy_definitions']:
if policy['type'] == 'group':
for sub_policy in policy['policies']:
@@ -126,7 +128,7 @@ def _LoadJSONFile(json_file):
#------------------ policy constants header ------------------------#
def _WritePolicyConstantHeader(template_file_contents, args, opts):
- os = args[0];
+ os = args[0]
with open(opts.header_path, "w") as f:
_OutputGeneratedWarningForC(f, args[2])
@@ -140,9 +142,12 @@ def _WritePolicyConstantHeader(template_file_contents, args, opts):
'namespace policy {\n\n')
if os == "win":
- f.write('// The windows registry path where policy configuration '
- 'resides.\n'
- 'extern const wchar_t kRegistrySubKey[];\n\n')
+ f.write('// The windows registry path where mandatory policy '
+ 'configuration resides.\n'
+ 'extern const wchar_t kRegistryMandatorySubKey[];\n'
+ '// The windows registry path where recommended policy '
+ 'configuration resides.\n'
+ 'extern const wchar_t kRegistryRecommendedSubKey[];\n\n')
f.write('// Lists policy types mapped to their names and expected types.\n'
'// Used to initialize ConfigurationPolicyProviders.\n'
@@ -176,7 +181,7 @@ def _WritePolicyConstantHeader(template_file_contents, args, opts):
#------------------ policy constants source ------------------------#
def _WritePolicyConstantSource(template_file_contents, args, opts):
- os = args[0];
+ os = args[0]
is_chromium_os = args[1] == "1"
platform = None
platform_wildcard = None
@@ -209,7 +214,7 @@ def _WritePolicyConstantSource(template_file_contents, args, opts):
'};\n\n')
f.write('// Maps a policy-type enum value to the policy name.\n'
- 'const char* kPolicyNameMap[] = {\n');
+ 'const char* kPolicyNameMap[] = {\n')
for name in _GetPolicyNameList(template_file_contents):
f.write(' key::k%s,\n' % name)
f.write('};\n\n')
@@ -224,11 +229,15 @@ def _WritePolicyConstantSource(template_file_contents, args, opts):
if os == "win":
f.write('#if defined(GOOGLE_CHROME_BUILD)\n'
- 'const wchar_t kRegistrySubKey[] = '
- 'L"' + CHROME_SUBKEY + '";\n'
+ 'const wchar_t kRegistryMandatorySubKey[] = '
+ 'L"' + CHROME_MANDATORY_SUBKEY + '";\n'
+ 'const wchar_t kRegistryRecommendedSubKey[] = '
+ 'L"' + CHROME_RECOMMENDED_SUBKEY + '";\n'
'#else\n'
- 'const wchar_t kRegistrySubKey[] = '
- 'L"' + CHROMIUM_SUBKEY + '";\n'
+ 'const wchar_t kRegistryMandatorySubKey[] = '
+ 'L"' + CHROMIUM_MANDATORY_SUBKEY + '";\n'
+ 'const wchar_t kRegistryRecommendedSubKey[] = '
+ 'L"' + CHROMIUM_RECOMMENDED_SUBKEY + '";\n'
'#endif\n\n')
f.write('const char* GetPolicyName(ConfigurationPolicyType type) {\n'
@@ -269,7 +278,7 @@ def _WritePolicyTypeEnumerationHeader(template_file_contents, args, opts):
'\n'
'enum ConfigurationPolicyType {\n')
for policy_name in _GetPolicyNameList(template_file_contents):
- f.write(' kPolicy' + policy_name + ",\n");
+ f.write(' kPolicy' + policy_name + ",\n")
f.write('};\n\n'
'} // namespace policy\n\n'
'#endif // CHROME_BROWSER_POLICY_CONFIGURATION_POLICY_TYPE_H_\n')
diff --git a/chrome_frame/policy_settings.cc b/chrome_frame/policy_settings.cc
index 97c0810..d3a6f33 100644
--- a/chrome_frame/policy_settings.cc
+++ b/chrome_frame/policy_settings.cc
@@ -70,7 +70,7 @@ void PolicySettings::ReadUrlSettings(
std::wstring settings_value(
ASCIIToWide(policy::key::kChromeFrameRendererSettings));
for (int i = 0; i < arraysize(kRootKeys); ++i) {
- if ((config_key.Open(kRootKeys[i], policy::kRegistrySubKey,
+ if ((config_key.Open(kRootKeys[i], policy::kRegistryMandatorySubKey,
KEY_READ) == ERROR_SUCCESS) &&
(config_key.ReadValueDW(settings_value.c_str(),
&value) == ERROR_SUCCESS)) {
@@ -105,7 +105,7 @@ void PolicySettings::ReadContentTypeSetting(
std::vector<std::wstring>* content_type_list) {
DCHECK(content_type_list);
- std::wstring sub_key(policy::kRegistrySubKey);
+ std::wstring sub_key(policy::kRegistryMandatorySubKey);
sub_key += L"\\";
sub_key += ASCIIToWide(policy::key::kChromeFrameContentTypes);
@@ -126,7 +126,7 @@ void PolicySettings::ReadApplicationLocaleSetting(
std::wstring application_locale_value(
ASCIIToWide(policy::key::kApplicationLocaleValue));
for (int i = 0; i < arraysize(kRootKeys); ++i) {
- if ((config_key.Open(kRootKeys[i], policy::kRegistrySubKey,
+ if ((config_key.Open(kRootKeys[i], policy::kRegistryMandatorySubKey,
KEY_READ) == ERROR_SUCCESS) &&
(config_key.ReadValue(application_locale_value.c_str(),
application_locale) == ERROR_SUCCESS)) {
diff --git a/chrome_frame/test/policy_settings_unittest.cc b/chrome_frame/test/policy_settings_unittest.cc
index 99d970f..f3d5e12 100644
--- a/chrome_frame/test/policy_settings_unittest.cc
+++ b/chrome_frame/test/policy_settings_unittest.cc
@@ -22,7 +22,7 @@ namespace {
// A best effort way to zap CF policy entries that may be in the registry.
void DeleteChromeFramePolicyEntries(HKEY root) {
RegKey key;
- if (key.Open(root, policy::kRegistrySubKey,
+ if (key.Open(root, policy::kRegistryMandatorySubKey,
KEY_ALL_ACCESS) == ERROR_SUCCESS) {
key.DeleteValue(
ASCIIToWide(policy::key::kChromeFrameRendererSettings).c_str());
@@ -35,7 +35,7 @@ void DeleteChromeFramePolicyEntries(HKEY root) {
bool InitializePolicyKey(HKEY policy_root, RegKey* policy_key) {
EXPECT_EQ(ERROR_SUCCESS, policy_key->Create(policy_root,
- policy::kRegistrySubKey, KEY_ALL_ACCESS));
+ policy::kRegistryMandatorySubKey, KEY_ALL_ACCESS));
return policy_key->Valid();
}