Commit 3c3986a6 authored by Keren Zhu's avatar Keren Zhu Committed by Commit Bot

IPH Snooze UI update

Requested by UX, this CL includes
* Change "Dismiss" to "Got it"
* Change buttons order depending on OS.
* Change button padding

Bug: 1121399
Change-Id: I2a019f15e5bdd6c188583922511595aa4aca6c83
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2414836
Commit-Queue: Keren Zhu <kerenzhu@chromium.org>
Reviewed-by: default avatarCollin Baker <collinbaker@chromium.org>
Cr-Commit-Position: refs/heads/master@{#807993}
parent 0326e39b
...@@ -5913,12 +5913,22 @@ the Bookmarks menu."> ...@@ -5913,12 +5913,22 @@ the Bookmarks menu.">
<message name="IDS_TAB_GROUPS_NEW_GROUP_PROMO" desc="Text shown on promotional UI encouraging users to create a tab group in their tab strip"> <message name="IDS_TAB_GROUPS_NEW_GROUP_PROMO" desc="Text shown on promotional UI encouraging users to create a tab group in their tab strip">
To group tabs together, right-click a tab To group tabs together, right-click a tab
</message> </message>
<message name="IDS_PROMO_DISMISS_BUTTON" desc="Text shown on the button to dismiss a promotional UI"> <if expr="use_titlecase">
Dismiss <message name="IDS_PROMO_DISMISS_BUTTON" desc="Text shown on the button for the user to acknowledge that they understand the message">
Got It
</message>
<message name="IDS_PROMO_SNOOZE_BUTTON" desc="Text shown on the button to snooze a promotional UI, which indicates that users want to see this promotion at a later time">
Remind Me Later
</message>
</if>
<if expr="not use_titlecase">
<message name="IDS_PROMO_DISMISS_BUTTON" desc="Text shown on the button for the user to acknowledge that they understand the message">
Got it
</message> </message>
<message name="IDS_PROMO_SNOOZE_BUTTON" desc="Text shown on the button to snooze a promotional UI, which indicates that users want to see this promotion at a later time"> <message name="IDS_PROMO_SNOOZE_BUTTON" desc="Text shown on the button to snooze a promotional UI, which indicates that users want to see this promotion at a later time">
Remind me later Remind me later
</message> </message>
</if>
<!-- Browser Hung Plugin Detector --> <!-- Browser Hung Plugin Detector -->
<if expr="is_win"> <if expr="is_win">
......
cec914674a8880399cb6e22ca7fa2f51ff131403 c09432bf41131fb1758631e16958925a4228d8b3
\ No newline at end of file \ No newline at end of file
cec914674a8880399cb6e22ca7fa2f51ff131403 c09432bf41131fb1758631e16958925a4228d8b3
\ No newline at end of file \ No newline at end of file
...@@ -31,6 +31,7 @@ ...@@ -31,6 +31,7 @@
#include "ui/views/layout/box_layout.h" #include "ui/views/layout/box_layout.h"
#include "ui/views/layout/fill_layout.h" #include "ui/views/layout/fill_layout.h"
#include "ui/views/layout/layout_provider.h" #include "ui/views/layout/layout_provider.h"
#include "ui/views/style/platform_style.h"
#include "ui/views/view_class_properties.h" #include "ui/views/view_class_properties.h"
namespace { namespace {
...@@ -46,8 +47,7 @@ constexpr base::TimeDelta kDelayShort = base::TimeDelta::FromSeconds(3); ...@@ -46,8 +47,7 @@ constexpr base::TimeDelta kDelayShort = base::TimeDelta::FromSeconds(3);
// The insets from the bubble border to the text inside. // The insets from the bubble border to the text inside.
constexpr gfx::Insets kBubbleContentsInsets(12, 16); constexpr gfx::Insets kBubbleContentsInsets(12, 16);
constexpr gfx::Insets kBubbleButtonPadding(10, 10); constexpr gfx::Insets kBubbleButtonPadding(8, 10);
} // namespace } // namespace
namespace views { namespace views {
...@@ -189,23 +189,30 @@ FeaturePromoBubbleView::FeaturePromoBubbleView( ...@@ -189,23 +189,30 @@ FeaturePromoBubbleView::FeaturePromoBubbleView(
button_layout->set_main_axis_alignment( button_layout->set_main_axis_alignment(
views::BoxLayout::MainAxisAlignment::kEnd); views::BoxLayout::MainAxisAlignment::kEnd);
const base::string16 skip_text = const base::string16 snooze_text =
l10n_util::GetStringUTF16(IDS_PROMO_SNOOZE_BUTTON);
const base::string16 dismiss_text =
l10n_util::GetStringUTF16(IDS_PROMO_DISMISS_BUTTON); l10n_util::GetStringUTF16(IDS_PROMO_DISMISS_BUTTON);
bool dismiss_is_leading = views::PlatformStyle::kIsOkButtonLeading;
dismiss_button_ = button_container->AddChildView( snooze_button_ = button_container->AddChildView(
std::make_unique<views::MdIPHBubbleButton>(this, skip_text, false)); std::make_unique<views::MdIPHBubbleButton>(this, snooze_text, false));
dismiss_button_->SetCustomPadding(kBubbleButtonPadding); dismiss_button_ = button_container->AddChildViewAt(
dismiss_button_->SetProperty( std::make_unique<views::MdIPHBubbleButton>(this, dismiss_text, true),
dismiss_is_leading ? 0 : 1);
auto* leading_button =
dismiss_is_leading ? dismiss_button_ : snooze_button_;
leading_button->SetProperty(
views::kMarginsKey, views::kMarginsKey,
gfx::Insets(0, layout_provider->GetDistanceMetric( gfx::Insets(0, layout_provider->GetDistanceMetric(
views::DISTANCE_RELATED_BUTTON_HORIZONTAL))); views::DISTANCE_RELATED_BUTTON_HORIZONTAL)));
const base::string16 snooze_text = // The text in dismiss button will be shorter than the default min size.
l10n_util::GetStringUTF16(IDS_PROMO_SNOOZE_BUTTON); // Set min size to 0 so that the custom padding is effective.
dismiss_button_->SetMinSize(gfx::Size(0, 0));
snooze_button_ = button_container->AddChildView(
std::make_unique<views::MdIPHBubbleButton>(this, snooze_text, true));
snooze_button_->SetCustomPadding(kBubbleButtonPadding); snooze_button_->SetCustomPadding(kBubbleButtonPadding);
dismiss_button_->SetCustomPadding(kBubbleButtonPadding);
} }
if (params.activation_action == if (params.activation_action ==
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment