summaryrefslogtreecommitdiffstats
path: root/chrome/browser
diff options
context:
space:
mode:
authortfarina@chromium.org <tfarina@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-08-14 02:13:43 +0000
committertfarina@chromium.org <tfarina@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-08-14 02:13:43 +0000
commit87e70062789c3695762c0ddaca1a759e8834398a (patch)
tree613a0a5fb74bc0ca8417976788fcce2666753d23 /chrome/browser
parentb5ff342a5aca83396114933152ad5d644f536375 (diff)
downloadchromium_src-87e70062789c3695762c0ddaca1a759e8834398a.zip
chromium_src-87e70062789c3695762c0ddaca1a759e8834398a.tar.gz
chromium_src-87e70062789c3695762c0ddaca1a759e8834398a.tar.bz2
Cleanup Registry API: part 3.
- Remove the default arguments from the constructor. - Add a empty constructor to handle the case of the default arguments were used. BUG=44644 TEST=trybots Review URL: http://codereview.chromium.org/3172009 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@56123 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser')
-rw-r--r--chrome/browser/extensions/extension_rlz_apitest.cc3
-rw-r--r--chrome/browser/importer/firefox_importer_utils_win.cc6
-rw-r--r--chrome/browser/importer/ie_importer.cc5
-rw-r--r--chrome/browser/policy/configuration_policy_provider_win.cc8
-rw-r--r--chrome/browser/policy/configuration_policy_provider_win_unittest.cc6
-rw-r--r--chrome/browser/views/shell_dialogs_win.cc2
6 files changed, 17 insertions, 13 deletions
diff --git a/chrome/browser/extensions/extension_rlz_apitest.cc b/chrome/browser/extensions/extension_rlz_apitest.cc
index 3d0ea9e..910a530 100644
--- a/chrome/browser/extensions/extension_rlz_apitest.cc
+++ b/chrome/browser/extensions/extension_rlz_apitest.cc
@@ -51,7 +51,8 @@ IN_PROC_BROWSER_TEST_F(ExtensionApiTest, Rlz) {
rlz_lib::ClearProductState(rlz_lib::DESKTOP, access_points);
// Check that the state has really been cleared.
- RegKey key(HKEY_CURRENT_USER, L"Software\\Google\\Common\\Rlz\\Events\\N");
+ RegKey key(HKEY_CURRENT_USER, L"Software\\Google\\Common\\Rlz\\Events\\N",
+ KEY_READ);
ASSERT_FALSE(key.Valid());
// Mock out experimental.rlz.sendFinancialPing().
diff --git a/chrome/browser/importer/firefox_importer_utils_win.cc b/chrome/browser/importer/firefox_importer_utils_win.cc
index 6887067..3200eb1 100644
--- a/chrome/browser/importer/firefox_importer_utils_win.cc
+++ b/chrome/browser/importer/firefox_importer_utils_win.cc
@@ -29,7 +29,7 @@ int GetCurrentFirefoxMajorVersionFromRegistry() {
// HKCU\Mozilla.
for (int i = 0; i < arraysize(kFireFoxRegistryPaths); ++i) {
RegKey reg_key(kFireFoxRegistryPaths[i],
- L"Software\\Mozilla\\Mozilla Firefox");
+ L"Software\\Mozilla\\Mozilla Firefox", KEY_READ);
bool result = reg_key.ReadValue(L"CurrentVersion", ver_buffer,
&ver_buffer_length, NULL);
@@ -45,14 +45,14 @@ std::wstring GetFirefoxInstallPathFromRegistry() {
std::wstring registry_path = L"Software\\Mozilla\\Mozilla Firefox";
wchar_t buffer[MAX_PATH];
DWORD buffer_length = sizeof(buffer);
- RegKey reg_key(HKEY_LOCAL_MACHINE, registry_path.c_str());
+ RegKey reg_key(HKEY_LOCAL_MACHINE, registry_path.c_str(), KEY_READ);
bool result = reg_key.ReadValue(L"CurrentVersion", buffer,
&buffer_length, NULL);
if (!result)
return std::wstring();
registry_path += L"\\" + std::wstring(buffer) + L"\\Main";
buffer_length = sizeof(buffer);
- RegKey reg_key_directory(HKEY_LOCAL_MACHINE, registry_path.c_str());
+ RegKey reg_key_directory(HKEY_LOCAL_MACHINE, registry_path.c_str(), KEY_READ);
result = reg_key_directory.ReadValue(L"Install Directory", buffer,
&buffer_length, NULL);
if (!result)
diff --git a/chrome/browser/importer/ie_importer.cc b/chrome/browser/importer/ie_importer.cc
index 21b36d1..ab0a61c 100644
--- a/chrome/browser/importer/ie_importer.cc
+++ b/chrome/browser/importer/ie_importer.cc
@@ -462,7 +462,8 @@ bool IEImporter::GetFavoritesInfo(IEImporter::FavoritesInfo *info) {
// The Link folder name is stored in the registry.
DWORD buffer_length = sizeof(buffer);
RegKey reg_key(HKEY_CURRENT_USER,
- L"Software\\Microsoft\\Internet Explorer\\Toolbar");
+ L"Software\\Microsoft\\Internet Explorer\\Toolbar",
+ KEY_READ);
if (!reg_key.ReadValue(L"LinksFolderName", buffer, &buffer_length, NULL))
return false;
info->links_folder = buffer;
@@ -571,7 +572,7 @@ int IEImporter::CurrentIEVersion() const {
wchar_t buffer[128];
DWORD buffer_length = sizeof(buffer);
RegKey reg_key(HKEY_LOCAL_MACHINE,
- L"Software\\Microsoft\\Internet Explorer");
+ L"Software\\Microsoft\\Internet Explorer", KEY_READ);
bool result = reg_key.ReadValue(L"Version", buffer, &buffer_length, NULL);
version = (result ? _wtoi(buffer) : 0);
}
diff --git a/chrome/browser/policy/configuration_policy_provider_win.cc b/chrome/browser/policy/configuration_policy_provider_win.cc
index eb6d92f..2e5904e 100644
--- a/chrome/browser/policy/configuration_policy_provider_win.cc
+++ b/chrome/browser/policy/configuration_policy_provider_win.cc
@@ -110,13 +110,13 @@ bool ConfigurationPolicyProviderWin::GetRegistryPolicyStringList(
bool ConfigurationPolicyProviderWin::GetRegistryPolicyBoolean(
const string16& value_name, bool* result) {
DWORD value;
- RegKey hkcu_policy_key(HKEY_LOCAL_MACHINE, policy::kRegistrySubKey);
+ RegKey hkcu_policy_key(HKEY_LOCAL_MACHINE, policy::kRegistrySubKey, KEY_READ);
if (hkcu_policy_key.ReadValueDW(value_name.c_str(), &value)) {
*result = value != 0;
return true;
}
- RegKey hklm_policy_key(HKEY_CURRENT_USER, policy::kRegistrySubKey);
+ RegKey hklm_policy_key(HKEY_CURRENT_USER, policy::kRegistrySubKey, KEY_READ);
if (hklm_policy_key.ReadValueDW(value_name.c_str(), &value)) {
*result = value != 0;
return true;
@@ -127,13 +127,13 @@ bool ConfigurationPolicyProviderWin::GetRegistryPolicyBoolean(
bool ConfigurationPolicyProviderWin::GetRegistryPolicyInteger(
const string16& value_name, uint32* result) {
DWORD value;
- RegKey hkcu_policy_key(HKEY_LOCAL_MACHINE, policy::kRegistrySubKey);
+ RegKey hkcu_policy_key(HKEY_LOCAL_MACHINE, policy::kRegistrySubKey, KEY_READ);
if (hkcu_policy_key.ReadValueDW(value_name.c_str(), &value)) {
*result = value;
return true;
}
- RegKey hklm_policy_key(HKEY_CURRENT_USER, policy::kRegistrySubKey);
+ RegKey hklm_policy_key(HKEY_CURRENT_USER, policy::kRegistrySubKey, KEY_READ);
if (hklm_policy_key.ReadValueDW(value_name.c_str(), &value)) {
*result = value;
return true;
diff --git a/chrome/browser/policy/configuration_policy_provider_win_unittest.cc b/chrome/browser/policy/configuration_policy_provider_win_unittest.cc
index ed499aa..236ccc6 100644
--- a/chrome/browser/policy/configuration_policy_provider_win_unittest.cc
+++ b/chrome/browser/policy/configuration_policy_provider_win_unittest.cc
@@ -149,8 +149,10 @@ class ConfigurationPolicyProviderWinTest : public testing::Test {
};
ConfigurationPolicyProviderWinTest::ConfigurationPolicyProviderWinTest()
- : temp_hklm_hive_key_(HKEY_CURRENT_USER, kUnitTestMachineOverrideSubKey),
- temp_hkcu_hive_key_(HKEY_CURRENT_USER, kUnitTestUserOverrideSubKey) {
+ : temp_hklm_hive_key_(HKEY_CURRENT_USER, kUnitTestMachineOverrideSubKey,
+ KEY_READ),
+ temp_hkcu_hive_key_(HKEY_CURRENT_USER, kUnitTestUserOverrideSubKey,
+ KEY_READ) {
}
void ConfigurationPolicyProviderWinTest::SetUp() {
diff --git a/chrome/browser/views/shell_dialogs_win.cc b/chrome/browser/views/shell_dialogs_win.cc
index fc8b96c..a90b7fb 100644
--- a/chrome/browser/views/shell_dialogs_win.cc
+++ b/chrome/browser/views/shell_dialogs_win.cc
@@ -48,7 +48,7 @@ std::wstring AppendExtensionIfNeeded(const std::wstring& filename,
std::wstring file_extension(file_util::GetFileExtensionFromPath(filename));
std::wstring key(L"." + file_extension);
if (!(filter_selected.empty() || filter_selected == L"*.*") &&
- !RegKey(HKEY_CLASSES_ROOT, key.c_str()).Valid() &&
+ !RegKey(HKEY_CLASSES_ROOT, key.c_str(), KEY_READ).Valid() &&
file_extension != suggested_ext) {
if (return_value[return_value.length() - 1] != L'.')
return_value.append(L".");