| OLD | NEW |
| 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 Loading... |
| 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_STATIC_TEXT: |
| 213 SendStaticTextNotification(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) |
| 222 break; | 225 break; |
| 223 | 226 |
| 224 // If this is encountered, please file a bug with the role that wasn't | 227 // If this is encountered, please file a bug with the role that wasn't |
| 225 // caught so we can add accessibility extension API support. | 228 // caught so we can add accessibility extension API support. |
| 226 NOTREACHED(); | 229 NOTREACHED(); |
| 227 } | 230 } |
| 228 } | 231 } |
| 229 | 232 |
| 230 // static | 233 // static |
| 231 void AccessibilityEventRouterViews::SendButtonNotification( | 234 void AccessibilityEventRouterViews::SendButtonNotification( |
| 232 views::View* view, | 235 views::View* view, |
| 233 ui::AXEvent event, | 236 ui::AXEvent event, |
| 234 Profile* profile) { | 237 Profile* profile) { |
| 235 AccessibilityButtonInfo info( | 238 AccessibilityButtonInfo info( |
| 236 profile, GetViewName(view), GetViewContext(view)); | 239 profile, GetViewName(view), GetViewContext(view)); |
| 237 SendControlAccessibilityNotification(event, &info); | 240 SendControlAccessibilityNotification(event, &info); |
| 238 } | 241 } |
| 239 | 242 |
| 240 // static | 243 // static |
| 244 void AccessibilityEventRouterViews::SendStaticTextNotification( |
| 245 views::View* view, |
| 246 ui::AXEvent event, |
| 247 Profile* profile) { |
| 248 AccessibilityStaticTextInfo info( |
| 249 profile, GetViewName(view), GetViewContext(view)); |
| 250 SendControlAccessibilityNotification(event, &info); |
| 251 } |
| 252 |
| 253 // static |
| 241 void AccessibilityEventRouterViews::SendLinkNotification( | 254 void AccessibilityEventRouterViews::SendLinkNotification( |
| 242 views::View* view, | 255 views::View* view, |
| 243 ui::AXEvent event, | 256 ui::AXEvent event, |
| 244 Profile* profile) { | 257 Profile* profile) { |
| 245 AccessibilityLinkInfo info(profile, GetViewName(view), GetViewContext(view)); | 258 AccessibilityLinkInfo info(profile, GetViewName(view), GetViewContext(view)); |
| 246 SendControlAccessibilityNotification(event, &info); | 259 SendControlAccessibilityNotification(event, &info); |
| 247 } | 260 } |
| 248 | 261 |
| 249 // static | 262 // static |
| 250 void AccessibilityEventRouterViews::SendMenuNotification( | 263 void AccessibilityEventRouterViews::SendMenuNotification( |
| (...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 545 return base::UTF16ToUTF8(state.name); | 558 return base::UTF16ToUTF8(state.name); |
| 546 | 559 |
| 547 for (int i = 0; i < view->child_count(); ++i) { | 560 for (int i = 0; i < view->child_count(); ++i) { |
| 548 views::View* child = view->child_at(i); | 561 views::View* child = view->child_at(i); |
| 549 std::string result = RecursiveGetStaticText(child); | 562 std::string result = RecursiveGetStaticText(child); |
| 550 if (!result.empty()) | 563 if (!result.empty()) |
| 551 return result; | 564 return result; |
| 552 } | 565 } |
| 553 return std::string(); | 566 return std::string(); |
| 554 } | 567 } |
| OLD | NEW |