Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(621)

Unified Diff: chrome/browser/ui/views/subtle_notification_view.h

Issue 2010493005: a11y/Mac: Add screenreader support for SubtleNotificationView announcements. Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/views/subtle_notification_view.h
diff --git a/chrome/browser/ui/views/subtle_notification_view.h b/chrome/browser/ui/views/subtle_notification_view.h
index c04296a91029066f04322064425481390ebb8cc4..edafcebee544011156ad10ae6cedb4ad895c669a 100644
--- a/chrome/browser/ui/views/subtle_notification_view.h
+++ b/chrome/browser/ui/views/subtle_notification_view.h
@@ -9,6 +9,11 @@
#include "base/strings/string16.h"
#include "ui/gfx/native_widget_types.h"
#include "ui/views/view.h"
+#include "ui/views/widget/widget_observer.h"
+
+namespace ui {
+struct AXViewState;
+}
namespace views {
class Link;
@@ -22,7 +27,8 @@ class Widget;
// auto-dismisses after a short period of time. It also has special
// functionality for displaying keyboard shortcuts (rendering the keys inside a
// rounded rectangle).
-class SubtleNotificationView : public views::View {
+class SubtleNotificationView : public views::View,
+ public views::WidgetObserver {
public:
explicit SubtleNotificationView(views::LinkListener* link_listener);
~SubtleNotificationView() override;
@@ -37,6 +43,17 @@ class SubtleNotificationView : public views::View {
SubtleNotificationView* view,
bool accept_events);
+ // The accessible text for screenreaders to announce on displaying this
+ // notification, which should have unicode characters expanded.
+ void SetAccessibleName(const base::string16& accessible_name);
+
+ // views::View:
+ void GetAccessibleState(ui::AXViewState* state) override;
+
+ // views::WidgetObserver:
+ void OnWidgetClosing(views::Widget* widget) override;
+ void OnWidgetVisibilityChanged(views::Widget* widget, bool visible) override;
+
private:
class InstructionView;
@@ -46,6 +63,8 @@ class SubtleNotificationView : public views::View {
// after the instruction text.
views::Link* link_;
+ base::string16 accessible_name_;
+
DISALLOW_COPY_AND_ASSIGN(SubtleNotificationView);
};
« no previous file with comments | « chrome/browser/ui/views/new_back_shortcut_bubble.cc ('k') | chrome/browser/ui/views/subtle_notification_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698