summaryrefslogtreecommitdiffstats
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
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
-rw-r--r--chrome/browser/first_run/try_chrome_dialog_view.cc70
-rw-r--r--chrome/browser/first_run/try_chrome_dialog_view.h15
-rw-r--r--chrome/common/attrition_experiments.h3
-rw-r--r--chrome/installer/util/browser_distribution.h1
-rw-r--r--chrome/installer/util/google_chrome_distribution.cc17
5 files changed, 73 insertions, 33 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);
diff --git a/chrome/common/attrition_experiments.h b/chrome/common/attrition_experiments.h
index c5d7d45..8de75f8 100644
--- a/chrome/common/attrition_experiments.h
+++ b/chrome/common/attrition_experiments.h
@@ -29,6 +29,9 @@ const wchar_t kSkype[] = L"SKPC,SKPG,SKPH,SKPI,SKPL,SKPM,SKPN";
// The brand code for enterprise installations.
const wchar_t kEnterprise[] = L"GGRV";
+// The brand code for showing more compact bubbles (experimental).
+const wchar_t kBrief[] = L"CHMA";
+
// Constants for the "infobar plugins" experiment. These strings become
// the registry omaha |client| value. The last one is considered to be
// the control group which reflects the current behavior. Note that
diff --git a/chrome/installer/util/browser_distribution.h b/chrome/installer/util/browser_distribution.h
index 938440f..5f1b7b3 100644
--- a/chrome/installer/util/browser_distribution.h
+++ b/chrome/installer/util/browser_distribution.h
@@ -41,6 +41,7 @@ class BrowserDistribution {
// also known as the 'TV' part in 'TV80'.
int flavor; // The flavor index for this experiment.
int heading; // The heading resource ID to use for this experiment.
+ bool compact_bubble; // Whether to show the compact heading or not.
int control_group; // Size of the control group (in percentages). Control
// group is the group that qualifies for the
// experiment but does not participate.
diff --git a/chrome/installer/util/google_chrome_distribution.cc b/chrome/installer/util/google_chrome_distribution.cc
index 0666178..73058d7 100644
--- a/chrome/installer/util/google_chrome_distribution.cc
+++ b/chrome/installer/util/google_chrome_distribution.cc
@@ -601,12 +601,16 @@ bool GoogleChromeDistribution::GetExperimentDetails(
// of headings (below).
int headings[kMax]; // A list of IDs per experiment. 0 == no heading.
} kExperimentFlavors[] = {
- // First in this order are the brand specific ones.
- {L"en-US", kSkype, 1, L'Z', L'A', 1, { kSkype1, 0, 0, 0 } },
- // And then we have catch-alls, like en-US (all brands).
- {L"en-US", kAll, 1, L'T', L'V', 4, { kEnUs1, kEnUs2, kEnUs3, kEnUs4} },
- // Japan has two experiments, same IDs as en-US but translated differently.
- {L"jp", kAll, 1, L'T', L'V', 2, { kEnUs1, kEnUs2, 0, 0} },
+ // This list should be ordered most-specific rule first (catch-all, like all
+ // brands or all locales should be last).
+
+ // The experiment with the more compact bubble. This one is a bit special
+ // because it is split into two: CAxx is regular style bubble and CBxx is
+ // compact style bubble. See |compact_bubble| below.
+ {L"en-US", kBrief, 1, L'C', L'A', 2, { kEnUs3, kEnUs3, 0, 0 } },
+
+ // Catch-all rules.
+ {kAll, kAll, 1, L'B', L'A', 1, {kEnUs3, 0, 0, 0} },
};
std::wstring locale;
@@ -657,6 +661,7 @@ bool GoogleChromeDistribution::GetExperimentDetails(
experiment->prefix.resize(2);
experiment->prefix[0] = kExperimentFlavors[i].prefix1;
experiment->prefix[1] = kExperimentFlavors[i].prefix2 + flavor;
+ experiment->compact_bubble = (brand == kBrief) && (flavor == 1);
return true;
}
}