Chromium Code Reviews| Index: chrome/installer/setup/main.cc |
| =================================================================== |
| --- chrome/installer/setup/main.cc (revision 8439) |
| +++ chrome/installer/setup/main.cc (working copy) |
| @@ -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 @@ |
| 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; |
|
huanr
2009/01/27 06:19:16
There are two sets of constants, MasterPrefResult
|
| } |
| if (preferences & installer_util::MASTER_PROFILE_CREATE_ALL_SHORTCUTS || |
| @@ -247,7 +252,7 @@ |
| 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 @@ |
| *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 @@ |
| 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 @@ |
| 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) { |
|
huanr
2009/01/27 06:19:16
Same change here.
|
| + 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 |