summaryrefslogtreecommitdiffstats
path: root/chrome/installer
diff options
context:
space:
mode:
authorcpu@google.com <cpu@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-01-29 03:27:35 +0000
committercpu@google.com <cpu@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-01-29 03:27:35 +0000
commit9e7a2dcebbbe2df2b019f213e3b39be53237e3ab (patch)
tree1e78321d2100a4e5e49b482f3d2596fd293c44e2 /chrome/installer
parent09a1bd76e3fd08b2ba0035af7ee2f0b60661174b (diff)
downloadchromium_src-9e7a2dcebbbe2df2b019f213e3b39be53237e3ab.zip
chromium_src-9e7a2dcebbbe2df2b019f213e3b39be53237e3ab.tar.gz
chromium_src-9e7a2dcebbbe2df2b019f213e3b39be53237e3ab.tar.bz2
Wire the stats consent checkbox of the EULA
- Collected in setup.exe passed to chrome via return code - Depends on an updated oem.html and JS code by Glen BUG=1468838 Review URL: http://codereview.chromium.org/19649 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@8866 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/installer')
-rwxr-xr-xchrome/installer/setup/main.cc29
-rw-r--r--chrome/installer/util/html_dialog.h18
-rw-r--r--chrome/installer/util/html_dialog_impl.cc9
-rwxr-xr-xchrome/installer/util/util_constants.h3
4 files changed, 36 insertions, 23 deletions
diff --git a/chrome/installer/setup/main.cc b/chrome/installer/setup/main.cc
index b4fc90c..2177eb9 100755
--- a/chrome/installer/setup/main.cc
+++ b/chrome/installer/setup/main.cc
@@ -444,19 +444,25 @@ installer_util::InstallStatus UninstallChrome(const CommandLine& cmd_line,
*version, remove_all, force);
}
-bool ShowEULADialog() {
+installer_util::InstallStatus 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;
+ return installer_util::EULA_REJECTED;
}
installer::EulaHTMLDialog dlg(eula_path);
- if (!dlg.ShowModal()) {
+ installer::EulaHTMLDialog::Outcome outcome = dlg.ShowModal();
+ if (installer::EulaHTMLDialog::REJECTED == outcome) {
LOG(ERROR) << "EULA rejected or EULA failure";
- return false;
+ return installer_util::EULA_REJECTED;
}
- return true;
+ if (installer::EulaHTMLDialog::ACCEPTED_OPT_IN == outcome) {
+ LOG(INFO) << "EULA accepted (opt-in)";
+ return installer_util::EULA_ACCEPTED_OPT_IN;
+ }
+ LOG(INFO) << "EULA accepted (no opt-in)";
+ return installer_util::EULA_ACCEPTED;
}
} // namespace
@@ -494,17 +500,10 @@ 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 accepts.
+ // Check if we need to show the EULA. If it is passed as a command line
+ // then the dialog is shown and regardless of the outcome setup exits here.
if (parsed_command_line.HasSwitch(installer_util::switches::kShowEula)) {
- return (ShowEULADialog() ?
- installer_util::EULA_ACCEPTED : installer_util::EULA_REJECTED);
- } else if (installer_util::SHOW_EULA_DIALOG & options) {
- if (!ShowEULADialog())
- return installer_util::EULA_REJECTED;
+ return ShowEULADialog();
}
// If --register-chrome-browser option is specified, register all
diff --git a/chrome/installer/util/html_dialog.h b/chrome/installer/util/html_dialog.h
index 91ace2d..39b741d 100644
--- a/chrome/installer/util/html_dialog.h
+++ b/chrome/installer/util/html_dialog.h
@@ -59,16 +59,24 @@ class HTMLDialog {
HTMLDialog* CreateNativeHTMLDialog(const std::wstring& url);
// This class leverages HTMLDialog to create a dialog that is suitable
-// for a end-user-agreement modal dialog.
+// for a end-user-agreement modal dialog. The html shows a fairly standard
+// EULA form with the accept and cancel buttons and an optional check box
+// to opt-in for sending usage stats and crash reports.
class EulaHTMLDialog {
public:
- // |file| points to an html file on disk.
+ // |file| points to an html file on disk or to a resource via res:// spec.
explicit EulaHTMLDialog(const std::wstring& file);
~EulaHTMLDialog();
- // Shows the dialog and blocks for user input. The return value is true if
- // the user accepted and false otherwise.
- bool ShowModal();
+ enum Outcome {
+ REJECTED, // Declined EULA, mapped from HTML_DLG_ACCEPT (1).
+ ACCEPTED, // Accepted EULA no opt-in, from HTML_DLG_DECLINE (2).
+ ACCEPTED_OPT_IN, // Accepted EULA and opt-in, from HTML_DLG_EXTRA (6).
+ };
+
+ // Shows the dialog and blocks for user input. The return value is one of
+ // the |Outcome| values and any form of failure maps to REJECTED.
+ Outcome ShowModal();
private:
class Customizer : public HTMLDialog::CustomizationCallback {
diff --git a/chrome/installer/util/html_dialog_impl.cc b/chrome/installer/util/html_dialog_impl.cc
index 2bbf57a..a758d42 100644
--- a/chrome/installer/util/html_dialog_impl.cc
+++ b/chrome/installer/util/html_dialog_impl.cc
@@ -171,10 +171,15 @@ EulaHTMLDialog::~EulaHTMLDialog() {
delete dialog_;
}
-bool EulaHTMLDialog::ShowModal() {
+EulaHTMLDialog::Outcome EulaHTMLDialog::ShowModal() {
Customizer customizer;
HTMLDialog::DialogResult dr = dialog_->ShowModal(NULL, &customizer);
- return (HTMLDialog::HTML_DLG_ACCEPT == dr || HTMLDialog::HTML_DLG_EXTRA == dr);
+ if (HTMLDialog::HTML_DLG_ACCEPT == dr)
+ return EulaHTMLDialog::ACCEPTED;
+ else if (HTMLDialog::HTML_DLG_EXTRA == dr)
+ return EulaHTMLDialog::ACCEPTED_OPT_IN;
+ else
+ return EulaHTMLDialog::REJECTED;
}
} // namespace installer
diff --git a/chrome/installer/util/util_constants.h b/chrome/installer/util/util_constants.h
index 4ee2af7..1c4e792 100755
--- a/chrome/installer/util/util_constants.h
+++ b/chrome/installer/util/util_constants.h
@@ -35,7 +35,8 @@ enum InstallStatus {
RENAME_SUCCESSFUL, // Rename of new_chrome.exe to chrome.exe worked
RENAME_FAILED, // Rename of new_chrome.exe failed
EULA_REJECTED, // EULA dialog was not accepted by user.
- EULA_ACCEPTED // EULA dialog was accepted by user.
+ EULA_ACCEPTED, // EULA dialog was accepted by user.
+ EULA_ACCEPTED_OPT_IN // EULA accepted wtih the crash optin selected.
};
// These are distibution related install options specified through command