diff options
author | cpu@chromium.org <cpu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-12-12 21:00:32 +0000 |
---|---|---|
committer | cpu@chromium.org <cpu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-12-12 21:00:32 +0000 |
commit | 668fb14177b5e6c4046c20b7c0dabdfab3a6b92f (patch) | |
tree | 876e49f8ec950379db56a321a98660fc4f8ed08d /chrome/browser/first_run | |
parent | a3594c61fee0f5a5e8c288a9b921a5a0fd677deb (diff) | |
download | chromium_src-668fb14177b5e6c4046c20b7c0dabdfab3a6b92f.zip chromium_src-668fb14177b5e6c4046c20b7c0dabdfab3a6b92f.tar.gz chromium_src-668fb14177b5e6c4046c20b7c0dabdfab3a6b92f.tar.bz2 |
The 2013 inactive user toast dialog
Please look at the bug for the actual look (comment #11)
compared with what was requested, which is done in photoshop
so the divergence is intentional.
The bug remaning is that some controls make the associated text
blue (as can be seen in the screenshot), but I'll fix that in a separate CL.
BUG=158413
TEST=see bug
Review URL: https://codereview.chromium.org/11486020
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@172654 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/first_run')
-rw-r--r-- | chrome/browser/first_run/try_chrome_dialog_view.cc | 81 | ||||
-rw-r--r-- | chrome/browser/first_run/try_chrome_dialog_view.h | 10 |
2 files changed, 62 insertions, 29 deletions
diff --git a/chrome/browser/first_run/try_chrome_dialog_view.cc b/chrome/browser/first_run/try_chrome_dialog_view.cc index 3581acc..7db3ee6 100644 --- a/chrome/browser/first_run/try_chrome_dialog_view.cc +++ b/chrome/browser/first_run/try_chrome_dialog_view.cc @@ -24,6 +24,7 @@ #include "ui/views/controls/button/text_button.h" #include "ui/views/controls/image_view.h" #include "ui/views/controls/link.h" +#include "ui/views/controls/separator.h" #include "ui/views/layout/grid_layout.h" #include "ui/views/layout/layout_constants.h" #include "ui/views/widget/widget.h" @@ -84,16 +85,15 @@ TryChromeDialogView::Result TryChromeDialogView::ShowModal( icon->SetImage(rb.GetNativeImageNamed(IDR_PRODUCT_LOGO_32).ToImageSkia()); gfx::Size icon_size = icon->GetPreferredSize(); - // An approximate window size. After Layout() we'll get better bounds. popup_ = new views::Widget; if (!popup_) { NOTREACHED(); return DIALOG_ERROR; } - + // An approximate window size. After Layout() we'll get better bounds. views::Widget::InitParams params(views::Widget::InitParams::TYPE_POPUP); params.can_activate = true; - params.bounds = gfx::Rect(310, 160); + params.bounds = gfx::Rect(310, 200); popup_->Init(params); views::View* root_view = popup_->GetRootView(); @@ -109,7 +109,7 @@ TryChromeDialogView::Result TryChromeDialogView::ShowModal( root_view->SetLayoutManager(layout); views::ColumnSet* columns; - // First row: [icon][pad][text][button]. + // First row: [icon][pad][text][pad][button]. columns = layout->AddColumnSet(0); columns->AddColumn(views::GridLayout::LEADING, views::GridLayout::LEADING, 0, views::GridLayout::FIXED, icon_size.width(), @@ -117,6 +117,7 @@ TryChromeDialogView::Result TryChromeDialogView::ShowModal( columns->AddPaddingColumn(0, views::kRelatedControlHorizontalSpacing); columns->AddColumn(views::GridLayout::FILL, views::GridLayout::FILL, 1, views::GridLayout::USE_PREF, 0, 0); + columns->AddPaddingColumn(0, views::kUnrelatedControlHorizontalSpacing); columns->AddColumn(views::GridLayout::TRAILING, views::GridLayout::FILL, 1, views::GridLayout::USE_PREF, 0, 0); @@ -155,13 +156,19 @@ TryChromeDialogView::Result TryChromeDialogView::ShowModal( columns->AddColumn(views::GridLayout::CENTER, views::GridLayout::FILL, 1, views::GridLayout::USE_PREF, 0, 0); - // Optional fourth row: [pad][pad][checkbox]. + // Optional fourth row: [divider] columns = layout->AddColumnSet(6); - columns->AddPaddingColumn(0, icon_size.width()); - columns->AddPaddingColumn(0, - views::kRelatedControlHorizontalSpacing + views::kPanelHorizIndentation); - columns->AddColumn(views::GridLayout::LEADING, views::GridLayout::FILL, 1, + columns->AddColumn(views::GridLayout::CENTER, views::GridLayout::FILL, 1, + views::GridLayout::USE_PREF, 0, 0); + + // Optional fifth row [checkbox][pad][button] + columns = layout->AddColumnSet(7); + columns->AddColumn(views::GridLayout::LEADING, views::GridLayout::FILL, 0, + views::GridLayout::USE_PREF, 0, 0); + columns->AddPaddingColumn(0, views::kUnrelatedControlHorizontalSpacing); + columns->AddColumn(views::GridLayout::TRAILING, views::GridLayout::FILL, 1, views::GridLayout::USE_PREF, 0, 0); + // First row. layout->StartRow(0, 0); layout->AddView(icon); @@ -180,7 +187,7 @@ TryChromeDialogView::Result TryChromeDialogView::ShowModal( } views::Label* label = new views::Label( l10n_util::GetStringUTF16(experiment.heading)); - label->SetFont(rb.GetFont(ui::ResourceBundle::MediumBoldFont)); + label->SetFont(rb.GetFont(ui::ResourceBundle::MediumFont)); label->SetMultiLine(true); label->SizeToFit(200); label->SetHorizontalAlignment(gfx::ALIGN_LEFT); @@ -224,31 +231,42 @@ TryChromeDialogView::Result TryChromeDialogView::ShowModal( l10n_util::GetStringUTF16(IDS_UNINSTALL_CHROME), kRadioGroupID); layout->AddView(kill_chrome_); } + + views::Button* accept_button = new views::NativeTextButton( + this, l10n_util::GetStringUTF16(IDS_OK)); + accept_button->set_tag(BT_OK_BUTTON); + + views::Separator* separator = NULL; if (experiment.flags & BrowserDistribution::kMakeDefault) { + // In this flavor we have some veritical space, then a separator line + // and the 'make default' checkbox and the OK button on the same row. + layout->AddPaddingRow(0, views::kUnrelatedControlVerticalSpacing); layout->StartRow(0, 6); + separator = new views::Separator; + layout->AddView(separator); + layout->AddPaddingRow(0, views::kUnrelatedControlVerticalSpacing); + + layout->StartRow(0, 7); make_default_ = new views::Checkbox( l10n_util::GetStringUTF16(IDS_TRY_TOAST_SET_DEFAULT)); - make_default_->SetFont( - make_default_->font().DeriveFont(0, gfx::Font::ITALIC)); make_default_->SetChecked(true); layout->AddView(make_default_); + layout->AddView(accept_button); + } else { + // On this other flavor there is no checkbox, the OK button and possibly + // the cancel button are in the same row. + layout->StartRowWithPadding(0, dont_bug_me_button ? 3 : 5, 0, 10); + layout->AddView(accept_button); + if (dont_bug_me_button) { + // The dialog needs a "Don't bug me" as a button or as a radio button, + // this the button case. + views::Button* cancel_button = new views::NativeTextButton( + this, l10n_util::GetStringUTF16(IDS_TRY_TOAST_CANCEL)); + cancel_button->set_tag(BT_CLOSE_BUTTON); + layout->AddView(cancel_button); + } } - // Button row, the last or next to last depending on the 'why?' link. - views::Button* accept_button = new views::NativeTextButton( - this, l10n_util::GetStringUTF16(IDS_OK)); - accept_button->set_tag(BT_OK_BUTTON); - - layout->StartRowWithPadding(0, dont_bug_me_button ? 3 : 5, 0, 10); - layout->AddView(accept_button); - if (dont_bug_me_button) { - // The bubble needs a "Don't bug me" as a button or as a radio button, this - // this the button case. - views::Button* cancel_button = new views::NativeTextButton( - this, l10n_util::GetStringUTF16(IDS_TRY_TOAST_CANCEL)); - cancel_button->set_tag(BT_CLOSE_BUTTON); - layout->AddView(cancel_button); - } if (experiment.flags & BrowserDistribution::kWhyLink) { layout->StartRowWithPadding(0, 4, 0, 10); views::Link* link = new views::Link( @@ -261,6 +279,11 @@ TryChromeDialogView::Result TryChromeDialogView::ShowModal( // account the differences between XP and Vista fonts and buttons. layout->Layout(root_view); gfx::Size preferred = layout->GetPreferredSize(root_view); + if (separator) { + int separator_height = separator->GetPreferredSize().height(); + separator->SetSize(gfx::Size(preferred.width(), separator_height)); + } + gfx::Rect pos = ComputeWindowPosition(preferred.width(), preferred.height(), base::i18n::IsRTL()); popup_->SetBounds(pos); @@ -320,13 +343,13 @@ void TryChromeDialogView::ButtonPressed(views::Button* sender, if (sender->tag() == BT_DONT_BUG_RADIO) { if (make_default_) { make_default_->SetChecked(false); - make_default_->SetState(views::CustomButton::STATE_DISABLED); + make_default_->SetVisible(false); } return; } else if (sender->tag() == BT_TRY_IT_RADIO) { if (make_default_) { + make_default_->SetVisible(true); make_default_->SetChecked(true); - make_default_->SetState(views::CustomButton::STATE_NORMAL); } return; } else if (sender->tag() == BT_CLOSE_BUTTON) { diff --git a/chrome/browser/first_run/try_chrome_dialog_view.h b/chrome/browser/first_run/try_chrome_dialog_view.h index ef5a156..62653c7 100644 --- a/chrome/browser/first_run/try_chrome_dialog_view.h +++ b/chrome/browser/first_run/try_chrome_dialog_view.h @@ -45,6 +45,16 @@ class Widget; // | [ OK ] | // +-----------------------------------------------+ // +// And the 2013 version looks like: +// +-----------------------------------------------+ +// | |icon| There is a new version of [x] | +// | |icon| Google Chrome available | +// | [o] Try it out (already installed) | +// | [ ] Don't bug me | +// | --------------------------------------------- | +// | [x] Make it the default browser [ OK ] | +// +-----------------------------------------------+ + class TryChromeDialogView : public views::ButtonListener, public views::LinkListener { public: |