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

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

Issue 6288009: More installer refactoring in the interest of fixing some bugs and cleaning t... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years, 11 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 | chrome/chrome_installer.gypi » ('j') | chrome/installer/setup/chrome_frame_ready_mode.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/first_run/first_run_win.cc
===================================================================
--- chrome/browser/first_run/first_run_win.cc (revision 71802)
+++ chrome/browser/first_run/first_run_win.cc (working copy)
@@ -23,7 +23,6 @@
#include "base/string_split.h"
#include "base/utf_string_conversions.h"
#include "base/win/object_watcher.h"
-#include "base/win/registry.h"
#include "base/win/windows_version.h"
#include "chrome/browser/extensions/extension_service.h"
#include "chrome/browser/extensions/extension_updater.h"
@@ -40,7 +39,9 @@
#include "chrome/installer/util/browser_distribution.h"
#include "chrome/installer/util/google_update_constants.h"
#include "chrome/installer/util/google_update_settings.h"
+#include "chrome/installer/util/helper.h"
#include "chrome/installer/util/install_util.h"
+#include "chrome/installer/util/installation_state.h"
#include "chrome/installer/util/shell_util.h"
#include "chrome/installer/util/util_constants.h"
#include "google_update_idl.h"
@@ -68,13 +69,12 @@
return true;
}
-bool InvokeGoogleUpdateForRename() {
+bool InvokeGoogleUpdateForRename(const std::wstring& app_guid) {
ScopedComPtr<IProcessLauncher> ipl;
if (!FAILED(ipl.CreateInstance(__uuidof(ProcessLauncherClass)))) {
ULONG_PTR phandle = NULL;
DWORD id = GetCurrentProcessId();
- BrowserDistribution* dist = BrowserDistribution::GetDistribution();
- if (!FAILED(ipl->LaunchCmdElevated(dist->GetAppGuid().c_str(),
+ if (!FAILED(ipl->LaunchCmdElevated(app_guid.c_str(),
google_update::kRegRenameCmdField,
id, &phandle))) {
HANDLE handle = HANDLE(phandle);
@@ -267,21 +267,10 @@
return false;
if (!file_util::PathExists(new_chrome_exe))
return false;
- FilePath cur_chrome_exe;
- if (!PathService::Get(base::FILE_EXE, &cur_chrome_exe))
- return false;
+ std::wstring app_guid;
+ std::wstring rename_cmd = installer::GetRenameCommand(&app_guid);
tommi (sloooow) - chröme 2011/01/21 21:45:17 general style nit: We prefer std::string foo(Bar()
- // First try to rename exe by launching rename command ourselves.
- bool user_install =
- InstallUtil::IsPerUserInstall(cur_chrome_exe.value().c_str());
- HKEY reg_root = user_install ? HKEY_CURRENT_USER : HKEY_LOCAL_MACHINE;
- BrowserDistribution *dist = BrowserDistribution::GetDistribution();
- base::win::RegKey key;
- std::wstring rename_cmd;
- if ((key.Open(reg_root, dist->GetVersionKey().c_str(),
- KEY_READ) == ERROR_SUCCESS) &&
- (key.ReadValue(google_update::kRegRenameCmdField,
- &rename_cmd) == ERROR_SUCCESS)) {
+ if (!rename_cmd.empty()) {
base::ProcessHandle handle;
if (base::LaunchApp(rename_cmd, true, true, &handle)) {
DWORD exit_code;
@@ -290,10 +279,12 @@
if (exit_code == installer::RENAME_SUCCESSFUL)
return true;
}
+ } else {
+ NOTREACHED() << "Empty command string found to rename new chrome.";
}
// Rename didn't work so try to rename by calling Google Update
- return InvokeGoogleUpdateForRename();
+ return InvokeGoogleUpdateForRename(app_guid);
}
// static
« no previous file with comments | « no previous file | chrome/chrome_installer.gypi » ('j') | chrome/installer/setup/chrome_frame_ready_mode.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698