Commit fd21b244 authored by Tim Song's avatar Tim Song Committed by Commit Bot

Ash Tray: Remove bottom Clear All button in message center.

The redesigned Clear All button is now shown at the top in the notification
stacking bar, so remove the bottom button.

BUG=952557

Change-Id: I4f471141094a01dc9cbc5b69f49cf87d69780097
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1659535Reviewed-by: default avatarTetsui Ohkubo <tetsui@chromium.org>
Reviewed-by: default avatarNik Bhagat <nikunjb@chromium.org>
Commit-Queue: Tim Song <tengs@chromium.org>
Cr-Commit-Position: refs/heads/master@{#670349}
parent 287777ca
...@@ -46,39 +46,16 @@ constexpr base::TimeDelta kHideStackingBarAnimationDuration = ...@@ -46,39 +46,16 @@ constexpr base::TimeDelta kHideStackingBarAnimationDuration =
constexpr base::TimeDelta kCollapseAnimationDuration = constexpr base::TimeDelta kCollapseAnimationDuration =
base::TimeDelta::FromMilliseconds(640); base::TimeDelta::FromMilliseconds(640);
enum ClearAllButtonTag {
kStackingBarClearAllButtonTag,
kBottomClearAllButtonTag,
};
constexpr int kClearAllButtonRowHeight = 3 * kUnifiedNotificationCenterSpacing;
class ScrollerContentsView : public views::View { class ScrollerContentsView : public views::View {
public: public:
ScrollerContentsView(UnifiedMessageListView* message_list_view, ScrollerContentsView(UnifiedMessageListView* message_list_view,
views::ButtonListener* listener) { views::ButtonListener* listener) {
auto* contents_layout = SetLayoutManager( auto* contents_layout = SetLayoutManager(std::make_unique<views::BoxLayout>(
std::make_unique<views::BoxLayout>(views::BoxLayout::kVertical)); views::BoxLayout::kVertical,
gfx::Insets(0, 0, kUnifiedNotificationCenterSpacing, 0)));
contents_layout->set_cross_axis_alignment( contents_layout->set_cross_axis_alignment(
views::BoxLayout::CrossAxisAlignment::kStretch); views::BoxLayout::CrossAxisAlignment::kStretch);
AddChildView(message_list_view); AddChildView(message_list_view);
views::View* button_container = new views::View;
auto* button_layout =
button_container->SetLayoutManager(std::make_unique<views::BoxLayout>(
views::BoxLayout::kHorizontal,
gfx::Insets(kUnifiedNotificationCenterSpacing), 0));
button_layout->set_main_axis_alignment(
views::BoxLayout::MainAxisAlignment::kEnd);
auto* clear_all_button = new RoundedLabelButton(
listener, l10n_util::GetStringUTF16(
IDS_ASH_MESSAGE_CENTER_CLEAR_ALL_BUTTON_LABEL));
clear_all_button->SetTooltipText(l10n_util::GetStringUTF16(
IDS_ASH_MESSAGE_CENTER_CLEAR_ALL_BUTTON_TOOLTIP));
clear_all_button->set_tag(kBottomClearAllButtonTag);
button_container->AddChildView(clear_all_button);
AddChildView(button_container);
} }
~ScrollerContentsView() override = default; ~ScrollerContentsView() override = default;
...@@ -100,7 +77,6 @@ class StackingBarClearAllButton : public views::LabelButton { ...@@ -100,7 +77,6 @@ class StackingBarClearAllButton : public views::LabelButton {
StackingBarClearAllButton(views::ButtonListener* listener, StackingBarClearAllButton(views::ButtonListener* listener,
const base::string16& text) const base::string16& text)
: views::LabelButton(listener, text) { : views::LabelButton(listener, text) {
set_tag(kStackingBarClearAllButtonTag);
SetEnabledTextColors(kUnifiedMenuButtonColorActive); SetEnabledTextColors(kUnifiedMenuButtonColorActive);
SetHorizontalAlignment(gfx::ALIGN_CENTER); SetHorizontalAlignment(gfx::ALIGN_CENTER);
SetBorder(views::CreateEmptyBorder(gfx::Insets())); SetBorder(views::CreateEmptyBorder(gfx::Insets()));
...@@ -285,7 +261,7 @@ UnifiedMessageCenterView::UnifiedMessageCenterView( ...@@ -285,7 +261,7 @@ UnifiedMessageCenterView::UnifiedMessageCenterView(
scroll_bar_(new MessageCenterScrollBar(this)), scroll_bar_(new MessageCenterScrollBar(this)),
scroller_(new views::ScrollView()), scroller_(new views::ScrollView()),
message_list_view_(new UnifiedMessageListView(this, model)), message_list_view_(new UnifiedMessageListView(this, model)),
last_scroll_position_from_bottom_(kClearAllButtonRowHeight), last_scroll_position_from_bottom_(0),
animation_(std::make_unique<gfx::LinearAnimation>(this)) { animation_(std::make_unique<gfx::LinearAnimation>(this)) {
message_list_view_->Init(); message_list_view_->Init();
...@@ -392,9 +368,6 @@ gfx::Size UnifiedMessageCenterView::CalculatePreferredSize() const { ...@@ -392,9 +368,6 @@ gfx::Size UnifiedMessageCenterView::CalculatePreferredSize() const {
preferred_size.set_height(preferred_size.height() + bar_height); preferred_size.set_height(preferred_size.height() + bar_height);
} }
// Hide Clear All button at the buttom from initial viewport.
preferred_size.set_height(preferred_size.height() - kClearAllButtonRowHeight);
if (animation_state_ == UnifiedMessageCenterAnimationState::COLLAPSE) { if (animation_state_ == UnifiedMessageCenterAnimationState::COLLAPSE) {
int height = preferred_size.height() * (1.0 - GetAnimationValue()); int height = preferred_size.height() * (1.0 - GetAnimationValue());
preferred_size.set_height(height); preferred_size.set_height(height);
...@@ -431,18 +404,8 @@ void UnifiedMessageCenterView::OnMessageCenterScrolled() { ...@@ -431,18 +404,8 @@ void UnifiedMessageCenterView::OnMessageCenterScrolled() {
void UnifiedMessageCenterView::ButtonPressed(views::Button* sender, void UnifiedMessageCenterView::ButtonPressed(views::Button* sender,
const ui::Event& event) { const ui::Event& event) {
if (sender) { base::RecordAction(
switch (sender->tag()) { base::UserMetricsAction("StatusArea_Notifications_StackingBarClearAll"));
case kStackingBarClearAllButtonTag:
base::RecordAction(base::UserMetricsAction(
"StatusArea_Notifications_StackingBarClearAll"));
break;
case kBottomClearAllButtonTag:
base::RecordAction(
base::UserMetricsAction("StatusArea_Notifications_ClearAll"));
break;
}
}
message_list_view_->ClearAllWithAnimation(); message_list_view_->ClearAllWithAnimation();
} }
......
...@@ -49,7 +49,8 @@ enum class UnifiedMessageCenterAnimationState { ...@@ -49,7 +49,8 @@ enum class UnifiedMessageCenterAnimationState {
}; };
// The header shown above the notification list displaying the number of hidden // The header shown above the notification list displaying the number of hidden
// notifications. // notifications. There are currently two UI implementations toggled by the
// NotificationStackingBarRedesign feature flag.
class StackingNotificationCounterView : public views::View { class StackingNotificationCounterView : public views::View {
public: public:
explicit StackingNotificationCounterView(views::ButtonListener* listener); explicit StackingNotificationCounterView(views::ButtonListener* listener);
......
...@@ -218,9 +218,6 @@ TEST_F(UnifiedMessageCenterViewTest, AddAndRemoveNotification) { ...@@ -218,9 +218,6 @@ TEST_F(UnifiedMessageCenterViewTest, AddAndRemoveNotification) {
auto id0 = AddNotification(); auto id0 = AddNotification();
EXPECT_TRUE(message_center_view()->GetVisible()); EXPECT_TRUE(message_center_view()->GetVisible());
EXPECT_EQ(3 * kUnifiedNotificationCenterSpacing,
GetScrollerContents()->height() -
GetScroller()->GetVisibleRect().bottom());
// The notification first slides out of the list. // The notification first slides out of the list.
MessageCenter::Get()->RemoveNotification(id0, true /* by_user */); MessageCenter::Get()->RemoveNotification(id0, true /* by_user */);
...@@ -393,7 +390,7 @@ TEST_F(UnifiedMessageCenterViewTest, InitialPositionMaxOut) { ...@@ -393,7 +390,7 @@ TEST_F(UnifiedMessageCenterViewTest, InitialPositionMaxOut) {
TEST_F(UnifiedMessageCenterViewTest, InitialPositionWithLargeNotification) { TEST_F(UnifiedMessageCenterViewTest, InitialPositionWithLargeNotification) {
AddNotification(); AddNotification();
AddNotification(); AddNotification();
CreateMessageCenterView(100 /* max_height */); CreateMessageCenterView(80 /* max_height */);
EXPECT_TRUE(message_center_view()->GetVisible()); EXPECT_TRUE(message_center_view()->GetVisible());
// MessageCenterView is shorter than the notification. // MessageCenterView is shorter than the notification.
......
...@@ -20015,11 +20015,14 @@ should be able to be added at any place in this file. ...@@ -20015,11 +20015,14 @@ should be able to be added at any place in this file.
</action> </action>
<action name="StatusArea_Notifications_ClearAll"> <action name="StatusArea_Notifications_ClearAll">
<obsolete>
Deprecated in favour of StatusArea_Notifications_StackingBarClearAll.
</obsolete>
<owner>tetsui@chromium.org</owner> <owner>tetsui@chromium.org</owner>
<description> <description>
User removed all notifications using the bottom Clear All button in the User removed all notifications using the bottom Clear All button in the
system menu. Note that there are two clear all buttons, and this button is system menu. This button, which no longer exists, was located on the bottom
located on the bottom of the notification list. of the notification list.
</description> </description>
</action> </action>
...@@ -20027,8 +20030,7 @@ should be able to be added at any place in this file. ...@@ -20027,8 +20030,7 @@ should be able to be added at any place in this file.
<owner>tengs@chromium.org</owner> <owner>tengs@chromium.org</owner>
<description> <description>
User removed all notifications using the top Clear All button in the system User removed all notifications using the top Clear All button in the system
menu. Note that there are two clear all buttons, and this one is located on menu.
the top stacking bar of the notification list.
</description> </description>
</action> </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