diff options
author | tommi@chromium.org <tommi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-12-01 06:00:25 +0000 |
---|---|---|
committer | tommi@chromium.org <tommi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-12-01 06:00:25 +0000 |
commit | bf6117c7e9b66f3648af83c047a3428d66353451 (patch) | |
tree | 42d42291596c7b70ff1bdace230473277d5a1cd5 /chrome/browser/browser_main_win.cc | |
parent | 8a0989f01fff18edb0f56dcc06db2742eb6a1dcb (diff) | |
download | chromium_src-bf6117c7e9b66f3648af83c047a3428d66353451.zip chromium_src-bf6117c7e9b66f3648af83c047a3428d66353451.tar.gz chromium_src-bf6117c7e9b66f3648af83c047a3428d66353451.tar.bz2 |
Refactor the installer to support multi-install.
The installer now does its work based on distributions and target installation paths.
Each distribution has exactly one target installation path but each installation path can have more than one distribution.
In the absense of the --multi-install switch, the installer should continue to work as before.
The biggest difference here is that we don't rely on a single global distribution object that controls the entire installation flow and we have a few classes for the new abstractions instead of global functions.
It's far from perfect, but it's a step towards separating the core file package required for all distributions from the distributions themselves.
Additionally, there are tons of little changes here such as consistant usage of FilePath and CommandLine instead of mixing them with std::wstring.
TEST=Install, uninstall, upgrade, etc. Everything install related.
BUG=61609
Review URL: http://codereview.chromium.org/5172011
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@67818 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/browser_main_win.cc')
-rw-r--r-- | chrome/browser/browser_main_win.cc | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/chrome/browser/browser_main_win.cc b/chrome/browser/browser_main_win.cc index e4b52da..273a113 100644 --- a/chrome/browser/browser_main_win.cc +++ b/chrome/browser/browser_main_win.cc @@ -29,6 +29,7 @@ #include "chrome/common/env_vars.h" #include "chrome/common/main_function_params.h" #include "chrome/common/result_codes.h" +#include "chrome/installer/util/browser_distribution.h" #include "chrome/installer/util/helper.h" #include "chrome/installer/util/install_util.h" #include "chrome/installer/util/shell_util.h" @@ -99,9 +100,12 @@ int DoUninstallTasks(bool chrome_still_running) { VLOG(1) << "Failed to delete sentinel file."; // We want to remove user level shortcuts and we only care about the ones // created by us and not by the installer so |alternate| is false. - if (!ShellUtil::RemoveChromeDesktopShortcut(ShellUtil::CURRENT_USER, false)) + BrowserDistribution* dist = BrowserDistribution::GetDistribution(); + if (!ShellUtil::RemoveChromeDesktopShortcut(dist, ShellUtil::CURRENT_USER, + false)) VLOG(1) << "Failed to delete desktop shortcut."; - if (!ShellUtil::RemoveChromeQuickLaunchShortcut(ShellUtil::CURRENT_USER)) + if (!ShellUtil::RemoveChromeQuickLaunchShortcut(dist, + ShellUtil::CURRENT_USER)) VLOG(1) << "Failed to delete quick launch shortcut."; } return ret; @@ -176,22 +180,23 @@ int HandleIconsCommands(const CommandLine &parsed_command_line) { // allow the user level Chrome to run. So we notify the user and uninstall // user level Chrome. bool CheckMachineLevelInstall() { - scoped_ptr<installer::Version> version(InstallUtil::GetChromeVersion(true)); + // TODO(tommi): Check if using the default distribution is always the right + // thing to do. + BrowserDistribution* dist = BrowserDistribution::GetDistribution(); + scoped_ptr<installer::Version> version(InstallUtil::GetChromeVersion(dist, + true)); if (version.get()) { FilePath exe_path; PathService::Get(base::DIR_EXE, &exe_path); std::wstring exe = exe_path.value(); - std::transform(exe.begin(), exe.end(), exe.begin(), tolower); - std::wstring user_exe_path = installer::GetChromeInstallPath(false); - std::transform(user_exe_path.begin(), user_exe_path.end(), - user_exe_path.begin(), tolower); - if (exe == user_exe_path) { + FilePath user_exe_path(installer::GetChromeInstallPath(false, dist)); + if (FilePath::CompareEqualIgnoreCase(exe, user_exe_path.value())) { const std::wstring text = l10n_util::GetString(IDS_MACHINE_LEVEL_INSTALL_CONFLICT); const std::wstring caption = l10n_util::GetString(IDS_PRODUCT_NAME); const UINT flags = MB_OK | MB_ICONERROR | MB_TOPMOST; win_util::MessageBox(NULL, text, caption, flags); - FilePath uninstall_path(InstallUtil::GetChromeUninstallCmd(false)); + FilePath uninstall_path(InstallUtil::GetChromeUninstallCmd(false, dist)); CommandLine uninstall_cmd(uninstall_path); if (!uninstall_cmd.GetProgram().value().empty()) { uninstall_cmd.AppendSwitch(installer_util::switches::kForceUninstall); |