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

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

Issue 393033006: Added tab notification to accessibility_event_router_views. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: GetTabCount returns 1 in test class 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
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"
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after
202 SendTextfieldNotification(view, type, profile); 202 SendTextfieldNotification(view, type, profile);
203 break; 203 break;
204 case ui::AX_ROLE_MENU_ITEM: 204 case ui::AX_ROLE_MENU_ITEM:
205 SendMenuItemNotification(view, type, profile); 205 SendMenuItemNotification(view, type, profile);
206 break; 206 break;
207 case ui::AX_ROLE_RADIO_BUTTON: 207 case ui::AX_ROLE_RADIO_BUTTON:
208 // Not used anymore? 208 // Not used anymore?
209 case ui::AX_ROLE_SLIDER: 209 case ui::AX_ROLE_SLIDER:
210 SendSliderNotification(view, type, profile); 210 SendSliderNotification(view, type, profile);
211 break; 211 break;
212 case ui::AX_ROLE_TAB:
213 SendTabNotification(view, type, profile);
214 break;
212 case ui::AX_ROLE_TREE: 215 case ui::AX_ROLE_TREE:
213 SendTreeNotification(view, type, profile); 216 SendTreeNotification(view, type, profile);
214 break; 217 break;
215 case ui::AX_ROLE_TREE_ITEM: 218 case ui::AX_ROLE_TREE_ITEM:
216 SendTreeItemNotification(view, type, profile); 219 SendTreeItemNotification(view, type, profile);
217 break; 220 break;
218 default: 221 default:
219 // Hover events can fire on literally any view, so it's safe to 222 // Hover events can fire on literally any view, so it's safe to
220 // ignore ones we don't care about. 223 // ignore ones we don't care about.
221 if (type == ui::AX_EVENT_HOVER) 224 if (type == ui::AX_EVENT_HOVER)
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
279 count = 0; 282 count = 0;
280 RecursiveGetMenuItemIndexAndCount(parent_menu, view, &index, &count); 283 RecursiveGetMenuItemIndexAndCount(parent_menu, view, &index, &count);
281 } 284 }
282 285
283 AccessibilityMenuItemInfo info( 286 AccessibilityMenuItemInfo info(
284 profile, name, context, has_submenu, index, count); 287 profile, name, context, has_submenu, index, count);
285 SendControlAccessibilityNotification(event, &info); 288 SendControlAccessibilityNotification(event, &info);
286 } 289 }
287 290
288 // static 291 // static
292 void AccessibilityEventRouterViews::SendTabNotification(
293 views::View* view,
294 ui::AXEvent event,
295 Profile* profile) {
296 ui::AXViewState state;
297 view->GetAccessibleState(&state);
298 std::string name = base::UTF16ToUTF8(state.name);
299 std::string context = GetViewContext(view);
Peter Kasting 2014/07/16 23:40:54 Nit: I suggest inlining these two below to avoid t
evy 2014/07/21 17:54:15 This pattern was actually copied from another func
Peter Kasting 2014/07/21 19:06:07 You can if you want. It doesn't matter much to me
300 AccessibilityTabInfo info(profile, name, context, state.index, state.count);
301 SendControlAccessibilityNotification(event, &info);
302 }
303
304 // static
289 void AccessibilityEventRouterViews::SendTreeNotification( 305 void AccessibilityEventRouterViews::SendTreeNotification(
290 views::View* view, 306 views::View* view,
291 ui::AXEvent event, 307 ui::AXEvent event,
292 Profile* profile) { 308 Profile* profile) {
293 AccessibilityTreeInfo info(profile, GetViewName(view)); 309 AccessibilityTreeInfo info(profile, GetViewName(view));
294 SendControlAccessibilityNotification(event, &info); 310 SendControlAccessibilityNotification(event, &info);
295 } 311 }
296 312
297 // static 313 // static
298 void AccessibilityEventRouterViews::SendTreeItemNotification( 314 void AccessibilityEventRouterViews::SendTreeItemNotification(
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after
545 return base::UTF16ToUTF8(state.name); 561 return base::UTF16ToUTF8(state.name);
546 562
547 for (int i = 0; i < view->child_count(); ++i) { 563 for (int i = 0; i < view->child_count(); ++i) {
548 views::View* child = view->child_at(i); 564 views::View* child = view->child_at(i);
549 std::string result = RecursiveGetStaticText(child); 565 std::string result = RecursiveGetStaticText(child);
550 if (!result.empty()) 566 if (!result.empty())
551 return result; 567 return result;
552 } 568 }
553 return std::string(); 569 return std::string();
554 } 570 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698