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

Side by Side Diff: chrome/browser/ui/views/accessibility/accessibility_event_router_views.cc

Issue 380943002: Added battery level and time to the status tray's accessible name. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 5 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 | « chrome/browser/ui/views/accessibility/accessibility_event_router_views.h ('k') | no next file » | 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 "chrome/browser/ui/views/accessibility/accessibility_event_router_views .h" 5 #include "chrome/browser/ui/views/accessibility/accessibility_event_router_views .h"
6 6
7 #include "base/basictypes.h" 7 #include "base/basictypes.h"
8 #include "base/callback.h" 8 #include "base/callback.h"
9 #include "base/memory/singleton.h" 9 #include "base/memory/singleton.h"
10 #include "base/message_loop/message_loop.h" 10 #include "base/message_loop/message_loop.h"
11 #include "base/strings/utf_string_conversions.h" 11 #include "base/strings/utf_string_conversions.h"
12 #include "chrome/browser/accessibility/accessibility_extension_api.h" 12 #include "chrome/browser/accessibility/accessibility_extension_api.h"
13 #include "chrome/browser/browser_process.h" 13 #include "chrome/browser/browser_process.h"
14 #include "chrome/browser/chrome_notification_types.h" 14 #include "chrome/browser/chrome_notification_types.h"
15 #include "chrome/browser/profiles/profile.h" 15 #include "chrome/browser/profiles/profile.h"
16 #include "chrome/browser/profiles/profile_manager.h" 16 #include "chrome/browser/profiles/profile_manager.h"
17 #include "content/public/browser/notification_service.h" 17 #include "content/public/browser/notification_service.h"
18 #include "ui/accessibility/ax_view_state.h" 18 #include "ui/accessibility/ax_view_state.h"
19 #include "ui/views/controls/menu/menu_item_view.h" 19 #include "ui/views/controls/menu/menu_item_view.h"
20 #include "ui/views/controls/menu/submenu_view.h" 20 #include "ui/views/controls/menu/submenu_view.h"
21 #include "ui/views/controls/tree/tree_view.h" 21 #include "ui/views/controls/tree/tree_view.h"
22 #include "ui/views/focus/view_storage.h" 22 #include "ui/views/focus/view_storage.h"
23 #include "ui/views/view.h" 23 #include "ui/views/view.h"
24 #include "ui/views/widget/widget.h" 24 #include "ui/views/widget/widget.h"
25 25
26 using views::FocusManager; 26 using views::FocusManager;
27 27
28 AccessibilityEventRouterViews::AccessibilityEventRouterViews() 28 AccessibilityEventRouterViews::AccessibilityEventRouterViews()
29 : most_recent_profile_(NULL) { 29 : most_recent_profile_(NULL),
30 most_recent_view_(NULL) {
30 // Register for notification when profile is destroyed to ensure that all 31 // Register for notification when profile is destroyed to ensure that all
31 // observers are detatched at that time. 32 // observers are detatched at that time.
32 registrar_.Add(this, chrome::NOTIFICATION_PROFILE_DESTROYED, 33 registrar_.Add(this, chrome::NOTIFICATION_PROFILE_DESTROYED,
33 content::NotificationService::AllSources()); 34 content::NotificationService::AllSources());
34 } 35 }
35 36
36 AccessibilityEventRouterViews::~AccessibilityEventRouterViews() { 37 AccessibilityEventRouterViews::~AccessibilityEventRouterViews() {
37 } 38 }
38 39
39 // static 40 // static
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
156 most_recent_profile_ = profile; 157 most_recent_profile_ = profile;
157 158
158 if (type == ui::AX_EVENT_MENU_START || 159 if (type == ui::AX_EVENT_MENU_START ||
159 type == ui::AX_EVENT_MENU_POPUP_START || 160 type == ui::AX_EVENT_MENU_POPUP_START ||
160 type == ui::AX_EVENT_MENU_END || 161 type == ui::AX_EVENT_MENU_END ||
161 type == ui::AX_EVENT_MENU_POPUP_END) { 162 type == ui::AX_EVENT_MENU_POPUP_END) {
162 SendMenuNotification(view, type, profile); 163 SendMenuNotification(view, type, profile);
163 return; 164 return;
164 } 165 }
165 166
167 // The highest focusable view is processed to handle cases where there are
sky 2014/07/11 15:44:02 It's not clear to me why you want the highest focu
dmazzoni 2014/07/11 16:11:38 If a view is focusable, it's usually atomic wrt ac
sky 2014/07/11 19:06:08 What mechanism does the status tray button use to
evy 2014/07/12 00:32:50 Aha. If I go to the next highest accessibility foc
168 // views inside other focusable views (e.g. hover for date text on the
169 // status bar) and the status bar information should be read instead
sky 2014/07/11 15:44:02 nit: you've got an extra space at the beginning.
evy 2014/07/11 18:15:10 Done.
170 // of the specific button inside. Here |view| is updated its highest
171 // focusable ancestor.
172 views::View* temp_view = view;
173 while (temp_view->parent()) {
174 temp_view = temp_view->parent();
175 if (temp_view->IsFocusable()) {
dmazzoni 2014/07/10 23:25:58 Nit: in C++, braces aren't needed when the "if" co
evy 2014/07/11 18:15:10 Done.
176 view = temp_view;
177 }
178 }
179
180 // Since multiple items could share a highest focusable view, these items
181 // could all dispatch the same accessibility hover events, which isn't
182 // necessary.
183 if (type == ui::AX_EVENT_HOVER && most_recent_view_ == view)
184 return;
185 most_recent_view_ = view;
sky 2014/07/11 15:44:02 I don't see this ever set to NULL. What if most_re
dmazzoni 2014/07/11 16:11:38 It should be harmless because all we ever do is te
sky 2014/07/11 19:06:08 Two concerns: there is nothing stopping the pointe
evy 2014/07/12 00:32:50 Done.
186
166 ui::AXViewState state; 187 ui::AXViewState state;
167 view->GetAccessibleState(&state); 188 view->GetAccessibleState(&state);
168 189
169 if (type == ui::AX_EVENT_ALERT && 190 if (type == ui::AX_EVENT_ALERT &&
170 !(state.role == ui::AX_ROLE_ALERT || 191 !(state.role == ui::AX_ROLE_ALERT ||
171 state.role == ui::AX_ROLE_WINDOW)) { 192 state.role == ui::AX_ROLE_WINDOW)) {
172 SendAlertControlNotification(view, type, profile); 193 SendAlertControlNotification(view, type, profile);
173 return; 194 return;
174 } 195 }
175 196
(...skipping 369 matching lines...) Expand 10 before | Expand all | Expand 10 after
545 return base::UTF16ToUTF8(state.name); 566 return base::UTF16ToUTF8(state.name);
546 567
547 for (int i = 0; i < view->child_count(); ++i) { 568 for (int i = 0; i < view->child_count(); ++i) {
548 views::View* child = view->child_at(i); 569 views::View* child = view->child_at(i);
549 std::string result = RecursiveGetStaticText(child); 570 std::string result = RecursiveGetStaticText(child);
550 if (!result.empty()) 571 if (!result.empty())
551 return result; 572 return result;
552 } 573 }
553 return std::string(); 574 return std::string();
554 } 575 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/accessibility/accessibility_event_router_views.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698