From 140842a9b3410cba8b48a3f933b2d9779f413cd5 Mon Sep 17 00:00:00 2001 From: "kuchhal@chromium.org" Date: Thu, 15 Jan 2009 00:51:16 +0000 Subject: Write installer success result to the registry even for user level installs. BUG=1549439 Review URL: http://codereview.chromium.org/18249 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@8056 0039d316-1c4b-4281-b951-d872f2087c98 --- chrome/installer/setup/main.cc | 32 ++++++++++++++++++++------------ chrome/installer/setup/setup.cc | 6 ------ 2 files changed, 20 insertions(+), 18 deletions(-) (limited to 'chrome/installer') diff --git a/chrome/installer/setup/main.cc b/chrome/installer/setup/main.cc index 5307c1c..e888f0b 100755 --- a/chrome/installer/setup/main.cc +++ b/chrome/installer/setup/main.cc @@ -369,23 +369,31 @@ installer_util::InstallStatus InstallChrome(const CommandLine& cmd_line, install_status = installer::InstallOrUpdateChrome( cmd_line.program(), archive_to_copy, temp_path, options, *installer_version, installed_version); + + int install_msg_base = IDS_INSTALL_FAILED_BASE; + std::wstring chrome_exe; + if (install_status != installer_util::INSTALL_FAILED) { + chrome_exe = installer::GetChromeInstallPath(system_install); + if (chrome_exe.empty()) { + // If we failed to construct install path, it means the OS call to + // get %ProgramFiles% or %AppData% failed. Report this as failure. + install_msg_base = IDS_INSTALL_OS_ERROR_BASE; + install_status = installer_util::OS_ERROR; + } else { + file_util::AppendToPath(&chrome_exe, installer_util::kChromeExe); + chrome_exe = L"\"" + chrome_exe + L"\""; + install_msg_base = 0; + } + } + InstallUtil::WriteInstallerResult(system_install, install_status, + install_msg_base, &chrome_exe); if (install_status == installer_util::FIRST_INSTALL_SUCCESS) { LOG(INFO) << "First install successful."; CopyPreferenceFileForFirstRun(options, cmd_line); // We never want to launch Chrome in system level install mode. - if ((options & installer_util::DO_NOT_LAUNCH_CHROME) || - (options & installer_util::SYSTEM_LEVEL)) { - std::wstring chrome_exe = - installer::GetChromeInstallPath(system_install); - if (!chrome_exe.empty()) { - file_util::AppendToPath(&chrome_exe, installer_util::kChromeExe); - chrome_exe = L"\"" + chrome_exe + L"\""; - InstallUtil::WriteInstallerResult(system_install, install_status, - 0, &chrome_exe); - } - } else { + if (!(options & installer_util::DO_NOT_LAUNCH_CHROME) && + !(options & installer_util::SYSTEM_LEVEL)) installer::LaunchChrome(system_install); - } } else if (install_status == installer_util::NEW_VERSION_UPDATED) { // This is temporary hack and will be deleted after one release. UpdateChromeOpenCmd(system_install); diff --git a/chrome/installer/setup/setup.cc b/chrome/installer/setup/setup.cc index b5d0ea8..27475242 100755 --- a/chrome/installer/setup/setup.cc +++ b/chrome/installer/setup/setup.cc @@ -198,9 +198,6 @@ installer_util::InstallStatus installer::InstallOrUpdateChrome( std::wstring install_path(GetChromeInstallPath(system_install)); if (install_path.empty()) { LOG(ERROR) << "Could not get installation destination path."; - InstallUtil::WriteInstallerResult(system_install, - installer_util::INSTALL_FAILED, - IDS_INSTALL_FAILED_BASE, NULL); return installer_util::INSTALL_FAILED; } else { LOG(INFO) << "install destination path: " << install_path; @@ -217,9 +214,6 @@ installer_util::InstallStatus installer::InstallOrUpdateChrome( installer_util::InstallStatus result; if (!install_success) { LOG(ERROR) << "Install failed."; - InstallUtil::WriteInstallerResult(system_install, - installer_util::INSTALL_FAILED, - IDS_INSTALL_FAILED_BASE, NULL); result = installer_util::INSTALL_FAILED; } else { if (!installed_version) { -- cgit v1.1