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

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

Issue 2382493002: Do not launch rename process directly from system-level Chrome. (Closed)
Patch Set: Created 4 years, 3 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 035ab2e5b80a0142b3d6dc506300414fed6665d0..a35d52a495fa7a448a38a8d327a0632e7c96b9d2 100644
--- a/chrome/browser/first_run/upgrade_util_win.cc
+++ b/chrome/browser/first_run/upgrade_util_win.cc
@@ -113,20 +113,18 @@ bool SwapNewChromeExeIfPresent() {
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;
+ // If this is a system-level install, ask Google Update to launch an elevated
+ // process to rename Chrome executables.
+ if (!InstallUtil::IsPerUserInstall(cur_chrome_exe))
+ return InvokeGoogleUpdateForRename();
- // Open up the registry key containing current version and rename information.
- HKEY reg_root = user_install ? HKEY_CURRENT_USER : HKEY_LOCAL_MACHINE;
- BrowserDistribution *dist = BrowserDistribution::GetDistribution();
+ // If this is a user-level install, directly launch a process to rename Chrome
+ // executables. Obtain the command to launch the process from the registry.
base::win::RegKey key;
- if (key.Open(reg_root, dist->GetVersionKey().c_str(),
+ if (key.Open(HKEY_CURRENT_USER,
+ BrowserDistribution::GetDistribution()->GetVersionKey().c_str(),
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,
&rename_cmd) == ERROR_SUCCESS) {
« 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