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

Unified Diff: ui/arc/notification/arc_custom_notification_view.cc

Issue 2892893002: Initial implementation of new-style notification (Closed)
Patch Set: addressed comments Created 3 years, 7 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
« no previous file with comments | « ui/arc/notification/arc_custom_notification_view.h ('k') | ui/arc/notification/arc_notification_item.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/arc/notification/arc_custom_notification_view.cc
diff --git a/ui/arc/notification/arc_custom_notification_view.cc b/ui/arc/notification/arc_custom_notification_view.cc
index c84e64642e490599258fa8245a8c856e11661246..d5ec3161161657ef371cf44f3e81bdbc46e2d916 100644
--- a/ui/arc/notification/arc_custom_notification_view.cc
+++ b/ui/arc/notification/arc_custom_notification_view.cc
@@ -10,6 +10,7 @@
#include "components/exo/notification_surface.h"
#include "components/exo/surface.h"
#include "ui/accessibility/ax_action_data.h"
+#include "ui/accessibility/ax_node_data.h"
#include "ui/arc/notification/arc_notification_view.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/base/resource/resource_bundle.h"
@@ -251,6 +252,7 @@ ArcCustomNotificationView::ArcCustomNotificationView(ArcNotificationItem* item)
// Create a layer as an anchor to insert surface copy during a slide.
SetPaintToLayer();
UpdatePreferredSize();
+ UpdateAccessibleName();
}
ArcCustomNotificationView::~ArcCustomNotificationView() {
@@ -483,6 +485,14 @@ bool ArcCustomNotificationView::ShouldUpdateControlButtonsColor() const {
return false;
}
+void ArcCustomNotificationView::UpdateAccessibleName() {
+ // Don't update the accessible name when we are about to be destroyed.
+ if (!item_)
+ return;
+
+ accessible_name_ = item_->GetAccessibleName();
+}
+
void ArcCustomNotificationView::ViewHierarchyChanged(
const views::View::ViewHierarchyChangedDetails& details) {
views::Widget* widget = GetWidget();
@@ -623,6 +633,12 @@ bool ArcCustomNotificationView::HandleAccessibleAction(
return false;
}
+void ArcCustomNotificationView::GetAccessibleNodeData(
+ ui::AXNodeData* node_data) {
+ node_data->role = ui::AX_ROLE_BUTTON;
+ node_data->SetName(accessible_name_);
+}
+
void ArcCustomNotificationView::ButtonPressed(views::Button* sender,
const ui::Event& event) {
if (item_ && !item_->GetPinned() && sender == close_button_.get()) {
@@ -659,6 +675,7 @@ void ArcCustomNotificationView::OnItemDestroying() {
}
void ArcCustomNotificationView::OnItemUpdated() {
+ UpdateAccessibleName();
UpdatePinnedState();
UpdateSnapshot();
if (ShouldUpdateControlButtonsColor())
« no previous file with comments | « ui/arc/notification/arc_custom_notification_view.h ('k') | ui/arc/notification/arc_notification_item.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698