Commit 4f2cc7fc authored by Tetsui Ohkubo's avatar Tetsui Ohkubo Committed by Commit Bot

Show notifications are hidden msg in lock screen.

We need a way to let users know that notifications are hidden in lock
screen. Similar message was preaviously shown on NotificationTray in
lock screen.

Screenshot: http://screen/BNWeniKkuR5

TEST=manual
BUG=864964

Change-Id: If7fa3bf1e61b1bce77b355c907a4dfef254a8601
Reviewed-on: https://chromium-review.googlesource.com/1156203
Commit-Queue: Tetsui Ohkubo <tetsui@chromium.org>
Reviewed-by: default avatarYoshiki Iguchi <yoshiki@chromium.org>
Cr-Commit-Position: refs/heads/master@{#580103}
parent e5e1f5a8
......@@ -1568,6 +1568,9 @@ This file contains the strings for ash.
Do not disturb
</message>
<message name="IDS_ASH_MESSAGE_CENTER_CLEAR_ALL_BUTTON_TOOLTIP" desc="The tooltip text for clearing all notifications.">
Clear all notifications
</message>
<message name="IDS_ASH_MESSAGE_CENTER_CLEAR_ALL_BUTTON_LABEL" desc="The label text for clearing all notifications.">
Clear all
</message>
<message name="IDS_ASH_MESSAGE_CENTER_SETTINGS_BUTTON_TOOLTIP" desc="The tooltip text for visiting the appropriate settings page in the footer of the message center.">
......@@ -1588,6 +1591,9 @@ This file contains the strings for ash.
<message name="IDS_ASH_MESSAGE_CENTER_FOOTER_LOCKSCREEN" desc="The label in the footer of the message center on lock screen">
Unlock device to view your notifications
</message>
<message name="IDS_ASH_MESSAGE_CENTER_LOCKSCREEN_UNIFIED" desc="The label in the message center area on lock screen.">
Notifications are hidden.
</message>
<message name="IDS_ASH_MESSAGE_CENTER_NO_MESSAGES" desc="The message displayed in the message center when there are no notifications.">
All done
</message>
......
......@@ -164,7 +164,9 @@ constexpr gfx::Insets kUnifiedSliderPadding(0, 16);
constexpr int kUnifiedNotificationCenterSpacing = 16;
constexpr int kUnifiedTrayCornerRadius = 20;
constexpr int kUnifiedTopShortcutSpacing = 16;
constexpr int kUnifiedNotificationHiddenLineHeight = 20;
constexpr gfx::Insets kUnifiedTopShortcutPadding(0, 16);
constexpr gfx::Insets kUnifiedNotificationHiddenPadding(6, 16);
// Size of an icon drawn inside top shortcut buttons.
// A dark disc with |kTrayItemSize| diameter is drawn in the background.
......
......@@ -75,8 +75,10 @@ UnifiedMessageCenterView::UnifiedMessageCenterView(
views::BoxLayout::MAIN_AXIS_ALIGNMENT_END);
auto* clear_all_button = new RoundedLabelButton(
this, l10n_util::GetStringUTF16(
IDS_ASH_MESSAGE_CENTER_CLEAR_ALL_BUTTON_TOOLTIP));
this,
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));
button_container->AddChildView(clear_all_button);
scroller_contents->AddChildView(button_container);
......
......@@ -5,8 +5,10 @@
#include "ash/system/unified/unified_system_tray_view.h"
#include "ash/public/cpp/app_list/app_list_features.h"
#include "ash/public/cpp/ash_features.h"
#include "ash/session/session_controller.h"
#include "ash/shell.h"
#include "ash/strings/grit/ash_strings.h"
#include "ash/system/tray/interacted_by_tap_recorder.h"
#include "ash/system/tray/tray_constants.h"
#include "ash/system/unified/feature_pod_button.h"
......@@ -16,10 +18,13 @@
#include "ash/system/unified/unified_system_info_view.h"
#include "ash/system/unified/unified_system_tray_controller.h"
#include "ash/system/unified/unified_system_tray_model.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/message_center/message_center.h"
#include "ui/views/background.h"
#include "ui/views/controls/label.h"
#include "ui/views/focus/focus_search.h"
#include "ui/views/layout/box_layout.h"
#include "ui/views/layout/fill_layout.h"
#include "ui/views/painter.h"
#include "ui/views/widget/widget.h"
......@@ -27,6 +32,29 @@ namespace ash {
namespace {
// Create a view to show the message that notifications are hidden. Shown when
// screen is locked.
views::View* CreateNotificationHiddenView() {
auto* label = new views::Label;
label->SetEnabledColor(kUnifiedMenuTextColor);
label->SetAutoColorReadabilityEnabled(false);
label->SetText(
l10n_util::GetStringUTF16(IDS_ASH_MESSAGE_CENTER_LOCKSCREEN_UNIFIED));
label->SetHorizontalAlignment(gfx::HorizontalAlignment::ALIGN_LEFT);
label->SetLineHeight(kUnifiedNotificationHiddenLineHeight);
label->SetBorder(views::CreateEmptyBorder(kUnifiedNotificationHiddenPadding));
label->SetBackground(views::CreateBackgroundFromPainter(
views::Painter::CreateSolidRoundRectPainter(kUnifiedMenuButtonColor,
kUnifiedTrayCornerRadius)));
auto* view = new views::View;
view->SetBorder(
views::CreateEmptyBorder(gfx::Insets(kUnifiedNotificationCenterSpacing)));
view->SetLayoutManager(std::make_unique<views::FillLayout>());
view->AddChildView(label);
return view;
}
std::unique_ptr<views::Background> CreateUnifiedBackground() {
return views::CreateBackgroundFromPainter(
views::Painter::CreateSolidRoundRectPainter(
......@@ -168,6 +196,7 @@ UnifiedSystemTrayView::UnifiedSystemTrayView(
message_center_view_(
new UnifiedMessageCenterView(controller,
message_center::MessageCenter::Get())),
notification_hidden_view_(CreateNotificationHiddenView()),
top_shortcuts_view_(new TopShortcutsView(controller_)),
feature_pods_container_(new FeaturePodsContainerView(initially_expanded)),
sliders_container_(new UnifiedSlidersContainerView(initially_expanded)),
......@@ -186,12 +215,20 @@ UnifiedSystemTrayView::UnifiedSystemTrayView(
SetPaintToLayer();
layer()->SetFillsBoundsOpaquely(false);
SessionController* session_controller = Shell::Get()->session_controller();
message_center_view_->SetVisible(
Shell::Get()->session_controller()->ShouldShowNotificationTray() &&
!Shell::Get()->session_controller()->IsScreenLocked());
session_controller->ShouldShowNotificationTray() &&
!session_controller->IsScreenLocked());
AddChildView(message_center_view_);
layout->SetFlexForView(message_center_view_, 1);
notification_hidden_view_->SetVisible(
session_controller->GetUserSession(0) &&
session_controller->IsScreenLocked() &&
!features::IsLockScreenNotificationsEnabled());
AddChildView(notification_hidden_view_);
AddChildView(system_tray_container_);
system_tray_container_->AddChildView(top_shortcuts_view_);
......
......@@ -111,16 +111,17 @@ class ASH_EXPORT UnifiedSystemTrayView : public views::View,
double expanded_amount_;
// Unowned.
UnifiedSystemTrayController* controller_;
UnifiedSystemTrayController* const controller_;
// Owned by views hierarchy.
UnifiedMessageCenterView* message_center_view_;
TopShortcutsView* top_shortcuts_view_;
FeaturePodsContainerView* feature_pods_container_;
UnifiedSlidersContainerView* sliders_container_;
UnifiedSystemInfoView* system_info_view_;
views::View* system_tray_container_;
views::View* detailed_view_container_;
UnifiedMessageCenterView* const message_center_view_;
views::View* const notification_hidden_view_;
TopShortcutsView* const top_shortcuts_view_;
FeaturePodsContainerView* const feature_pods_container_;
UnifiedSlidersContainerView* const sliders_container_;
UnifiedSystemInfoView* const system_info_view_;
views::View* const system_tray_container_;
views::View* const detailed_view_container_;
const std::unique_ptr<FocusSearch> focus_search_;
const std::unique_ptr<ui::EventHandler> interacted_by_tap_recorder_;
......
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