summaryrefslogtreecommitdiffstats
path: root/chrome/installer/setup/main.cc
diff options
context:
space:
mode:
Diffstat (limited to 'chrome/installer/setup/main.cc')
-rwxr-xr-xchrome/installer/setup/main.cc44
1 files changed, 31 insertions, 13 deletions
diff --git a/chrome/installer/setup/main.cc b/chrome/installer/setup/main.cc
index 8f57e06..925d49a 100755
--- a/chrome/installer/setup/main.cc
+++ b/chrome/installer/setup/main.cc
@@ -23,6 +23,7 @@
#include "chrome/installer/util/helper.h"
#include "chrome/installer/util/html_dialog.h"
#include "chrome/installer/util/install_util.h"
+#include "chrome/installer/util/l10n_string_util.h"
#include "chrome/installer/util/logging_installer.h"
#include "chrome/installer/util/lzma_util.h"
#include "chrome/installer/util/google_update_constants.h"
@@ -226,6 +227,10 @@ int GetInstallOptions(const CommandLine& cmd_line) {
if ((preferences & installer_util::MASTER_PROFILE_ERROR) == 0)
options |= installer_util::MASTER_PROFILE_VALID;
}
+ // While there is a --show-eula command line flag, we don't process
+ // it in this function because it requires special handling.
+ if (preferences & installer_util::MASTER_PROFILE_REQUIRE_EULA)
+ options |= installer_util::MASTER_PROFILE_REQUIRE_EULA;
}
if (preferences & installer_util::MASTER_PROFILE_CREATE_ALL_SHORTCUTS ||
@@ -247,7 +252,7 @@ int GetInstallOptions(const CommandLine& cmd_line) {
if (preferences & installer_util::MASTER_PROFILE_VERBOSE_LOGGING ||
cmd_line.HasSwitch(installer_util::switches::kVerboseLogging))
options |= installer_util::VERBOSE_LOGGING;
-
+
return options;
}
@@ -439,16 +444,19 @@ installer_util::InstallStatus UninstallChrome(const CommandLine& cmd_line,
*version, remove_all, force);
}
-// This function is temporary and meant to live while we get our eula dialogs
-// looking sharp. If the cmd line has --eula-test=path then the eula dialog
-// will be shown and no matter what the selection is the installer will exit.
-bool HandleEULADialog(const CommandLine& cmdline) {
- std:: wstring eula_path(cmdline.GetSwitchValue(L"eula-test"));
- if (eula_path.empty())
- return true;
+bool ShowEULADialog() {
+ LOG(INFO) << "About to show EULA";
+ std::wstring eula_path = installer_util::GetLocalizedEulaResource();
+ if (eula_path.empty()) {
+ LOG(ERROR) << "No EULA path available";
+ return false;
+ }
installer::EulaHTMLDialog dlg(eula_path);
- dlg.ShowModal();
- return false;
+ if (!dlg.ShowModal()) {
+ LOG(ERROR) << "EULA rejected or EULA failure";
+ return false;
+ }
+ return true;
}
} // namespace
@@ -467,9 +475,6 @@ int WINAPI wWinMain(HINSTANCE instance, HINSTANCE prev_instance,
bool system_install = (options & installer_util::SYSTEM_LEVEL) != 0;
LOG(INFO) << "system install is " << system_install;
- if (!HandleEULADialog(parsed_command_line))
- return 0;
-
// Check to make sure current system is WinXP or later. If not, log
// error message and get out.
if (!InstallUtil::IsOSSupported()) {
@@ -489,6 +494,19 @@ int WINAPI wWinMain(HINSTANCE instance, HINSTANCE prev_instance,
return installer_util::OS_ERROR;
}
+ // Check if we need to show the EULA. There are two cases:
+ // 1- If it is passed as a command line (--show-eula), then the dialog is
+ // shown and regardless of the outcome setup exits here.
+ // 2- If it is found in the installerdata file then the eula is shown
+ // and the installation proceeds if the user acepts.
+ if (parsed_command_line.HasSwitch(installer_util::switches::kShowEula)) {
+ return (ShowEULADialog() ?
+ installer_util::EULA_ACCEPTED : installer_util::EULA_REJECTED);
+ } else if (installer_util::MASTER_PROFILE_REQUIRE_EULA & options) {
+ if (!ShowEULADialog())
+ return installer_util::EULA_REJECTED;
+ }
+
// If --register-chrome-browser option is specified, register all
// Chrome protocol/file associations as well as register it as a valid
// browser for StarMenu->Internet shortcut. This option should only