summaryrefslogtreecommitdiffstats
path: root/chrome/browser/first_run
diff options
context:
space:
mode:
authorfinnur@chromium.org <finnur@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-01-30 09:59:23 +0000
committerfinnur@chromium.org <finnur@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-01-30 09:59:23 +0000
commitb157419f15ec486b7553921479cb953a7a17c1f8 (patch)
tree2411913a40fd9ad0c17656f163144051e07651ee /chrome/browser/first_run
parent5ca03beb218b20971a6f8846d13106442f9e7e59 (diff)
downloadchromium_src-b157419f15ec486b7553921479cb953a7a17c1f8.zip
chromium_src-b157419f15ec486b7553921479cb953a7a17c1f8.tar.gz
chromium_src-b157419f15ec486b7553921479cb953a7a17c1f8.tar.bz2
Test out a new more compact, simpler attrition experiment toast bubble.
Old bubble: --------------------------------------------- There's a new safer version of Google Chrome [x] Try it out [ ] Uninstall [OK] [Don't Bug Me] {Why am I seeing this?} --------------------------------------------- Newer, more compact bubble: --------------------------------------------- There's a new safer version of Google Chrome [x] Try it out [ ] Don't Bug Me [OK] --------------------------------------------- BUG=None TEST=This should be tested like any other attrition toast experiment, but needs a special branded build. Review URL: https://chromiumcodereview.appspot.com/9129021 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@119655 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/first_run')
-rw-r--r--chrome/browser/first_run/try_chrome_dialog_view.cc70
-rw-r--r--chrome/browser/first_run/try_chrome_dialog_view.h15
2 files changed, 58 insertions, 27 deletions
diff --git a/chrome/browser/first_run/try_chrome_dialog_view.cc b/chrome/browser/first_run/try_chrome_dialog_view.cc
index 584910b..f1da73d 100644
--- a/chrome/browser/first_run/try_chrome_dialog_view.cc
+++ b/chrome/browser/first_run/try_chrome_dialog_view.cc
@@ -36,22 +36,23 @@ const wchar_t kHelpCenterUrl[] =
// static
TryChromeDialogView::Result TryChromeDialogView::Show(
- size_t version,
+ size_t flavor,
ProcessSingleton* process_singleton) {
- if (version > 10000) {
+ if (flavor > 10000) {
// This is a test value. We want to make sure we exercise
- // returning this early. See EarlyReturnTest test harness.
+ // returning this early. See TryChromeDialogBrowserTest test.
return NOT_NOW;
}
- TryChromeDialogView dialog(version);
+ TryChromeDialogView dialog(flavor);
return dialog.ShowModal(process_singleton);
}
-TryChromeDialogView::TryChromeDialogView(size_t version)
- : version_(version),
+TryChromeDialogView::TryChromeDialogView(size_t flavor)
+ : flavor_(flavor),
popup_(NULL),
try_chrome_(NULL),
kill_chrome_(NULL),
+ dont_try_chrome_(NULL),
result_(COUNT) {
}
@@ -128,6 +129,10 @@ TryChromeDialogView::Result TryChromeDialogView::ShowModal(
columns->AddPaddingColumn(0, views::kRelatedControlHorizontalSpacing);
columns->AddColumn(views::GridLayout::LEADING, views::GridLayout::FILL, 1,
views::GridLayout::USE_PREF, 0, 0);
+ // Optional fourth row: [button].
+ columns = layout->AddColumnSet(5);
+ columns->AddColumn(views::GridLayout::CENTER, views::GridLayout::FILL, 1,
+ views::GridLayout::USE_PREF, 0, 0);
// First row views.
layout->StartRow(0, 0);
layout->AddView(icon);
@@ -139,7 +144,7 @@ TryChromeDialogView::Result TryChromeDialogView::ShowModal(
return DIALOG_ERROR;
}
BrowserDistribution::UserExperiment experiment;
- if (!dist->GetExperimentDetails(&experiment, version_) ||
+ if (!dist->GetExperimentDetails(&experiment, flavor_) ||
!experiment.heading) {
NOTREACHED() << "Cannot determine which headline to show.";
return DIALOG_ERROR;
@@ -170,27 +175,45 @@ TryChromeDialogView::Result TryChromeDialogView::ShowModal(
try_chrome_->SetChecked(true);
// Third row views.
- const string16 kill_it(l10n_util::GetStringUTF16(IDS_UNINSTALL_CHROME));
layout->StartRow(0, 2);
- kill_chrome_ = new views::RadioButton(kill_it, 1);
- layout->AddView(kill_chrome_);
+ if (experiment.compact_bubble) {
+ // The compact bubble has, as its second radio button, "Don't bug me".
+ const string16 decline(l10n_util::GetStringUTF16(IDS_TRY_TOAST_CANCEL));
+ dont_try_chrome_ = new views::RadioButton(decline, 1);
+ layout->AddView(dont_try_chrome_);
+ } else {
+ // The regular bubble has, as its second radio button, "Uninstall Chrome".
+ const string16 kill_it(l10n_util::GetStringUTF16(IDS_UNINSTALL_CHROME));
+ kill_chrome_ = new views::RadioButton(kill_it, 1);
+ layout->AddView(kill_chrome_);
+ }
// Fourth row views.
const string16 ok_it(l10n_util::GetStringUTF16(IDS_OK));
const string16 cancel_it(l10n_util::GetStringUTF16(IDS_TRY_TOAST_CANCEL));
const string16 why_this(l10n_util::GetStringUTF16(IDS_TRY_TOAST_WHY));
- layout->StartRowWithPadding(0, 3, 0, 10);
views::Button* accept_button = new views::NativeTextButton(this, ok_it);
accept_button->set_tag(BT_OK_BUTTON);
+
+ // The compact bubble uses a centered button column for buttons, since only
+ // the OK button appears.
+ int column_id_buttons = experiment.compact_bubble ? 5 : 3;
+ layout->StartRowWithPadding(0, column_id_buttons, 0, 10);
layout->AddView(accept_button);
- views::Button* cancel_button = new views::NativeTextButton(this, cancel_it);
- cancel_button->set_tag(BT_CLOSE_BUTTON);
- layout->AddView(cancel_button);
- // Fifth row views.
- layout->StartRowWithPadding(0, 4, 0, 10);
- views::Link* link = new views::Link(why_this);
- link->set_listener(this);
- layout->AddView(link);
+ if (!experiment.compact_bubble) {
+ // The regular bubble needs a "Don't bug me" as a button, since it is not
+ // one of the options for the radio buttons. We also decided to include the
+ // "Why am I seeing this?" link for the regular bubble only.
+ views::Button* cancel_button = new views::NativeTextButton(this, cancel_it);
+ cancel_button->set_tag(BT_CLOSE_BUTTON);
+ layout->AddView(cancel_button);
+
+ // Fifth row views.
+ layout->StartRowWithPadding(0, 4, 0, 10);
+ views::Link* link = new views::Link(why_this);
+ link->set_listener(this);
+ layout->AddView(link);
+ }
// We resize the window according to the layout manager. This takes into
// account the differences between XP and Vista fonts and buttons.
@@ -252,7 +275,14 @@ void TryChromeDialogView::ButtonPressed(views::Button* sender,
result_ = TRY_CHROME;
} else {
// The outcome is according to the selected ratio button.
- result_ = try_chrome_->checked() ? TRY_CHROME : UNINSTALL_CHROME;
+ if (try_chrome_->checked())
+ result_ = TRY_CHROME;
+ else if (dont_try_chrome_ && dont_try_chrome_->checked())
+ result_ = NOT_NOW;
+ else if (kill_chrome_ && kill_chrome_->checked())
+ result_ = UNINSTALL_CHROME;
+ else
+ NOTREACHED() << "Unknown radio button selected";
}
popup_->Close();
MessageLoop::current()->Quit();
diff --git a/chrome/browser/first_run/try_chrome_dialog_view.h b/chrome/browser/first_run/try_chrome_dialog_view.h
index 9724987..37fae8d 100644
--- a/chrome/browser/first_run/try_chrome_dialog_view.h
+++ b/chrome/browser/first_run/try_chrome_dialog_view.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -25,7 +25,7 @@ class Widget;
// This class displays a modal dialog using the views system. The dialog asks
// the user to give chrome another try. This class only handles the UI so the
-// resulting actions are up to the caller. One version looks like this:
+// resulting actions are up to the caller. One flavor looks like this:
//
// +-----------------------------------------------+
// | |icon| You stopped using Google Chrome [x] |
@@ -51,13 +51,13 @@ class TryChromeDialogView : public views::ButtonListener,
// Shows a modal dialog asking the user to give chrome another try. See
// above for the possible outcomes of the function. This is an experimental,
// non-localized dialog.
- // |version| can be 0, 1 or 2 and selects what strings to present.
+ // |flavor| can be 0, 1, 2 or 3 and selects what strings to present.
// |process_singleton| needs to be valid and it will be locked while
// the dialog is shown.
// Note that the dialog has no parent and it will position itself in a lower
// corner of the screen. The dialog does not steal focus and does not have an
// entry in the taskbar.
- static Result Show(size_t version, ProcessSingleton* process_singleton);
+ static Result Show(size_t flavor, ProcessSingleton* process_singleton);
private:
enum ButtonTags {
@@ -66,7 +66,7 @@ class TryChromeDialogView : public views::ButtonListener,
BT_OK_BUTTON,
};
- explicit TryChromeDialogView(size_t version);
+ explicit TryChromeDialogView(size_t flavor);
virtual ~TryChromeDialogView();
Result ShowModal(ProcessSingleton* process_singleton);
@@ -93,14 +93,15 @@ class TryChromeDialogView : public views::ButtonListener,
// by some convoluted logic should not be chrome.
virtual void LinkClicked(views::Link* source, int event_flags) OVERRIDE;
- // Controls which version of the text to use.
- size_t version_;
+ // Controls which flavor of the heading text to use.
+ size_t flavor_;
// We don't own any of these pointers. The |popup_| owns itself and owns the
// other views.
views::Widget* popup_;
views::RadioButton* try_chrome_;
views::RadioButton* kill_chrome_;
+ views::RadioButton* dont_try_chrome_;
Result result_;
DISALLOW_COPY_AND_ASSIGN(TryChromeDialogView);