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

Unified Diff: chrome/browser/first_run/upgrade_util_win.cc

Issue 2283363005: Attempt the elevated path for the rename dance first for per-machine installs. (Closed)
Patch Set: Created 4 years, 4 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/first_run/upgrade_util_win.cc
diff --git a/chrome/browser/first_run/upgrade_util_win.cc b/chrome/browser/first_run/upgrade_util_win.cc
index 91b35e9e5b8be4be8b63ad240d5ed92b8cb89640..035ab2e5b80a0142b3d6dc506300414fed6665d0 100644
--- a/chrome/browser/first_run/upgrade_util_win.cc
+++ b/chrome/browser/first_run/upgrade_util_win.cc
@@ -108,22 +108,24 @@ bool IsUpdatePendingRestart() {
}
bool SwapNewChromeExeIfPresent() {
- base::FilePath new_chrome_exe;
- if (!GetNewerChromeFile(&new_chrome_exe))
- return false;
- if (!base::PathExists(new_chrome_exe))
+ if (!IsUpdatePendingRestart())
return false;
base::FilePath cur_chrome_exe;
if (!PathService::Get(base::FILE_EXE, &cur_chrome_exe))
return false;
+ bool user_install = InstallUtil::IsPerUserInstall(cur_chrome_exe);
+
+ // Ask Google Update to elevate and rename if the current process is in a
+ // per-machine install. Failing that, fall back to the direct approach.
+ if (!user_install && InvokeGoogleUpdateForRename())
+ return true;
// Open up the registry key containing current version and rename information.
- bool user_install = InstallUtil::IsPerUserInstall(cur_chrome_exe);
HKEY reg_root = user_install ? HKEY_CURRENT_USER : HKEY_LOCAL_MACHINE;
BrowserDistribution *dist = BrowserDistribution::GetDistribution();
base::win::RegKey key;
if (key.Open(reg_root, dist->GetVersionKey().c_str(),
- KEY_QUERY_VALUE) == ERROR_SUCCESS) {
+ KEY_QUERY_VALUE | KEY_WOW64_32KEY) == ERROR_SUCCESS) {
// First try to rename exe by launching rename command ourselves.
std::wstring rename_cmd;
if (key.ReadValue(google_update::kRegRenameCmdField,
@@ -141,8 +143,7 @@ bool SwapNewChromeExeIfPresent() {
}
}
- // Rename didn't work so try to rename by calling Google Update
- return InvokeGoogleUpdateForRename();
+ return false;
}
bool IsRunningOldChrome() {
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698