diff options
-rw-r--r-- | chrome/installer/setup/setup_main.cc | 20 | ||||
-rw-r--r-- | chrome/installer/util/browser_distribution.cc | 5 | ||||
-rw-r--r-- | chrome/installer/util/browser_distribution.h | 3 | ||||
-rw-r--r-- | chrome/installer/util/google_chrome_distribution.cc | 28 | ||||
-rw-r--r-- | chrome/installer/util/google_chrome_distribution.h | 3 | ||||
-rw-r--r-- | chrome/installer/util/google_chrome_distribution_dummy.cc | 5 |
6 files changed, 40 insertions, 24 deletions
diff --git a/chrome/installer/setup/setup_main.cc b/chrome/installer/setup/setup_main.cc index 0f0090d..f773614 100644 --- a/chrome/installer/setup/setup_main.cc +++ b/chrome/installer/setup/setup_main.cc @@ -644,10 +644,19 @@ installer::InstallStatus InstallProductsHelper( // // There is another way to reach this same function if this is a system // level install. See HandleNonInstallCmdLineOptions(). - for (size_t i = 0; i < products.size(); ++i) { - const Product* product = products[i]; - product->distribution()->LaunchUserExperiment(install_status, - *installer_version, *product, system_install); + { + // If installation failed, use the path to the currently running setup. + // If installation succeeded, use the path to setup in the installer dir. + FilePath setup_path(cmd_line.GetProgram()); + if (InstallUtil::GetInstallReturnCode(install_status) == 0) { + setup_path = installer_state.GetInstallerDirectory(*installer_version) + .Append(setup_path.BaseName()); + } + for (size_t i = 0; i < products.size(); ++i) { + const Product* product = products[i]; + product->distribution()->LaunchUserExperiment(setup_path, + install_status, *installer_version, *product, system_install); + } } } @@ -895,7 +904,8 @@ bool HandleNonInstallCmdLineOptions(const InstallationState& original_state, scoped_ptr<Version> installed_version( InstallUtil::GetChromeVersion(browser_dist, installer_state->system_install())); - browser_dist->LaunchUserExperiment(installer::REENTRY_SYS_UPDATE, + browser_dist->LaunchUserExperiment(cmd_line.GetProgram(), + installer::REENTRY_SYS_UPDATE, *installed_version, *product, true); } } else if (cmd_line.HasSwitch( diff --git a/chrome/installer/util/browser_distribution.cc b/chrome/installer/util/browser_distribution.cc index 251dd7e..95c0139 100644 --- a/chrome/installer/util/browser_distribution.cc +++ b/chrome/installer/util/browser_distribution.cc @@ -221,8 +221,9 @@ void BrowserDistribution::UpdateInstallStatus(bool system_install, } void BrowserDistribution::LaunchUserExperiment( - installer::InstallStatus status, const Version& version, - const installer::Product& installation, bool system_level) { + const FilePath& setup_path, installer::InstallStatus status, + const Version& version, const installer::Product& installation, + bool system_level) { } diff --git a/chrome/installer/util/browser_distribution.h b/chrome/installer/util/browser_distribution.h index 6c0df20..c20888b 100644 --- a/chrome/installer/util/browser_distribution.h +++ b/chrome/installer/util/browser_distribution.h @@ -98,7 +98,8 @@ class BrowserDistribution { // After an install or upgrade the user might qualify to participate in an // experiment. This function determines if the user qualifies and if so it // sets the wheels in motion or in simple cases does the experiment itself. - virtual void LaunchUserExperiment(installer::InstallStatus status, + virtual void LaunchUserExperiment(const FilePath& setup_path, + installer::InstallStatus status, const Version& version, const installer::Product& installation, bool system_level); diff --git a/chrome/installer/util/google_chrome_distribution.cc b/chrome/installer/util/google_chrome_distribution.cc index 9f41a03..a089735 100644 --- a/chrome/installer/util/google_chrome_distribution.cc +++ b/chrome/installer/util/google_chrome_distribution.cc @@ -130,13 +130,13 @@ int GetDirectoryWriteAgeInHours(const wchar_t* path) { return (now_time - dir_time); } -// Launches again this same process with switch --|flag|=|value|. +// Launches setup.exe (located at |setup_path|) with switch --|flag|=|value|. // If system_level_toast is true, appends --system-level-toast. // If handle to experiment result key was given at startup, re-add it. // Does not wait for the process to terminate. -bool RelaunchSetup(const std::string& flag, int value, - bool system_level_toast) { - CommandLine new_cmd_line(CommandLine::ForCurrentProcess()->GetProgram()); +bool LaunchSetup(const FilePath& setup_path, const std::string& flag, + int value, bool system_level_toast) { + CommandLine new_cmd_line(setup_path); new_cmd_line.AppendSwitchASCII(flag, base::IntToString(value)); // Re-add the system level toast flag. @@ -221,9 +221,9 @@ bool FixDACLsForExecute(const FilePath& exe) { // the computer is on but nobody has logged in locally. // Remote Desktop sessions do not count as interactive sessions; running this // method as a user logged in via remote desktop will do nothing. -bool RelaunchSetupAsConsoleUser(const std::string& flag) { - FilePath setup_exe = CommandLine::ForCurrentProcess()->GetProgram(); - CommandLine cmd_line(setup_exe); +bool LaunchSetupAsConsoleUser(const FilePath& setup_path, + const std::string& flag) { + CommandLine cmd_line(setup_path); cmd_line.AppendSwitch(flag); // Get the Google Update results key, and pass it on the command line to @@ -235,7 +235,7 @@ bool RelaunchSetupAsConsoleUser(const std::string& flag) { if (base::win::GetVersion() > base::win::VERSION_XP) { // Make sure that in Vista and Above we have the proper DACLs so // the interactive user can launch it. - if (!FixDACLsForExecute(setup_exe)) + if (!FixDACLsForExecute(setup_path)) NOTREACHED(); } @@ -557,12 +557,14 @@ void SetClient(std::wstring experiment_group, bool last_write) { // 3- It has been re-launched from the #2 case. In this case we enter // this function with |system_install| true and a REENTRY_SYS_UPDATE status. void GoogleChromeDistribution::LaunchUserExperiment( - installer::InstallStatus status, const Version& version, - const installer::Product& installation, bool system_level) { + const FilePath& setup_path, installer::InstallStatus status, + const Version& version, const installer::Product& installation, + bool system_level) { if (system_level) { if (installer::NEW_VERSION_UPDATED == status) { // We need to relaunch as the interactive user. - RelaunchSetupAsConsoleUser(installer::switches::kSystemLevelToast); + LaunchSetupAsConsoleUser(setup_path, + installer::switches::kSystemLevelToast); return; } } else { @@ -630,8 +632,8 @@ void GoogleChromeDistribution::LaunchUserExperiment( // because google_update expects the upgrade process to be quick and nimble. // System level: We have already been relaunched, so we don't need to be // quick, but we relaunch to follow the exact same codepath. - RelaunchSetup(installer::switches::kInactiveUserToast, flavor, - system_level); + LaunchSetup(setup_path, installer::switches::kInactiveUserToast, flavor, + system_level); } // User qualifies for the experiment. Launch chrome with --try-chrome=flavor. diff --git a/chrome/installer/util/google_chrome_distribution.h b/chrome/installer/util/google_chrome_distribution.h index ac4a3d1..3dc3b88 100644 --- a/chrome/installer/util/google_chrome_distribution.h +++ b/chrome/installer/util/google_chrome_distribution.h @@ -70,7 +70,8 @@ class GoogleChromeDistribution : public BrowserDistribution { installer::ArchiveType archive_type, installer::InstallStatus install_status); - virtual void LaunchUserExperiment(installer::InstallStatus status, + virtual void LaunchUserExperiment(const FilePath& setup_path, + installer::InstallStatus status, const Version& version, const installer::Product& installation, bool system_level); diff --git a/chrome/installer/util/google_chrome_distribution_dummy.cc b/chrome/installer/util/google_chrome_distribution_dummy.cc index 28340bd..cac5d1b 100644 --- a/chrome/installer/util/google_chrome_distribution_dummy.cc +++ b/chrome/installer/util/google_chrome_distribution_dummy.cc @@ -107,8 +107,9 @@ void GoogleChromeDistribution::UpdateInstallStatus(bool system_install, } void GoogleChromeDistribution::LaunchUserExperiment( - installer::InstallStatus status, const Version& version, - const installer::Product& installation, bool system_level) { + const FilePath& setup_path, installer::InstallStatus status, + const Version& version, const installer::Product& installation, + bool system_level) { NOTREACHED(); } |