Commit 86b34748 authored by Finnur Thorarinsson's avatar Finnur Thorarinsson Committed by Commit Bot

MD notifications: A little polish.

- Ensure Settings and Close are visible always (for non-Chrome OS).
- Add "from this site" to the "block all notifications" string.

Bug: 810873,768300
Change-Id: I85eb7753614e8cd678343d06de6160b9dac5d50d
Reviewed-on: https://chromium-review.googlesource.com/913271
Commit-Queue: Finnur Thorarinsson <finnur@chromium.org>
Reviewed-by: default avatarPeter Beverloo <peter@chromium.org>
Cr-Commit-Position: refs/heads/master@{#536704}
parent 95e3f81e
...@@ -124,6 +124,16 @@ constexpr int kTextFontSizeDelta = 1; ...@@ -124,6 +124,16 @@ constexpr int kTextFontSizeDelta = 1;
// the ratio of the message width is limited to this value. // the ratio of the message width is limited to this value.
constexpr double kProgressNotificationMessageRatio = 0.7; constexpr double kProgressNotificationMessageRatio = 0.7;
// Users on ChromeOS are used to the Settings and Close buttons not being
// visible at all times, but users on other platforms expect them to be visible.
constexpr bool AlwaysShowControlButtons() {
#if defined(OS_CHROMEOS)
return false;
#else
return true;
#endif
}
// FontList for the texts except for the header. // FontList for the texts except for the header.
gfx::FontList GetTextFontList() { gfx::FontList GetTextFontList() {
gfx::Font default_font; gfx::Font default_font;
...@@ -1135,8 +1145,27 @@ void NotificationViewMD::CreateOrUpdateInlineSettingsViews( ...@@ -1135,8 +1145,27 @@ void NotificationViewMD::CreateOrUpdateInlineSettingsViews(
settings_row_->SetLayoutManager(std::make_unique<views::BoxLayout>( settings_row_->SetLayoutManager(std::make_unique<views::BoxLayout>(
views::BoxLayout::kVertical, kSettingsRowPadding, 0)); views::BoxLayout::kVertical, kSettingsRowPadding, 0));
int block_notifications_message_id = 0;
switch (notification.notifier_id().type) {
case NotifierId::APPLICATION:
case NotifierId::ARC_APPLICATION:
block_notifications_message_id =
IDS_MESSAGE_CENTER_BLOCK_ALL_NOTIFICATIONS_APP;
break;
case NotifierId::WEB_PAGE:
block_notifications_message_id =
IDS_MESSAGE_CENTER_BLOCK_ALL_NOTIFICATIONS_SITE;
break;
case NotifierId::SYSTEM_COMPONENT:
case NotifierId::SIZE:
block_notifications_message_id =
IDS_MESSAGE_CENTER_BLOCK_ALL_NOTIFICATIONS;
break;
}
DCHECK_NE(block_notifications_message_id, 0);
block_all_button_ = new InlineSettingsRadioButton( block_all_button_ = new InlineSettingsRadioButton(
l10n_util::GetStringUTF16(IDS_MESSAGE_CENTER_BLOCK_ALL_NOTIFICATIONS)); l10n_util::GetStringUTF16(block_notifications_message_id));
block_all_button_->set_listener(this); block_all_button_->set_listener(this);
block_all_button_->SetBorder( block_all_button_->SetBorder(
views::CreateEmptyBorder(kSettingsRadioButtonPadding)); views::CreateEmptyBorder(kSettingsRadioButtonPadding));
...@@ -1268,7 +1297,8 @@ void NotificationViewMD::ToggleInlineSettings(const ui::LocatedEvent& event) { ...@@ -1268,7 +1297,8 @@ void NotificationViewMD::ToggleInlineSettings(const ui::LocatedEvent& event) {
// among NotificationView and ArcNotificationView. // among NotificationView and ArcNotificationView.
void NotificationViewMD::UpdateControlButtonsVisibility() { void NotificationViewMD::UpdateControlButtonsVisibility() {
const bool target_visibility = const bool target_visibility =
IsMouseHovered() || control_buttons_view_->IsCloseButtonFocused() || AlwaysShowControlButtons() || IsMouseHovered() ||
control_buttons_view_->IsCloseButtonFocused() ||
control_buttons_view_->IsSettingsButtonFocused(); control_buttons_view_->IsSettingsButtonFocused();
control_buttons_view_->SetVisible(target_visibility); control_buttons_view_->SetVisible(target_visibility);
......
...@@ -652,7 +652,13 @@ need to be translated for each locale.--> ...@@ -652,7 +652,13 @@ need to be translated for each locale.-->
<message name="IDS_MESSAGE_NOTIFICATION_DURATION_YEARS_SHORTEST" desc="Phrase describing a time duration using years that is as short as possible, preferrably one character. Should be same as AndroidPlatform msgId 7848711145196397042. (frameworks/base/core/res/res/values/strings.xml:plurals:duration_years_shortest) [ICU Syntax]"> <message name="IDS_MESSAGE_NOTIFICATION_DURATION_YEARS_SHORTEST" desc="Phrase describing a time duration using years that is as short as possible, preferrably one character. Should be same as AndroidPlatform msgId 7848711145196397042. (frameworks/base/core/res/res/values/strings.xml:plurals:duration_years_shortest) [ICU Syntax]">
{YEARS, plural, =1 {1y} other {#y}} {YEARS, plural, =1 {1y} other {#y}}
</message> </message>
<message name="IDS_MESSAGE_CENTER_BLOCK_ALL_NOTIFICATIONS" desc="The label for the radio button to block all the notifications from this notification origin."> <message name="IDS_MESSAGE_CENTER_BLOCK_ALL_NOTIFICATIONS_SITE" desc="The label for the radio button to block all the notifications from this notification origin.">
Block all notifications from this site
</message>
<message name="IDS_MESSAGE_CENTER_BLOCK_ALL_NOTIFICATIONS_APP" desc="The label for the radio button to block all the notifications from this app.">
Block all notifications from this app
</message>
<message name="IDS_MESSAGE_CENTER_BLOCK_ALL_NOTIFICATIONS" desc="The label for the radio button to block all the notifications.">
Block all notifications Block all notifications
</message> </message>
<message name="IDS_MESSAGE_CENTER_DONT_BLOCK_NOTIFICATIONS" desc="The label for the radio button to allow all the notifications from this notification origin."> <message name="IDS_MESSAGE_CENTER_DONT_BLOCK_NOTIFICATIONS" desc="The label for the radio button to allow all the notifications from this notification origin.">
......
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