summaryrefslogtreecommitdiffstats
path: root/chrome/installer
diff options
context:
space:
mode:
authorgrt@chromium.org <grt@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-02-28 13:51:55 +0000
committergrt@chromium.org <grt@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-02-28 13:51:55 +0000
commit273073ec89349507ae18d1ecc0c99f0f86d54897 (patch)
treefb3ccc64003dc22ffc5e8cbc176c90d152ba3465 /chrome/installer
parent1835b9e20249b9c4840aa5710e3e8c72f592b62a (diff)
downloadchromium_src-273073ec89349507ae18d1ecc0c99f0f86d54897.zip
chromium_src-273073ec89349507ae18d1ecc0c99f0f86d54897.tar.gz
chromium_src-273073ec89349507ae18d1ecc0c99f0f86d54897.tar.bz2
Fix system-level toast for multi-install Chrome.
I believe this regressed in Chrome 9 (http://crrev.com/67818). $5 to whomever writes a test for this so it doesn't regress again. Highlights: * Don't DCHECK in setup_main when handling --system-level-toast * Rename AppendUninstallFlags to AppendProductFlags * Pass the product-specific flags to child invocations of setup.exe * Propagage --verbose-logging to child invocations of setup.exe BUG=114101 TEST=install system-level chrome (at HH:MM C:\some\path\mini_installer.exe --system-level --verbose-logging --multi-install --chrome), set brand="CHXX" in HKLM\SOFTWARE\Google\Update\ClientState\{8A69D345-D564-463c-AFF1-A69D9E530F96}, then update chrome (at HH:MM C:\some\newer\mini_installer.exe --system-level --verbose-logging --multi-install --chrome) and see that the toast appears. Also make sure it still works for user-level installs. Review URL: https://chromiumcodereview.appspot.com/9465039 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@123969 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/installer')
-rw-r--r--chrome/installer/setup/install_worker.cc4
-rw-r--r--chrome/installer/setup/setup_main.cc15
-rw-r--r--chrome/installer/util/browser_distribution.cc2
-rw-r--r--chrome/installer/util/browser_distribution.h2
-rw-r--r--chrome/installer/util/chrome_browser_operations.cc4
-rw-r--r--chrome/installer/util/chrome_browser_operations.h4
-rw-r--r--chrome/installer/util/chrome_browser_sxs_operations.cc6
-rw-r--r--chrome/installer/util/chrome_browser_sxs_operations.h4
-rw-r--r--chrome/installer/util/chrome_frame_operations.cc4
-rw-r--r--chrome/installer/util/chrome_frame_operations.h4
-rw-r--r--chrome/installer/util/google_chrome_distribution.cc37
-rw-r--r--chrome/installer/util/google_chrome_distribution.h4
-rw-r--r--chrome/installer/util/google_chrome_distribution_dummy.cc4
-rw-r--r--chrome/installer/util/product.cc6
-rw-r--r--chrome/installer/util/product.h6
-rw-r--r--chrome/installer/util/product_operations.h10
16 files changed, 74 insertions, 42 deletions
diff --git a/chrome/installer/setup/install_worker.cc b/chrome/installer/setup/install_worker.cc
index fc780e7..a7f3321 100644
--- a/chrome/installer/setup/install_worker.cc
+++ b/chrome/installer/setup/install_worker.cc
@@ -148,7 +148,7 @@ void AddUninstallShortcutWorkItems(const InstallerState& installer_state,
for (size_t i = 0; i < products.size(); ++i) {
const Product& p = *products[i];
if (!p.is_chrome() && !p.ShouldCreateUninstallEntry())
- p.AppendUninstallFlags(&uninstall_arguments);
+ p.AppendProductFlags(&uninstall_arguments);
}
}
@@ -1101,7 +1101,7 @@ void AppendUninstallCommandLineFlags(const InstallerState& installer_state,
uninstall_cmd->AppendSwitch(installer::switches::kUninstall);
// Append the product-specific uninstall flags.
- product.AppendUninstallFlags(uninstall_cmd);
+ product.AppendProductFlags(uninstall_cmd);
if (installer_state.is_msi()) {
uninstall_cmd->AppendSwitch(installer::switches::kMsi);
// See comment in uninstall.cc where we check for the kDeleteProfile switch.
diff --git a/chrome/installer/setup/setup_main.cc b/chrome/installer/setup/setup_main.cc
index cb4cf7d..4d0c845 100644
--- a/chrome/installer/setup/setup_main.cc
+++ b/chrome/installer/setup/setup_main.cc
@@ -1051,11 +1051,16 @@ bool HandleNonInstallCmdLineOptions(const InstallationState& original_state,
// We started as system-level and have been re-launched as user level
// to continue with the toast experiment.
scoped_ptr<Version> installed_version(
- InstallUtil::GetChromeVersion(browser_dist,
- installer_state->system_install()));
- browser_dist->LaunchUserExperiment(cmd_line.GetProgram(),
- installer::REENTRY_SYS_UPDATE,
- *installed_version, *product, true);
+ InstallUtil::GetChromeVersion(browser_dist, true));
+ if (!installed_version.get()) {
+ LOG(ERROR) << "No installation of "
+ << browser_dist->GetAppShortCutName()
+ << " found for system-level toast.";
+ } else {
+ browser_dist->LaunchUserExperiment(cmd_line.GetProgram(),
+ installer::REENTRY_SYS_UPDATE,
+ *installed_version, *product, true);
+ }
}
} else if (cmd_line.HasSwitch(
installer::switches::kChromeFrameReadyModeOptIn)) {
diff --git a/chrome/installer/util/browser_distribution.cc b/chrome/installer/util/browser_distribution.cc
index 88c5b7e..efca73d 100644
--- a/chrome/installer/util/browser_distribution.cc
+++ b/chrome/installer/util/browser_distribution.cc
@@ -237,7 +237,7 @@ bool BrowserDistribution::GetExperimentDetails(
void BrowserDistribution::LaunchUserExperiment(
const FilePath& setup_path, installer::InstallStatus status,
- const Version& version, const installer::Product& installation,
+ const Version& version, const installer::Product& product,
bool system_level) {
}
diff --git a/chrome/installer/util/browser_distribution.h b/chrome/installer/util/browser_distribution.h
index 5f1b7b3..81891b7 100644
--- a/chrome/installer/util/browser_distribution.h
+++ b/chrome/installer/util/browser_distribution.h
@@ -130,7 +130,7 @@ class BrowserDistribution {
virtual void LaunchUserExperiment(const FilePath& setup_path,
installer::InstallStatus status,
const Version& version,
- const installer::Product& installation,
+ const installer::Product& product,
bool system_level);
// The user has qualified for the inactive user toast experiment and this
diff --git a/chrome/installer/util/chrome_browser_operations.cc b/chrome/installer/util/chrome_browser_operations.cc
index ad9fccf..b1ae844 100644
--- a/chrome/installer/util/chrome_browser_operations.cc
+++ b/chrome/installer/util/chrome_browser_operations.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -50,7 +50,7 @@ void ChromeBrowserOperations::AddComDllList(
std::vector<FilePath>* com_dll_list) const {
}
-void ChromeBrowserOperations::AppendUninstallFlags(
+void ChromeBrowserOperations::AppendProductFlags(
const std::set<std::wstring>& options,
CommandLine* cmd_line) const {
DCHECK(cmd_line);
diff --git a/chrome/installer/util/chrome_browser_operations.h b/chrome/installer/util/chrome_browser_operations.h
index 692676a..53ebb04 100644
--- a/chrome/installer/util/chrome_browser_operations.h
+++ b/chrome/installer/util/chrome_browser_operations.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -34,7 +34,7 @@ class ChromeBrowserOperations : public ProductOperations {
const std::set<std::wstring>& options,
std::vector<FilePath>* com_dll_list) const OVERRIDE;
- virtual void AppendUninstallFlags(
+ virtual void AppendProductFlags(
const std::set<std::wstring>& options,
CommandLine* cmd_line) const OVERRIDE;
diff --git a/chrome/installer/util/chrome_browser_sxs_operations.cc b/chrome/installer/util/chrome_browser_sxs_operations.cc
index 4756da1..00aabf9 100644
--- a/chrome/installer/util/chrome_browser_sxs_operations.cc
+++ b/chrome/installer/util/chrome_browser_sxs_operations.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -10,13 +10,13 @@
namespace installer {
-void ChromeBrowserSxSOperations::AppendUninstallFlags(
+void ChromeBrowserSxSOperations::AppendProductFlags(
const std::set<std::wstring>& options,
CommandLine* cmd_line) const {
DCHECK(cmd_line);
cmd_line->AppendSwitch(switches::kChromeSxS);
- ChromeBrowserOperations::AppendUninstallFlags(options, cmd_line);
+ ChromeBrowserOperations::AppendProductFlags(options, cmd_line);
}
void ChromeBrowserSxSOperations::AppendRenameFlags(
diff --git a/chrome/installer/util/chrome_browser_sxs_operations.h b/chrome/installer/util/chrome_browser_sxs_operations.h
index fd61a6f..ad3ccc0 100644
--- a/chrome/installer/util/chrome_browser_sxs_operations.h
+++ b/chrome/installer/util/chrome_browser_sxs_operations.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -20,7 +20,7 @@ class ChromeBrowserSxSOperations : public ChromeBrowserOperations {
public:
ChromeBrowserSxSOperations() {}
- virtual void AppendUninstallFlags(
+ virtual void AppendProductFlags(
const std::set<std::wstring>& options,
CommandLine* cmd_line) const OVERRIDE;
diff --git a/chrome/installer/util/chrome_frame_operations.cc b/chrome/installer/util/chrome_frame_operations.cc
index 7dbd316..a1a46ee 100644
--- a/chrome/installer/util/chrome_frame_operations.cc
+++ b/chrome/installer/util/chrome_frame_operations.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -90,7 +90,7 @@ void ChromeFrameOperations::AddComDllList(
com_dll_list->push_back(FilePath(installer::kChromeFrameDll));
}
-void ChromeFrameOperations::AppendUninstallFlags(
+void ChromeFrameOperations::AppendProductFlags(
const std::set<std::wstring>& options,
CommandLine* cmd_line) const {
DCHECK(cmd_line);
diff --git a/chrome/installer/util/chrome_frame_operations.h b/chrome/installer/util/chrome_frame_operations.h
index 4a0fd82..85a314f 100644
--- a/chrome/installer/util/chrome_frame_operations.h
+++ b/chrome/installer/util/chrome_frame_operations.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -35,7 +35,7 @@ class ChromeFrameOperations : public ProductOperations {
const std::set<std::wstring>& options,
std::vector<FilePath>* com_dll_list) const OVERRIDE;
- virtual void AppendUninstallFlags(
+ virtual void AppendProductFlags(
const std::set<std::wstring>& options,
CommandLine* cmd_line) const OVERRIDE;
diff --git a/chrome/installer/util/google_chrome_distribution.cc b/chrome/installer/util/google_chrome_distribution.cc
index 251cb15..fa84138 100644
--- a/chrome/installer/util/google_chrome_distribution.cc
+++ b/chrome/installer/util/google_chrome_distribution.cc
@@ -128,16 +128,27 @@ int GetDirectoryWriteAgeInHours(const wchar_t* path) {
// 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 LaunchSetup(CommandLine cmd_line, bool system_level_toast) {
+bool LaunchSetup(CommandLine cmd_line,
+ const installer::Product& product,
+ bool system_level_toast) {
+ const CommandLine& current_cmd_line = *CommandLine::ForCurrentProcess();
+
+ // Propagate --verbose-logging to the invoked setup.exe.
+ if (current_cmd_line.HasSwitch(installer::switches::kVerboseLogging))
+ cmd_line.AppendSwitch(installer::switches::kVerboseLogging);
+
+ // Pass along product-specific options.
+ product.AppendProductFlags(&cmd_line);
+
// Re-add the system level toast flag.
if (system_level_toast) {
+ cmd_line.AppendSwitch(installer::switches::kSystemLevel);
cmd_line.AppendSwitch(installer::switches::kSystemLevelToast);
// Re-add the toast result key. We need to do this because Setup running as
// system passes the key to Setup running as user, but that child process
// does not perform the actual toasting, it launches another Setup (as user)
// to do so. That is the process that needs the key.
- const CommandLine& current_cmd_line = *CommandLine::ForCurrentProcess();
std::string key(installer::switches::kToastResultsKey);
std::string toast_key = current_cmd_line.GetSwitchValueASCII(key);
if (!toast_key.empty()) {
@@ -212,10 +223,24 @@ bool FixDACLsForExecute(const FilePath& exe) {
// Remote Desktop sessions do not count as interactive sessions; running this
// method as a user logged in via remote desktop will do nothing.
bool LaunchSetupAsConsoleUser(const FilePath& setup_path,
+ const installer::Product& product,
const std::string& flag) {
CommandLine cmd_line(setup_path);
cmd_line.AppendSwitch(flag);
+ // Pass along product-specific options.
+ product.AppendProductFlags(&cmd_line);
+
+ // Convey to the invoked setup.exe that it's operating on a system-level
+ // installation.
+ cmd_line.AppendSwitch(installer::switches::kSystemLevel);
+
+ // Propagate --verbose-logging to the invoked setup.exe.
+ if (CommandLine::ForCurrentProcess()->HasSwitch(
+ installer::switches::kVerboseLogging)) {
+ cmd_line.AppendSwitch(installer::switches::kVerboseLogging);
+ }
+
// Get the Google Update results key, and pass it on the command line to
// the child process.
int key = GoogleUpdateSettings::DuplicateGoogleUpdateSystemClientKey();
@@ -680,12 +705,12 @@ bool GoogleChromeDistribution::GetExperimentDetails(
// this function with |system_install| true and a REENTRY_SYS_UPDATE status.
void GoogleChromeDistribution::LaunchUserExperiment(
const FilePath& setup_path, installer::InstallStatus status,
- const Version& version, const installer::Product& installation,
+ const Version& version, const installer::Product& product,
bool system_level) {
if (system_level) {
if (installer::NEW_VERSION_UPDATED == status) {
// We need to relaunch as the interactive user.
- LaunchSetupAsConsoleUser(setup_path,
+ LaunchSetupAsConsoleUser(setup_path, product,
installer::switches::kSystemLevelToast);
return;
}
@@ -714,7 +739,7 @@ void GoogleChromeDistribution::LaunchUserExperiment(
} else {
// Check browser usage inactivity by the age of the last-write time of the
// chrome user data directory.
- FilePath user_data_dir(installation.GetUserDataPath());
+ FilePath user_data_dir(product.GetUserDataPath());
const bool toast_experiment_enabled = false;
const int kThirtyDays = 30 * 24;
@@ -758,7 +783,7 @@ void GoogleChromeDistribution::LaunchUserExperiment(
base::IntToString(flavor));
cmd_line.AppendSwitchASCII(installer::switches::kExperimentGroup,
WideToASCII(base_group));
- LaunchSetup(cmd_line, system_level);
+ LaunchSetup(cmd_line, product, system_level);
}
// User qualifies for the experiment. To test, use --try-chrome-again=|flavor|
diff --git a/chrome/installer/util/google_chrome_distribution.h b/chrome/installer/util/google_chrome_distribution.h
index afb22e7..f895382 100644
--- a/chrome/installer/util/google_chrome_distribution.h
+++ b/chrome/installer/util/google_chrome_distribution.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
@@ -84,7 +84,7 @@ class GoogleChromeDistribution : public BrowserDistribution {
const FilePath& setup_path,
installer::InstallStatus status,
const Version& version,
- const installer::Product& installation,
+ const installer::Product& product,
bool system_level) OVERRIDE;
// Assuming that the user qualifies, this function performs the inactive user
diff --git a/chrome/installer/util/google_chrome_distribution_dummy.cc b/chrome/installer/util/google_chrome_distribution_dummy.cc
index b2b83a5..5a3f293 100644
--- a/chrome/installer/util/google_chrome_distribution_dummy.cc
+++ b/chrome/installer/util/google_chrome_distribution_dummy.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
@@ -120,7 +120,7 @@ bool GoogleChromeDistribution::GetExperimentDetails(
void GoogleChromeDistribution::LaunchUserExperiment(
const FilePath& setup_path, installer::InstallStatus status,
- const Version& version, const installer::Product& installation,
+ const Version& version, const installer::Product& product,
bool system_level) {
NOTREACHED();
}
diff --git a/chrome/installer/util/product.cc b/chrome/installer/util/product.cc
index 63299f1..f2ab2a7 100644
--- a/chrome/installer/util/product.cc
+++ b/chrome/installer/util/product.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -136,8 +136,8 @@ void Product::AddComDllList(std::vector<FilePath>* com_dll_list) const {
operations_->AddComDllList(options_, com_dll_list);
}
-void Product::AppendUninstallFlags(CommandLine* command_line) const {
- operations_->AppendUninstallFlags(options_, command_line);
+void Product::AppendProductFlags(CommandLine* command_line) const {
+ operations_->AppendProductFlags(options_, command_line);
}
void Product::AppendRenameFlags(CommandLine* command_line) const {
diff --git a/chrome/installer/util/product.h b/chrome/installer/util/product.h
index 194e07a..0f1a019 100644
--- a/chrome/installer/util/product.h
+++ b/chrome/installer/util/product.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -103,8 +103,8 @@ class Product {
// See ProductOperations::AddComDllList.
void AddComDllList(std::vector<FilePath>* com_dll_list) const;
- // See ProductOperations::AppendUninstallFlags.
- void AppendUninstallFlags(CommandLine* command_line) const;
+ // See ProductOperations::AppendProductFlags.
+ void AppendProductFlags(CommandLine* command_line) const;
// See ProductOperations::AppendRenameFlags.
void AppendRenameFlags(CommandLine* command_line) const;
diff --git a/chrome/installer/util/product_operations.h b/chrome/installer/util/product_operations.h
index d42ade8..8108012 100644
--- a/chrome/installer/util/product_operations.h
+++ b/chrome/installer/util/product_operations.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -51,9 +51,11 @@ class ProductOperations {
virtual void AddComDllList(const std::set<std::wstring>& options,
std::vector<FilePath>* com_dll_list) const = 0;
- // Given a command line, appends the set of product-specific uninstall flags.
- virtual void AppendUninstallFlags(const std::set<std::wstring>& options,
- CommandLine* cmd_line) const = 0;
+ // Given a command line, appends the set of product-specific flags. These are
+ // required for product-specific uninstall commands, but are of use for any
+ // invocation of setup.exe for the product.
+ virtual void AppendProductFlags(const std::set<std::wstring>& options,
+ CommandLine* cmd_line) const = 0;
// Given a command line, appends the set of product-specific rename flags.
virtual void AppendRenameFlags(const std::set<std::wstring>& options,