diff options
author | huanr@chromium.org <huanr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-02-24 03:53:00 +0000 |
---|---|---|
committer | huanr@chromium.org <huanr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-02-24 03:53:00 +0000 |
commit | abd4dc785c3b59eabedcbd51d6c518e8273b6a26 (patch) | |
tree | da8914053a9b48b7f31851c519339d23e66c3a0a /chrome/installer/setup | |
parent | cc37a23a18d3cdaf1aa922708d1dbb9d02d1dfee (diff) | |
download | chromium_src-abd4dc785c3b59eabedcbd51d6c518e8273b6a26.zip chromium_src-abd4dc785c3b59eabedcbd51d6c518e8273b6a26.tar.gz chromium_src-abd4dc785c3b59eabedcbd51d6c518e8273b6a26.tar.bz2 |
Disabling options that sxs channel does not support.
BUG=35574
TEST=Run setup with those options and "--chrome-sxs".
Review URL: http://codereview.chromium.org/652197
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@39861 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/installer/setup')
-rw-r--r-- | chrome/installer/setup/setup_main.cc | 50 |
1 files changed, 44 insertions, 6 deletions
diff --git a/chrome/installer/setup/setup_main.cc b/chrome/installer/setup/setup_main.cc index 45642e4..e6db065 100644 --- a/chrome/installer/setup/setup_main.cc +++ b/chrome/installer/setup/setup_main.cc @@ -538,6 +538,29 @@ bool ShowRebootDialog() { return true; } +// Class to manage COM initialization and uninitialization +class AutoCom { + public: + AutoCom() : initialized_(false) { } + ~AutoCom() { + if (initialized_) CoUninitialize(); + } + bool Init(bool system_install) { + if (CoInitializeEx(NULL, COINIT_APARTMENTTHREADED) != S_OK) { + LOG(ERROR) << "COM initialization failed."; + InstallUtil::WriteInstallerResult(system_install, + installer_util::OS_ERROR, + IDS_INSTALL_OS_ERROR_BASE, NULL); + return false; + } + initialized_ = true; + return true; + } + + private: + bool initialized_; +}; + } // namespace int WINAPI wWinMain(HINSTANCE instance, HINSTANCE prev_instance, @@ -571,11 +594,8 @@ int WINAPI wWinMain(HINSTANCE instance, HINSTANCE prev_instance, } // Initialize COM for use later. - if (CoInitializeEx(NULL, COINIT_APARTMENTTHREADED) != S_OK) { - LOG(ERROR) << "COM initialization failed."; - InstallUtil::WriteInstallerResult(system_install, - installer_util::OS_ERROR, - IDS_INSTALL_OS_ERROR_BASE, NULL); + AutoCom auto_com; + if (!auto_com.Init(system_install)) { return installer_util::OS_ERROR; } @@ -584,6 +604,25 @@ int WINAPI wWinMain(HINSTANCE instance, HINSTANCE prev_instance, exit_code)) return exit_code; + // Some command line options don't work with SxS install/uninstall + if (InstallUtil::IsChromeSxSProcess()) { + if (system_install || + parsed_command_line.HasSwitch( + installer_util::switches::kForceUninstall) || + parsed_command_line.HasSwitch( + installer_util::switches::kMakeChromeDefault) || + parsed_command_line.HasSwitch( + installer_util::switches::kRegisterChromeBrowser) || + parsed_command_line.HasSwitch( + installer_util::switches::kRemoveChromeRegistration) || + parsed_command_line.HasSwitch( + installer_util::switches::kInactiveUserToast) || + parsed_command_line.HasSwitch( + installer_util::switches::kSystemLevelToast)) { + return installer_util::SXS_OPTION_NOT_SUPPORTED; + } + } + if (system_install && !IsUserAnAdmin()) { if (win_util::GetWinVersion() >= win_util::WINVERSION_VISTA && !parsed_command_line.HasSwitch(installer_util::switches::kRunAsAdmin)) { @@ -644,7 +683,6 @@ int WINAPI wWinMain(HINSTANCE instance, HINSTANCE prev_instance, } } - CoUninitialize(); // Note that we allow the status installer_util::UNINSTALL_REQUIRES_REBOOT // to pass through, since this is only returned on uninstall which is never // invoked directly by Google Update. |