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