Index: chrome/installer/setup/setup_main.cc |
diff --git a/chrome/installer/setup/setup_main.cc b/chrome/installer/setup/setup_main.cc |
index 3e7415b3752d91c98c74560a2bde415a5d2d35cc..52e1b62b94fe9ec05f1705d3904eb220eed09193 100644 |
--- a/chrome/installer/setup/setup_main.cc |
+++ b/chrome/installer/setup/setup_main.cc |
@@ -45,6 +45,7 @@ |
#include "chrome/common/chrome_constants.h" |
#include "chrome/common/chrome_paths.h" |
#include "chrome/common/chrome_switches.h" |
+#include "chrome/install_static/install_details.h" |
#include "chrome/installer/setup/archive_patch_helper.h" |
#include "chrome/installer/setup/install.h" |
#include "chrome/installer/setup/install_worker.h" |
@@ -52,6 +53,7 @@ |
#include "chrome/installer/setup/installer_state.h" |
#include "chrome/installer/setup/persistent_histogram_storage.h" |
#include "chrome/installer/setup/setup_constants.h" |
+#include "chrome/installer/setup/setup_install_details.h" |
#include "chrome/installer/setup/setup_singleton.h" |
#include "chrome/installer/setup/setup_util.h" |
#include "chrome/installer/setup/uninstall.h" |
@@ -1340,6 +1342,8 @@ int WINAPI wWinMain(HINSTANCE instance, HINSTANCE prev_instance, |
const base::CommandLine& cmd_line = *base::CommandLine::ForCurrentProcess(); |
VLOG(1) << "Command Line: " << cmd_line.GetCommandLineString(); |
+ InitializeInstallDetails(cmd_line, prefs); |
+ |
bool system_install = false; |
prefs.GetBool(installer::master_preferences::kSystemLevel, &system_install); |
VLOG(1) << "system install is " << system_install; |
@@ -1386,17 +1390,20 @@ int WINAPI wWinMain(HINSTANCE instance, HINSTANCE prev_instance, |
return installer::OS_ERROR; |
} |
- // Some command line options don't work with SxS install/uninstall |
- if (InstallUtil::IsChromeSxSProcess()) { |
- if (system_install || |
- cmd_line.HasSwitch(installer::switches::kSelfDestruct) || |
- cmd_line.HasSwitch(installer::switches::kMakeChromeDefault) || |
- cmd_line.HasSwitch(installer::switches::kRegisterChromeBrowser) || |
- cmd_line.HasSwitch(installer::switches::kRemoveChromeRegistration) || |
- cmd_line.HasSwitch(installer::switches::kInactiveUserToast) || |
- cmd_line.HasSwitch(installer::switches::kSystemLevelToast)) { |
- return installer::SXS_OPTION_NOT_SUPPORTED; |
- } |
+ const install_static::InstallDetails& install_details = |
+ install_static::InstallDetails::Get(); |
+ // Make sure system_level is supported if requested. |
+ if (system_install && !install_details.supports_system_level()) |
+ return installer::SXS_OPTION_NOT_SUPPORTED; |
robertshield
2017/02/20 19:11:16
Question about returning SXS_OPTION_NOT_SUPPORTED
grt (UTC plus 2)
2017/02/21 13:21:16
No. Blocking system-level installs is specific to
robertshield
2017/02/21 14:28:20
Ok, sg. Consider adding a comment explaining the a
grt (UTC plus 2)
2017/02/21 14:39:09
Done.
|
+ // Some command line options don't work with secondary installs. |
+ if (!install_details.is_primary_mode() && |
+ (cmd_line.HasSwitch(installer::switches::kSelfDestruct) || |
+ cmd_line.HasSwitch(installer::switches::kMakeChromeDefault) || |
+ cmd_line.HasSwitch(installer::switches::kRegisterChromeBrowser) || |
+ cmd_line.HasSwitch(installer::switches::kRemoveChromeRegistration) || |
+ cmd_line.HasSwitch(installer::switches::kInactiveUserToast) || |
+ cmd_line.HasSwitch(installer::switches::kSystemLevelToast))) { |
+ return installer::SXS_OPTION_NOT_SUPPORTED; |
} |
// Some command line options are no longer supported and must error out. |