Commit 49afe70e authored by Aga Wronska's avatar Aga Wronska Committed by Commit Bot

Add spoken feedback to the notification center dialog on the lock screen.

Make message center view focusable, so it gets focus when shown even if there
are no buttons displayed.
Set button bar title as the accessiblity name of message center view.
Button bar title describes the content of message center in a relevant
way:
* 'Notifications' when message center is enabled.
* Hint to unlock device to see notifications on the lock screen.

Remove call to UpdateButtonBarStatus() from OnLockedStateChanged(),
because Update() is already updating buttons.

Bug: 763180
Change-Id: I292725ba3a4aceae1f6ccedfd4d18c04bfa5807a
Reviewed-on: https://chromium-review.googlesource.com/759259
Commit-Queue: Aga Wronska <agawronska@chromium.org>
Reviewed-by: default avatarSteven Bennetts <stevenjb@chromium.org>
Reviewed-by: default avatarJacob Dufault <jdufault@chromium.org>
Cr-Commit-Position: refs/heads/master@{#516127}
parent 564f3898
......@@ -19,6 +19,7 @@
#include "base/message_loop/message_loop.h"
#include "base/stl_util.h"
#include "build/build_config.h"
#include "ui/accessibility/ax_node_data.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/gfx/animation/slide_animation.h"
#include "ui/gfx/canvas.h"
......@@ -128,6 +129,7 @@ MessageCenterView::MessageCenterView(MessageCenter* message_center,
message_center_->AddObserver(this);
set_notify_enter_exit_on_child(true);
SetBackground(views::CreateSolidBackground(kBackgroundColor));
SetFocusBehavior(views::View::FocusBehavior::ALWAYS);
button_bar_ = new MessageCenterButtonBar(
this, message_center, initially_settings_visible, GetButtonBarTitle());
......@@ -228,8 +230,9 @@ void MessageCenterView::ClearAllClosableNotifications() {
void MessageCenterView::OnLockStateChanged(bool locked) {
is_locked_ = locked;
UpdateButtonBarStatus();
Update(true /* animate */);
// Refresh a11y information, because accessible name of the view changes.
NotifyAccessibilityEvent(ui::AX_EVENT_ARIA_ATTRIBUTE_CHANGED, true);
}
void MessageCenterView::OnAllNotificationsCleared() {
......@@ -353,6 +356,11 @@ void MessageCenterView::OnMouseExited(const ui::MouseEvent& event) {
Update(true /* animate */);
}
void MessageCenterView::GetAccessibleNodeData(ui::AXNodeData* node_data) {
node_data->role = ui::AX_ROLE_DIALOG;
node_data->SetName(GetButtonBarTitle());
}
void MessageCenterView::OnNotificationAdded(const std::string& id) {
int index = 0;
const NotificationList::Notifications& notifications =
......
......@@ -91,6 +91,7 @@ class ASH_EXPORT MessageCenterView
int GetHeightForWidth(int width) const override;
bool OnMouseWheel(const ui::MouseWheelEvent& event) override;
void OnMouseExited(const ui::MouseEvent& event) override;
void GetAccessibleNodeData(ui::AXNodeData* node_data) override;
// Overridden from MessageCenterObserver:
void OnNotificationAdded(const std::string& id) 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