summaryrefslogtreecommitdiffstats
path: root/chrome/browser/chrome_browser_main_win.cc
diff options
context:
space:
mode:
authorgab@chromium.org <gab@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-01-05 01:16:08 +0000
committergab@chromium.org <gab@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-01-05 01:16:08 +0000
commit6d2bd3fc908eb0e5348cfd8eae6fc4c141ba9fb0 (patch)
tree84e85cc9de3b61a18b9ba7b2f50b705c2afe5261 /chrome/browser/chrome_browser_main_win.cc
parent6add02aaf5d93a32bec7e32e1b0ff527f1bb3d18 (diff)
downloadchromium_src-6d2bd3fc908eb0e5348cfd8eae6fc4c141ba9fb0.zip
chromium_src-6d2bd3fc908eb0e5348cfd8eae6fc4c141ba9fb0.tar.gz
chromium_src-6d2bd3fc908eb0e5348cfd8eae6fc4c141ba9fb0.tar.bz2
[Fixit-Dec-2012] Auto-launch system-level Chrome post user-level Chrome self-destruction.
Also changed self-destruct to launch setup.exe using ShellExecute instead of base::LaunchProcess to allow us to specify SEE_MASK_FLAG_LOG_USAGE to flip to the desktop as documented in "DevelopinganewexperienceDesktopBrowser". This only seems to work when ShellExecute is called from an immersive process and thus setup.exe must be launched with this flag (if it's not and setup later tries to ShellExecute the system-level Chrome with that flag, the desktop flip doesn't occur...). Also fixed InstallUtil::GetSentinelFilePath() which used to get DIR_EXE from the PathService to determine whether it was a user-level install and if so return DIR_EXE as the sentinel file path; this was wrong when called from setup.exe as DIR_EXE is not Application\ in that case, it's Application\<version>\Installer...! Thankfully this method was not used to set the sentinel (so that we don't have to keep checking for sentinel files in the wrong places); we could up until this CL however get constant false negatives when looking for sentinels with this method. This CL depends on https://codereview.chromium.org/11636031/. BUG=165048 TEST=Self-destruct with/without First Run having occured (prior to the system-level install) for the user-level Chrome; the self-destruct should occur and launch System-level Chrome with/without the First Run flow (i.e. with First Run only if the self-destructing Chrome itself hadn't undergone First Run already). On Win8, the above scenarios should work whether the user-level Chrome prefers Metro or not (if it does prefer Metro the immersive launch should flip back to the desktop for the self-destruct -- the self-destruct message dialog is still suppressed in that case however). Review URL: https://chromiumcodereview.appspot.com/11685006 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@175249 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/chrome_browser_main_win.cc')
-rw-r--r--chrome/browser/chrome_browser_main_win.cc19
1 files changed, 16 insertions, 3 deletions
diff --git a/chrome/browser/chrome_browser_main_win.cc b/chrome/browser/chrome_browser_main_win.cc
index b76a20a..69f9f0e 100644
--- a/chrome/browser/chrome_browser_main_win.cc
+++ b/chrome/browser/chrome_browser_main_win.cc
@@ -355,13 +355,26 @@ bool ChromeBrowserMainPartsWin::CheckMachineLevelInstall() {
CommandLine uninstall_cmd(
InstallUtil::GetChromeUninstallCmd(false, dist->GetType()));
if (!uninstall_cmd.GetProgram().empty()) {
+ uninstall_cmd.AppendSwitch(installer::switches::kSelfDestruct);
uninstall_cmd.AppendSwitch(installer::switches::kForceUninstall);
uninstall_cmd.AppendSwitch(
installer::switches::kDoNotRemoveSharedItems);
- base::LaunchOptions launch_options;
+
+ const FilePath setup_exe(uninstall_cmd.GetProgram());
+ const string16 params(uninstall_cmd.GetArgumentsString());
+
+ SHELLEXECUTEINFO sei = { sizeof(sei) };
+ sei.fMask = SEE_MASK_NOASYNC;
+ sei.nShow = SW_SHOWNORMAL;
+ sei.lpFile = setup_exe.value().c_str();
+ sei.lpParameters = params.c_str();
+ // On Windows 8 SEE_MASK_FLAG_LOG_USAGE is necessary to guarantee we
+ // flip to the Desktop when launching.
if (is_metro)
- launch_options.force_breakaway_from_job_ = true;
- base::LaunchProcess(uninstall_cmd, launch_options, NULL);
+ sei.fMask |= SEE_MASK_FLAG_LOG_USAGE;
+
+ if (!::ShellExecuteEx(&sei))
+ DPCHECK(false);
}
return true;
}