Commit 72af3a05 authored by Ahmed Mehfooz's avatar Ahmed Mehfooz Committed by Commit Bot

Only advance focus to first notification if notification bar is visible

If notification bar isn't visible the focus is already on the first
notification.

Change-Id: Ibc707d40687b601598258b8f318321520f16eeaa
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1974706Reviewed-by: default avatarTim Song <tengs@chromium.org>
Commit-Queue: Ahmed Mehfooz <amehfooz@chromium.org>
Cr-Commit-Position: refs/heads/master@{#726514}
parent 6d79d0c5
...@@ -179,6 +179,8 @@ bool UnifiedMessageCenterBubble::FocusOut(bool reverse) { ...@@ -179,6 +179,8 @@ bool UnifiedMessageCenterBubble::FocusOut(bool reverse) {
} }
void UnifiedMessageCenterBubble::FocusFirstNotification() { void UnifiedMessageCenterBubble::FocusFirstNotification() {
// Move focus to first notification from notification bar if it is visible.
if (message_center_view_->IsNotificationBarVisible())
message_center_view_->GetFocusManager()->AdvanceFocus(false /*reverse*/); message_center_view_->GetFocusManager()->AdvanceFocus(false /*reverse*/);
} }
......
...@@ -157,6 +157,10 @@ void UnifiedMessageCenterView::ExpandMessageCenter() { ...@@ -157,6 +157,10 @@ void UnifiedMessageCenterView::ExpandMessageCenter() {
message_center_bubble_->ExpandMessageCenter(); message_center_bubble_->ExpandMessageCenter();
} }
bool UnifiedMessageCenterView::IsNotificationBarVisible() {
return notification_bar_->GetVisible();
}
void UnifiedMessageCenterView::OnNotificationSlidOut() { void UnifiedMessageCenterView::OnNotificationSlidOut() {
if (notification_bar_->GetVisible() && if (notification_bar_->GetVisible() &&
message_list_view_->GetTotalNotificationCount() <= 1) { message_list_view_->GetTotalNotificationCount() <= 1) {
......
...@@ -111,6 +111,9 @@ class ASH_EXPORT UnifiedMessageCenterView ...@@ -111,6 +111,9 @@ class ASH_EXPORT UnifiedMessageCenterView
// Called when user clicks the see all notifications button. // Called when user clicks the see all notifications button.
void ExpandMessageCenter(); void ExpandMessageCenter();
// Returns true if the notification bar is visible.
bool IsNotificationBarVisible();
// views::View: // views::View:
void AddedToWidget() override; void AddedToWidget() override;
void RemovedFromWidget() override; void RemovedFromWidget() override;
......
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