| 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 #ifndef CHROME_BROWSER_UI_VIEWS_ACCESSIBILITY_ACCESSIBILITY_EVENT_ROUTER_VIEWS_H
_ | 5 #ifndef CHROME_BROWSER_UI_VIEWS_ACCESSIBILITY_ACCESSIBILITY_EVENT_ROUTER_VIEWS_H
_ |
| 6 #define CHROME_BROWSER_UI_VIEWS_ACCESSIBILITY_ACCESSIBILITY_EVENT_ROUTER_VIEWS_H
_ | 6 #define CHROME_BROWSER_UI_VIEWS_ACCESSIBILITY_ACCESSIBILITY_EVENT_ROUTER_VIEWS_H
_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 63 | 63 |
| 64 private: | 64 private: |
| 65 friend struct DefaultSingletonTraits<AccessibilityEventRouterViews>; | 65 friend struct DefaultSingletonTraits<AccessibilityEventRouterViews>; |
| 66 | 66 |
| 67 FRIEND_TEST_ALL_PREFIXES(AccessibilityEventRouterViewsTest, | 67 FRIEND_TEST_ALL_PREFIXES(AccessibilityEventRouterViewsTest, |
| 68 TestFocusNotification); | 68 TestFocusNotification); |
| 69 | 69 |
| 70 AccessibilityEventRouterViews(); | 70 AccessibilityEventRouterViews(); |
| 71 virtual ~AccessibilityEventRouterViews(); | 71 virtual ~AccessibilityEventRouterViews(); |
| 72 | 72 |
| 73 // Call DispatchAccessibilityNotification using a view storage id. | 73 // Call DispatchAccessibilityEvent using a view storage id. |
| 74 static void DispatchNotificationOnViewStorageId( | 74 static void DispatchEventOnViewStorageId( |
| 75 int view_storage_id, | 75 int view_storage_id, |
| 76 chrome::NotificationType type); | 76 ui::AccessibilityTypes::Event type); |
| 77 | 77 |
| 78 // Checks the type of the view and calls one of the more specific | 78 // Checks the type of the view and calls one of the more specific |
| 79 // Send*Notification methods, below. | 79 // Send*Notification methods, below. |
| 80 void DispatchAccessibilityNotification( | 80 void DispatchAccessibilityEvent( |
| 81 views::View* view, | 81 views::View* view, |
| 82 chrome::NotificationType type); | 82 ui::AccessibilityTypes::Event type); |
| 83 | 83 |
| 84 // Each of these methods constructs an AccessibilityControlInfo object | 84 // Each of these methods constructs an AccessibilityControlInfo object |
| 85 // and sends a notification of a specific accessibility event. | 85 // and sends a notification of a specific accessibility event. |
| 86 static void SendButtonNotification( | 86 static void SendButtonNotification( |
| 87 views::View* view, | 87 views::View* view, |
| 88 int type, | 88 ui::AccessibilityTypes::Event type, |
| 89 Profile* profile); | 89 Profile* profile); |
| 90 static void SendLinkNotification( | 90 static void SendLinkNotification( |
| 91 views::View* view, | 91 views::View* view, |
| 92 int type, | 92 ui::AccessibilityTypes::Event type, |
| 93 Profile* profile); | 93 Profile* profile); |
| 94 static void SendMenuNotification( | 94 static void SendMenuNotification( |
| 95 views::View* view, | 95 views::View* view, |
| 96 int type, | 96 ui::AccessibilityTypes::Event type, |
| 97 Profile* profile); | 97 Profile* profile); |
| 98 static void SendMenuItemNotification( | 98 static void SendMenuItemNotification( |
| 99 views::View* view, | 99 views::View* view, |
| 100 int type, | 100 ui::AccessibilityTypes::Event type, |
| 101 Profile* profile); | 101 Profile* profile); |
| 102 static void SendTextfieldNotification( | 102 static void SendTextfieldNotification( |
| 103 views::View* view, | 103 views::View* view, |
| 104 int type, | 104 ui::AccessibilityTypes::Event type, |
| 105 Profile* profile); | 105 Profile* profile); |
| 106 static void SendComboboxNotification( | 106 static void SendComboboxNotification( |
| 107 views::View* view, | 107 views::View* view, |
| 108 int type, | 108 ui::AccessibilityTypes::Event type, |
| 109 Profile* profile); | 109 Profile* profile); |
| 110 static void SendCheckboxNotification( | 110 static void SendCheckboxNotification( |
| 111 views::View* view, | 111 views::View* view, |
| 112 int type, | 112 ui::AccessibilityTypes::Event type, |
| 113 Profile* profile); | 113 Profile* profile); |
| 114 static void SendWindowNotification( | 114 static void SendWindowNotification( |
| 115 views::View* view, | 115 views::View* view, |
| 116 int type, | 116 ui::AccessibilityTypes::Event type, |
| 117 Profile* profile); | 117 Profile* profile); |
| 118 static void SendSliderNotification( | 118 static void SendSliderNotification( |
| 119 views::View* view, | 119 views::View* view, |
| 120 int type, | 120 ui::AccessibilityTypes::Event type, |
| 121 Profile* profile); | 121 Profile* profile); |
| 122 | 122 |
| 123 // Return the name of a view. | 123 // Return the name of a view. |
| 124 static std::string GetViewName(views::View* view); | 124 static std::string GetViewName(views::View* view); |
| 125 | 125 |
| 126 // Get the context of a view - the name of the enclosing group, toolbar, etc. | 126 // Get the context of a view - the name of the enclosing group, toolbar, etc. |
| 127 static std::string GetViewContext(views::View* view); | 127 static std::string GetViewContext(views::View* view); |
| 128 | 128 |
| 129 // Return a descendant of this view with a given accessible role, if found. | 129 // Return a descendant of this view with a given accessible role, if found. |
| 130 static views::View* FindDescendantWithAccessibleRole( | 130 static views::View* FindDescendantWithAccessibleRole( |
| 131 views::View* view, | 131 views::View* view, |
| 132 ui::AccessibilityTypes::Role role); | 132 ui::AccessibilityTypes::Role role); |
| 133 | 133 |
| 134 // Return true if it's an event on a menu. | |
| 135 static bool IsMenuEvent(views::View* view, | |
| 136 int type); | |
| 137 | |
| 138 // Recursively explore all menu items of |menu| and return in |count| | 134 // Recursively explore all menu items of |menu| and return in |count| |
| 139 // the total number of items, and in |index| the 0-based index of | 135 // the total number of items, and in |index| the 0-based index of |
| 140 // |item|, if found. Initialize |count| to zero before calling this | 136 // |item|, if found. Initialize |count| to zero before calling this |
| 141 // method. |index| will be unchanged if the item is not found, so | 137 // method. |index| will be unchanged if the item is not found, so |
| 142 // initialize it to -1 to detect this case. | 138 // initialize it to -1 to detect this case. |
| 143 static void RecursiveGetMenuItemIndexAndCount(views::View* menu, | 139 static void RecursiveGetMenuItemIndexAndCount(views::View* menu, |
| 144 views::View* item, | 140 views::View* item, |
| 145 int* index, | 141 int* index, |
| 146 int* count); | 142 int* count); |
| 147 | 143 |
| 148 // Recursively explore the subviews and return the text from the first | 144 // Recursively explore the subviews and return the text from the first |
| 149 // subview with a role of STATIC_TEXT. | 145 // subview with a role of STATIC_TEXT. |
| 150 static std::string RecursiveGetStaticText(views::View* view); | 146 static std::string RecursiveGetStaticText(views::View* view); |
| 151 | 147 |
| 152 // The profile associated with the most recent window event - used to | 148 // The profile associated with the most recent window event - used to |
| 153 // figure out where to route a few events that can't be directly traced | 149 // figure out where to route a few events that can't be directly traced |
| 154 // to a window with a profile (like menu events). | 150 // to a window with a profile (like menu events). |
| 155 Profile* most_recent_profile_; | 151 Profile* most_recent_profile_; |
| 156 | 152 |
| 157 // Notification registrar so we can clear most_recent_profile_ when a | 153 // Notification registrar so we can clear most_recent_profile_ when a |
| 158 // profile is destroyed. | 154 // profile is destroyed. |
| 159 content::NotificationRegistrar registrar_; | 155 content::NotificationRegistrar registrar_; |
| 160 | 156 |
| 161 DISALLOW_COPY_AND_ASSIGN(AccessibilityEventRouterViews); | 157 DISALLOW_COPY_AND_ASSIGN(AccessibilityEventRouterViews); |
| 162 }; | 158 }; |
| 163 | 159 |
| 164 #endif // CHROME_BROWSER_UI_VIEWS_ACCESSIBILITY_ACCESSIBILITY_EVENT_ROUTER_VIEW
S_H_ | 160 #endif // CHROME_BROWSER_UI_VIEWS_ACCESSIBILITY_ACCESSIBILITY_EVENT_ROUTER_VIEW
S_H_ |
| OLD | NEW |