Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(5329)

Unified Diff: chrome/installer/util/install_util.cc

Issue 10451074: Always suffix ChromeHTML entries on Windows for user-level installs. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase on r142211 Created 8 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/installer/setup/uninstall.cc ('k') | chrome/installer/util/shell_util.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/installer/util/install_util.cc
diff --git a/chrome/installer/util/install_util.cc b/chrome/installer/util/install_util.cc
index d61c0b90ac2bf2270b26dbad72c9b00989cf429a..4b096efea481c58e706d55ba76082308b5d973b2 100644
--- a/chrome/installer/util/install_util.cc
+++ b/chrome/installer/util/install_util.cc
@@ -360,8 +360,8 @@ bool InstallUtil::HasDelegateExecuteHandler(BrowserDistribution* dist,
}
// This method tries to delete a registry key and logs an error message
-// in case of failure. It returns true if deletion is successful,
-// otherwise false.
+// in case of failure. It returns true if deletion is successful (or the key did
+// not exist), otherwise false.
bool InstallUtil::DeleteRegistryKey(HKEY root_key,
const string16& key_path) {
VLOG(1) << "Deleting registry key " << key_path;
@@ -375,20 +375,19 @@ bool InstallUtil::DeleteRegistryKey(HKEY root_key,
}
// This method tries to delete a registry value and logs an error message
-// in case of failure. It returns true if deletion is successful,
-// otherwise false.
+// in case of failure. It returns true if deletion is successful (or the key did
+// not exist), otherwise false.
bool InstallUtil::DeleteRegistryValue(HKEY reg_root,
const string16& key_path,
const string16& value_name) {
- RegKey key(reg_root, key_path.c_str(), KEY_ALL_ACCESS);
- VLOG(1) << "Deleting registry value " << value_name;
- if (key.HasValue(value_name.c_str())) {
- LONG result = key.DeleteValue(value_name.c_str());
- if (result != ERROR_SUCCESS) {
- LOG(ERROR) << "Failed to delete registry value: " << value_name
- << " error: " << result;
- return false;
- }
+ RegKey key;
+ LONG result = key.Open(reg_root, key_path.c_str(), KEY_SET_VALUE);
+ if (result == ERROR_SUCCESS)
+ result = key.DeleteValue(value_name.c_str());
+ if (result != ERROR_SUCCESS && result != ERROR_FILE_NOT_FOUND) {
+ LOG(ERROR) << "Failed to delete registry value: " << value_name
+ << " error: " << result;
+ return false;
}
return true;
}
« no previous file with comments | « chrome/installer/setup/uninstall.cc ('k') | chrome/installer/util/shell_util.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698