Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(5315)

Unified Diff: chrome/browser/first_run_win.cc

Issue 198038: Add 3 more flavors of the try chrome toast... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/first_run.h ('k') | chrome/common/temp_scaffolding_stubs.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/first_run_win.cc
===================================================================
--- chrome/browser/first_run_win.cc (revision 25038)
+++ chrome/browser/first_run_win.cc (working copy)
@@ -626,21 +626,53 @@
// These strings are used by TryChromeDialog. They will need to be localized
// if we use it for other locales.
-const wchar_t kHeading[] =
- L"You stopped using Google Chrome. Would you like to ...";
-const wchar_t kGiveChromeATry[] =
- L"Give the new version a try (already installed)";
-const wchar_t kNahUninstallIt[] = L"Uninstall Google Chrome";
+const wchar_t* kHeading[] = {
+ L"You stopped using Google Chrome. Would you like to ...",
+ L"Google Chrome misses you.",
+ L"There is a new version of Google Chrome available.",
+ L"Google Chrome has been updated, but you haven't tried it yet"
+};
+
+const wchar_t* kGiveChromeATry[] = {
+ L"Give the new version a try (already installed)",
+ L"Give it a second chance",
+ L"Try it out (already installed)"
+};
+
+const wchar_t* kNahUninstallIt[] = {
+ L"Uninstall Google Chrome",
+ L"Uninstall Google Chrome, it had its chance"
+};
+
+const wchar_t* kOKButn[] = {
+ L"OK",
+ L"Try it"
+};
+
const wchar_t kDontBugMe[] = L"Don't bug me";
-const wchar_t kOKButn[] = L"OK";
const wchar_t kWhyThis[] = L"Why am I seeing this?";
const wchar_t kHelpCenterUrl[] =
L"http://www.google.com/support/chrome/bin/answer.py?hl=en&answer=150752";
+// This structure and the following constant defines how the dialog looks with
+// respect of buttons and text, but does not fundamentally change the behavior.
+struct VersionConfig {
+ int heading_index;
+ int try_index;
+ int uninstall_index;
+ int ok_button_index;
+};
+const VersionConfig kDialogVersion[] = {
+ {0, 0, 0, 0}, // 0 is classic.
+ {1, 1, 1, 0}, // 1 is humorous.
+ {2, 2, 0, 0}, // 2 is update-focused.
+ {3, -1, -1, 1} // 3 is simpler (no radio buttons).
+};
+
// 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. It looks like this:
+// resulting actions are up to the caller. One version looks like this:
//
// /----------------------------------------\
// | |icon| You stopped using Google [x] |
@@ -653,11 +685,15 @@
class TryChromeDialog : public views::ButtonListener,
public views::LinkController {
public:
- TryChromeDialog()
- : popup_(NULL),
+ TryChromeDialog(size_t version)
+ : version_(version),
+ popup_(NULL),
try_chrome_(NULL),
kill_chrome_(NULL),
result_(Upgrade::TD_LAST_ENUM) {
+ // In case of doubt, use the first version of the dialog.
+ if (version_ >= arraysize(kHeading))
+ version_ = 0;
}
virtual ~TryChromeDialog() {
@@ -739,7 +775,8 @@
// First row views.
layout->StartRow(0, 0);
layout->AddView(icon);
- views::Label* label = new views::Label(kHeading);
+ views::Label* label =
+ new views::Label(kHeading[kDialogVersion[version_].heading_index]);
label->SetFont(rb.GetFont(ResourceBundle::MediumBoldFont));
label->SetMultiLine(true);
label->SizeToFit(200);
@@ -755,17 +792,24 @@
close_button->set_tag(BT_CLOSE_BUTTON);
layout->AddView(close_button);
// Second row views.
- layout->StartRowWithPadding(0, 1, 0, 10);
- try_chrome_ = new views::RadioButton(kGiveChromeATry, 1);
- try_chrome_->SetChecked(true);
- layout->AddView(try_chrome_);
+ if (kDialogVersion[version_].try_index >= 0) {
+ layout->StartRowWithPadding(0, 1, 0, 10);
+ try_chrome_ = new views::RadioButton(
+ kGiveChromeATry[kDialogVersion[version_].try_index], 1);
+ try_chrome_->SetChecked(true);
+ layout->AddView(try_chrome_);
+ }
// Third row views.
- layout->StartRow(0, 2);
- kill_chrome_ = new views::RadioButton(kNahUninstallIt, 1);
- layout->AddView(kill_chrome_);
+ if (kDialogVersion[version_].try_index >= 0) {
+ layout->StartRow(0, 2);
+ kill_chrome_ = new views::RadioButton(
+ kNahUninstallIt[kDialogVersion[version_].uninstall_index], 1);
+ layout->AddView(kill_chrome_);
+ }
// Fourth row views.
layout->StartRowWithPadding(0, 3, 0, 10);
- views::Button* accept_button = new views::NativeButton(this, kOKButn);
+ views::Button* accept_button = new views::NativeButton(this,
+ kOKButn[kDialogVersion[version_].ok_button_index]);
accept_button->set_tag(BT_OK_BUTTON);
layout->AddView(accept_button);
views::Button* cancel_button = new views::NativeButton(this, kDontBugMe);
@@ -800,8 +844,13 @@
// end the modal loop.
virtual void ButtonPressed(views::Button* sender) {
if (sender->tag() == BT_CLOSE_BUTTON) {
+ // The user pressed cancel or the [x] button.
result_ = Upgrade::TD_NOT_NOW;
+ } else if (!try_chrome_) {
+ // We don't have radio buttons, the user pressed ok.
+ result_ = Upgrade::TD_TRY_CHROME;
} else {
+ // The outcome is according to the selected ratio button.
result_ = try_chrome_->checked() ? Upgrade::TD_TRY_CHROME :
Upgrade::TD_UNINSTALL_CHROME;
}
@@ -857,6 +906,9 @@
::SetWindowRgn(window, region, FALSE);
}
+ // controls which version of the text to use.
+ size_t version_;
+
// We don't own any of this pointers. The |popup_| owns itself and owns
// the other views.
views::WidgetWin* popup_;
@@ -869,7 +921,7 @@
} // namespace
-Upgrade::TryResult Upgrade::ShowTryChromeDialog() {
- TryChromeDialog td;
+Upgrade::TryResult Upgrade::ShowTryChromeDialog(size_t version) {
+ TryChromeDialog td(version);
return td.ShowModal();
}
« no previous file with comments | « chrome/browser/first_run.h ('k') | chrome/common/temp_scaffolding_stubs.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698