Commit 46b3a0a5 authored by Tim Song's avatar Tim Song Committed by Commit Bot

Add metric for new clear all button in stacking notification bar.

TEST=manually tested with chrome://user-actions/
BUG=921250

Change-Id: I914462bf6fda10e9fd3d88d0f808ae04a44130ca
Reviewed-on: https://chromium-review.googlesource.com/c/1488173
Commit-Queue: Tim Song <tengs@chromium.org>
Reviewed-by: default avatarSteven Holte <holte@chromium.org>
Reviewed-by: default avatarTetsui Ohkubo <tetsui@chromium.org>
Cr-Commit-Position: refs/heads/master@{#635928}
parent 1905d7a9
......@@ -40,6 +40,11 @@ namespace ash {
namespace {
enum ClearAllButtonTag {
kStackingBarClearAllButtonTag,
kBottomClearAllButtonTag,
};
constexpr int kClearAllButtonRowHeight = 3 * kUnifiedNotificationCenterSpacing;
class ScrollerContentsView : public views::View {
......@@ -65,6 +70,7 @@ class ScrollerContentsView : public views::View {
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);
}
......@@ -86,6 +92,7 @@ class StackingBarClearAllButton : public views::LabelButton {
StackingBarClearAllButton(views::ButtonListener* listener,
const base::string16& text)
: views::LabelButton(listener, text) {
set_tag(kStackingBarClearAllButtonTag);
SetEnabledTextColors(kUnifiedMenuButtonColorActive);
SetHorizontalAlignment(gfx::ALIGN_CENTER);
SetBorder(views::CreateEmptyBorder(gfx::Insets()));
......@@ -361,8 +368,19 @@ void UnifiedMessageCenterView::OnMessageCenterScrolled() {
void UnifiedMessageCenterView::ButtonPressed(views::Button* sender,
const ui::Event& event) {
base::RecordAction(
base::UserMetricsAction("StatusArea_Notifications_ClearAll"));
if (sender) {
switch (sender->tag()) {
case kStackingBarClearAllButtonTag:
base::RecordAction(base::UserMetricsAction(
"StatusArea_Notifications_StackingBarClearAll"));
break;
case kBottomClearAllButtonTag:
base::RecordAction(
base::UserMetricsAction("StatusArea_Notifications_ClearAll"));
break;
}
}
message_list_view_->ClearAllWithAnimation();
}
......
......@@ -19552,7 +19552,18 @@ should be able to be added at any place in this file.
<action name="StatusArea_Notifications_ClearAll">
<owner>tetsui@chromium.org</owner>
<description>
User removed all notifications from the Clear All button in the system menu.
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
located on the bottom of the notification list.
</description>
</action>
<action name="StatusArea_Notifications_StackingBarClearAll">
<owner>tengs@chromium.org</owner>
<description>
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
the top stacking bar of the notification list.
</description>
</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