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

Side by Side Diff: ui/message_center/views/message_view.cc

Issue 2918483002: Add an accessibility description for notification (Closed)
Patch Set: Use a11y description instead of rule Created 3 years, 6 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 unified diff | Download patch
« no previous file with comments | « ui/arc/notification/arc_notification_content_view.cc ('k') | ui/strings/ui_strings.grd » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ui/message_center/views/message_view.h" 5 #include "ui/message_center/views/message_view.h"
6 6
7 #include "base/strings/utf_string_conversions.h" 7 #include "base/strings/utf_string_conversions.h"
8 #include "ui/accessibility/ax_node_data.h" 8 #include "ui/accessibility/ax_node_data.h"
9 #include "ui/base/l10n/l10n_util.h" 9 #include "ui/base/l10n/l10n_util.h"
10 #include "ui/base/models/simple_menu_model.h" 10 #include "ui/base/models/simple_menu_model.h"
11 #include "ui/compositor/scoped_layer_animation_settings.h" 11 #include "ui/compositor/scoped_layer_animation_settings.h"
12 #include "ui/gfx/canvas.h" 12 #include "ui/gfx/canvas.h"
13 #include "ui/gfx/image/image_skia_operations.h" 13 #include "ui/gfx/image/image_skia_operations.h"
14 #include "ui/gfx/shadow_util.h" 14 #include "ui/gfx/shadow_util.h"
15 #include "ui/gfx/shadow_value.h" 15 #include "ui/gfx/shadow_value.h"
16 #include "ui/message_center/message_center.h" 16 #include "ui/message_center/message_center.h"
17 #include "ui/message_center/message_center_style.h" 17 #include "ui/message_center/message_center_style.h"
18 #include "ui/message_center/views/message_center_controller.h" 18 #include "ui/message_center/views/message_center_controller.h"
19 #include "ui/strings/grit/ui_strings.h"
19 #include "ui/views/background.h" 20 #include "ui/views/background.h"
20 #include "ui/views/border.h" 21 #include "ui/views/border.h"
21 #include "ui/views/controls/button/image_button.h" 22 #include "ui/views/controls/button/image_button.h"
22 #include "ui/views/controls/image_view.h" 23 #include "ui/views/controls/image_view.h"
23 #include "ui/views/controls/scroll_view.h" 24 #include "ui/views/controls/scroll_view.h"
24 #include "ui/views/focus/focus_manager.h" 25 #include "ui/views/focus/focus_manager.h"
25 #include "ui/views/painter.h" 26 #include "ui/views/painter.h"
26 #include "ui/views/widget/widget.h" 27 #include "ui/views/widget/widget.h"
27 28
28 namespace { 29 namespace {
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 gfx::Insets ninebox_insets = gfx::ShadowValue::GetBlurRegion(shadow.values) + 108 gfx::Insets ninebox_insets = gfx::ShadowValue::GetBlurRegion(shadow.values) +
108 gfx::Insets(kShadowCornerRadius); 109 gfx::Insets(kShadowCornerRadius);
109 SetBorder(views::CreateBorderPainter( 110 SetBorder(views::CreateBorderPainter(
110 std::unique_ptr<views::Painter>(views::Painter::CreateImagePainter( 111 std::unique_ptr<views::Painter>(views::Painter::CreateImagePainter(
111 shadow.ninebox_image, ninebox_insets)), 112 shadow.ninebox_image, ninebox_insets)),
112 -gfx::ShadowValue::GetMargin(shadow.values))); 113 -gfx::ShadowValue::GetMargin(shadow.values)));
113 } 114 }
114 115
115 void MessageView::GetAccessibleNodeData(ui::AXNodeData* node_data) { 116 void MessageView::GetAccessibleNodeData(ui::AXNodeData* node_data) {
116 node_data->role = ui::AX_ROLE_BUTTON; 117 node_data->role = ui::AX_ROLE_BUTTON;
118 node_data->AddStringAttribute(
119 ui::AX_ATTR_ROLE_DESCRIPTION,
120 l10n_util::GetStringUTF8(
121 IDS_MESSAGE_NOTIFICATION_SETTINGS_BUTTON_ACCESSIBLE_NAME));
117 node_data->SetName(accessible_name_); 122 node_data->SetName(accessible_name_);
118 } 123 }
119 124
120 bool MessageView::OnMousePressed(const ui::MouseEvent& event) { 125 bool MessageView::OnMousePressed(const ui::MouseEvent& event) {
121 if (!event.IsOnlyLeftMouseButton()) 126 if (!event.IsOnlyLeftMouseButton())
122 return false; 127 return false;
123 128
124 controller_->ClickOnNotification(notification_id_); 129 controller_->ClickOnNotification(notification_id_);
125 return true; 130 return true;
126 } 131 }
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
231 } 236 }
232 237
233 void MessageView::SetDrawBackgroundAsActive(bool active) { 238 void MessageView::SetDrawBackgroundAsActive(bool active) {
234 background_view_->background()-> 239 background_view_->background()->
235 SetNativeControlColor(active ? kHoveredButtonBackgroundColor : 240 SetNativeControlColor(active ? kHoveredButtonBackgroundColor :
236 kNotificationBackgroundColor); 241 kNotificationBackgroundColor);
237 SchedulePaint(); 242 SchedulePaint();
238 } 243 }
239 244
240 } // namespace message_center 245 } // namespace message_center
OLDNEW
« no previous file with comments | « ui/arc/notification/arc_notification_content_view.cc ('k') | ui/strings/ui_strings.grd » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698