summaryrefslogtreecommitdiffstats
path: root/chrome/installer
diff options
context:
space:
mode:
authorgab@chromium.org <gab@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-11-21 18:36:56 +0000
committergab@chromium.org <gab@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-11-21 18:36:56 +0000
commitcad885474f005f5c59c9ce7ee196fee3ffd63789 (patch)
treeb8952c1f2e6abcac78f8963007d7801afe095797 /chrome/installer
parent1c7ad57056be169ed75bee91e82d7ba4442fcb4f (diff)
downloadchromium_src-cad885474f005f5c59c9ce7ee196fee3ffd63789.zip
chromium_src-cad885474f005f5c59c9ce7ee196fee3ffd63789.tar.gz
chromium_src-cad885474f005f5c59c9ce7ee196fee3ffd63789.tar.bz2
Launch system-level Active Setup immediately following self-destruction of a user-level Chrome.
1st attempt at https://codereview.chromium.org/11359219/ was reverted (see comments post commit on that CL). TBR=thakis BUG=158524 TEST=Install user-level Chrome on user A, install system-level Chrome on user B (while A is still logged in), go back to user A and run Chrome, user-level Chrome self-destructs and new shortcuts are installed pointing to system-level Chrome. Try with: user A's chrome never ran, user A's Chrome ran and is set to prefer desktop chrome, user A's Chrome ran and is set to prefer Metro mode. Review URL: https://chromiumcodereview.appspot.com/11420045 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@169079 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/installer')
-rw-r--r--chrome/installer/setup/uninstall.cc8
-rw-r--r--chrome/installer/util/install_util.cc16
-rw-r--r--chrome/installer/util/install_util.h6
3 files changed, 17 insertions, 13 deletions
diff --git a/chrome/installer/setup/uninstall.cc b/chrome/installer/setup/uninstall.cc
index a8459b99b..a696b7a 100644
--- a/chrome/installer/setup/uninstall.cc
+++ b/chrome/installer/setup/uninstall.cc
@@ -1270,6 +1270,14 @@ InstallStatus UninstallProduct(const InstallationState& original_state,
if (!backup_state_file.empty())
file_util::Delete(backup_state_file, false);
+ // If user-level Chrome is being uninstalled and system-level Chrome is
+ // present, launch the system-level Active Setup command to do post-install
+ // tasks for this user (i.e., create shortcuts).
+ if (product.is_chrome() && !installer_state.system_install() &&
+ original_state.GetProductState(true, browser_dist->GetType())) {
+ InstallUtil::TriggerActiveSetupCommand();
+ }
+
return ret;
}
diff --git a/chrome/installer/util/install_util.cc b/chrome/installer/util/install_util.cc
index db710d4..d98a30b 100644
--- a/chrome/installer/util/install_util.cc
+++ b/chrome/installer/util/install_util.cc
@@ -23,6 +23,7 @@
#include "base/sys_info.h"
#include "base/values.h"
#include "base/version.h"
+#include "base/win/metro.h"
#include "base/win/registry.h"
#include "base/win/windows_version.h"
#include "chrome/installer/util/browser_distribution.h"
@@ -126,14 +127,7 @@ string16 InstallUtil::GetActiveSetupPath(BrowserDistribution* dist) {
return kInstalledComponentsPath + dist->GetAppGuid();
}
-void InstallUtil::TriggerActiveSetupCommandIfNeeded() {
- FilePath chrome_exe;
- if (!PathService::Get(base::FILE_EXE, &chrome_exe)) {
- NOTREACHED();
- } else if (InstallUtil::IsPerUserInstall(chrome_exe.value().c_str())) {
- return;
- }
-
+void InstallUtil::TriggerActiveSetupCommand() {
string16 active_setup_reg(
GetActiveSetupPath(BrowserDistribution::GetDistribution()));
base::win::RegKey active_setup_key(
@@ -152,8 +146,10 @@ void InstallUtil::TriggerActiveSetupCommandIfNeeded() {
// and the time setup.exe checks for it.
cmd.AppendSwitch(installer::switches::kForceConfigureUserSettings);
- base::LaunchOptions default_options;
- if (!base::LaunchProcess(cmd.GetCommandLineString(), default_options, NULL))
+ base::LaunchOptions launch_options;
+ if (base::win::IsMetroProcess())
+ launch_options.force_breakaway_from_job_ = true;
+ if (!base::LaunchProcess(cmd.GetCommandLineString(), launch_options, NULL))
PLOG(ERROR) << cmd.GetCommandLineString();
}
diff --git a/chrome/installer/util/install_util.h b/chrome/installer/util/install_util.h
index a258815..c7c4495 100644
--- a/chrome/installer/util/install_util.h
+++ b/chrome/installer/util/install_util.h
@@ -32,9 +32,9 @@ class InstallUtil {
// e.g. Software\Microsoft\Active Setup\Installed Components\<dist_guid>
static string16 GetActiveSetupPath(BrowserDistribution* dist);
- // Attempts to trigger the command that would be triggered for Chrome on
- // Active Setup. This will be a no-op for user-level installs.
- static void TriggerActiveSetupCommandIfNeeded();
+ // Attempts to trigger the command that would be run by Active Setup for a
+ // system-level Chrome. For use only when system-level Chrome is installed.
+ static void TriggerActiveSetupCommand();
// Launches given exe as admin on Vista.
static bool ExecuteExeAsAdmin(const CommandLine& cmd, DWORD* exit_code);