From 87e70062789c3695762c0ddaca1a759e8834398a Mon Sep 17 00:00:00 2001 From: "tfarina@chromium.org" Date: Sat, 14 Aug 2010 02:13:43 +0000 Subject: 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 --- chrome/installer/setup/uninstall.cc | 2 +- chrome/installer/util/google_chrome_distribution.cc | 2 +- chrome/installer/util/install_util.cc | 4 ++-- chrome/installer/util/shell_util.cc | 16 ++++++++-------- 4 files changed, 12 insertions(+), 12 deletions(-) (limited to 'chrome/installer') diff --git a/chrome/installer/setup/uninstall.cc b/chrome/installer/setup/uninstall.cc index 2d19ca4..f8c0482 100644 --- a/chrome/installer/setup/uninstall.cc +++ b/chrome/installer/setup/uninstall.cc @@ -72,7 +72,7 @@ bool CurrentUserHasDefaultBrowser(bool system_uninstall) { std::wstring reg_key(ShellUtil::kRegStartMenuInternet); BrowserDistribution* dist = BrowserDistribution::GetDistribution(); reg_key.append(L"\\" + dist->GetApplicationName() + ShellUtil::kRegShellOpen); - RegKey key(HKEY_LOCAL_MACHINE, reg_key.c_str()); + RegKey key(HKEY_LOCAL_MACHINE, reg_key.c_str(), KEY_READ); std::wstring reg_exe; if (key.ReadValue(L"", ®_exe) && reg_exe.length() > 2) { std::wstring chrome_exe = installer::GetChromeInstallPath(system_uninstall); diff --git a/chrome/installer/util/google_chrome_distribution.cc b/chrome/installer/util/google_chrome_distribution.cc index 8a2069d..adb5b1a 100644 --- a/chrome/installer/util/google_chrome_distribution.cc +++ b/chrome/installer/util/google_chrome_distribution.cc @@ -412,7 +412,7 @@ std::wstring GoogleChromeDistribution::GetDistributionData(RegKey* key) { sub_key.append(L"\\"); sub_key.append(product_guid()); - RegKey client_state_key(key->Handle(), sub_key.c_str()); + RegKey client_state_key(key->Handle(), sub_key.c_str(), KEY_READ); std::wstring result; std::wstring brand_value; if (client_state_key.ReadValue(google_update::kRegRLZBrandField, diff --git a/chrome/installer/util/install_util.cc b/chrome/installer/util/install_util.cc index a64a7cc..3ace4bf 100644 --- a/chrome/installer/util/install_util.cc +++ b/chrome/installer/util/install_util.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. +// Copyright (c) 2010 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. // @@ -55,7 +55,7 @@ bool InstallUtil::ExecuteExeAsAdmin(const std::wstring& exe, std::wstring InstallUtil::GetChromeUninstallCmd(bool system_install) { HKEY root = system_install ? HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER; BrowserDistribution* dist = BrowserDistribution::GetDistribution(); - RegKey key(root, dist->GetUninstallRegPath().c_str()); + RegKey key(root, dist->GetUninstallRegPath().c_str(), KEY_READ); std::wstring uninstall_cmd; key.ReadValue(installer_util::kUninstallStringField, &uninstall_cmd); return uninstall_cmd; diff --git a/chrome/installer/util/shell_util.cc b/chrome/installer/util/shell_util.cc index 7d170d0..1655af7 100644 --- a/chrome/installer/util/shell_util.cc +++ b/chrome/installer/util/shell_util.cc @@ -191,7 +191,7 @@ class RegistryEntry { // Checks if the current registry entry exists in HKLM registry and the value // is same. bool ExistsInHKLM() const { - RegKey key(HKEY_LOCAL_MACHINE, _key_path.c_str()); + RegKey key(HKEY_LOCAL_MACHINE, _key_path.c_str(), KEY_READ); bool found = false; if (_is_string) { std::wstring read_value; @@ -211,7 +211,7 @@ class RegistryEntry { // Checks if the current registry entry exists in HKLM registry // (only the name). bool NameExistsInHKLM() const { - RegKey key(HKEY_LOCAL_MACHINE, _key_path.c_str()); + RegKey key(HKEY_LOCAL_MACHINE, _key_path.c_str(), KEY_READ); bool found = false; if (_is_string) { std::wstring read_value; @@ -303,7 +303,7 @@ bool ElevateAndRegisterChrome(const std::wstring& chrome_exe, BrowserDistribution* dist = BrowserDistribution::GetDistribution(); HKEY reg_root = InstallUtil::IsPerUserInstall(chrome_exe.c_str()) ? HKEY_CURRENT_USER : HKEY_LOCAL_MACHINE; - RegKey key(reg_root, dist->GetUninstallRegPath().c_str()); + RegKey key(reg_root, dist->GetUninstallRegPath().c_str(), KEY_READ); key.ReadValue(installer_util::kUninstallStringField, &exe_path); CommandLine command_line = CommandLine::FromString(exe_path); exe_path = command_line.program(); @@ -349,7 +349,7 @@ bool AnotherUserHasDefaultBrowser(const std::wstring& chrome_exe) { std::wstring reg_key(ShellUtil::kRegStartMenuInternet); BrowserDistribution* dist = BrowserDistribution::GetDistribution(); reg_key.append(L"\\" + dist->GetApplicationName() + ShellUtil::kRegShellOpen); - RegKey key(HKEY_LOCAL_MACHINE, reg_key.c_str()); + RegKey key(HKEY_LOCAL_MACHINE, reg_key.c_str(), KEY_READ); std::wstring registry_chrome_exe; if (!key.ReadValue(L"", ®istry_chrome_exe) || registry_chrome_exe.length() < 2) @@ -569,15 +569,15 @@ void ShellUtil::GetRegisteredBrowsers(std::mapGetApplicationName() + *entry); - RegKey key(HKEY_LOCAL_MACHINE, start_menu_entry.c_str()); + RegKey key(HKEY_LOCAL_MACHINE, start_menu_entry.c_str(), KEY_READ); return key.Valid(); } -- cgit v1.1