diff options
author | cpu@google.com <cpu@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-01-27 00:52:17 +0000 |
---|---|---|
committer | cpu@google.com <cpu@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-01-27 00:52:17 +0000 |
commit | 64fcca73ef6067346597989f641488ada57ba1ea (patch) | |
tree | 55239f769b7238627673881368ba57896c0855a4 /chrome/installer/setup/main.cc | |
parent | cd3414054bcd0f6590342f89c43f8da676e377ae (diff) | |
download | chromium_src-64fcca73ef6067346597989f641488ada57ba1ea.zip chromium_src-64fcca73ef6067346597989f641488ada57ba1ea.tar.gz chromium_src-64fcca73ef6067346597989f641488ada57ba1ea.tar.bz2 |
Wire the eula and the dialog display code
- html, css and js to live in the installer as resources. The right combo of resources is selected based on system lang
- currently the approach is to have chrome show the eula by spawing setup.exe --show-eula
BUG=1468838
Review URL: http://codereview.chromium.org/18732
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@8690 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/installer/setup/main.cc')
-rwxr-xr-x | chrome/installer/setup/main.cc | 44 |
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 |