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 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
69 AccessibilityEventRouterViews(); | 69 AccessibilityEventRouterViews(); |
70 virtual ~AccessibilityEventRouterViews(); | 70 virtual ~AccessibilityEventRouterViews(); |
71 | 71 |
72 friend struct DefaultSingletonTraits<AccessibilityEventRouterViews>; | 72 friend struct DefaultSingletonTraits<AccessibilityEventRouterViews>; |
73 FRIEND_TEST_ALL_PREFIXES(AccessibilityEventRouterViewsTest, | 73 FRIEND_TEST_ALL_PREFIXES(AccessibilityEventRouterViewsTest, |
74 TestFocusNotification); | 74 TestFocusNotification); |
75 | 75 |
76 // Checks the type of the view and calls one of the more specific | 76 // Checks the type of the view and calls one of the more specific |
77 // Send*Notification methods, below. | 77 // Send*Notification methods, below. |
78 void DispatchAccessibilityNotification( | 78 void DispatchAccessibilityNotification( |
79 views::View* view, NotificationType type); | 79 views::View* view, int type); |
80 | 80 |
81 // Each of these methods constructs an AccessibilityControlInfo object | 81 // Each of these methods constructs an AccessibilityControlInfo object |
82 // and sends a notification of a specific accessibility event. | 82 // and sends a notification of a specific accessibility event. |
83 void SendButtonNotification( | 83 void SendButtonNotification( |
84 views::View* view, NotificationType type, Profile* profile); | 84 views::View* view, int type, Profile* profile); |
85 void SendLinkNotification( | 85 void SendLinkNotification( |
86 views::View* view, NotificationType type, Profile* profile); | 86 views::View* view, int type, Profile* profile); |
87 void SendMenuNotification( | 87 void SendMenuNotification( |
88 views::View* view, NotificationType type, Profile* profile); | 88 views::View* view, int type, Profile* profile); |
89 void SendMenuItemNotification( | 89 void SendMenuItemNotification( |
90 views::View* view, NotificationType type, Profile* profile); | 90 views::View* view, int type, Profile* profile); |
91 void SendTextfieldNotification( | 91 void SendTextfieldNotification( |
92 views::View* view, NotificationType type, Profile* profile); | 92 views::View* view, int type, Profile* profile); |
93 void SendComboboxNotification( | 93 void SendComboboxNotification( |
94 views::View* view, NotificationType type, Profile* profile); | 94 views::View* view, int type, Profile* profile); |
95 void SendCheckboxNotification( | 95 void SendCheckboxNotification( |
96 views::View* view, NotificationType type, Profile* profile); | 96 views::View* view, int type, Profile* profile); |
97 void SendWindowNotification( | 97 void SendWindowNotification( |
98 views::View* view, NotificationType type, Profile* profile); | 98 views::View* view, int type, Profile* profile); |
99 | 99 |
100 // Return the name of a view. | 100 // Return the name of a view. |
101 std::string GetViewName(views::View* view); | 101 std::string GetViewName(views::View* view); |
102 | 102 |
103 // Return true if it's an event on a menu. | 103 // Return true if it's an event on a menu. |
104 bool IsMenuEvent(views::View* view, NotificationType type); | 104 bool IsMenuEvent(views::View* view, int type); |
105 | 105 |
106 // Recursively explore all menu items of |menu| and return in |count| | 106 // Recursively explore all menu items of |menu| and return in |count| |
107 // the total number of items, and in |index| the 0-based index of | 107 // the total number of items, and in |index| the 0-based index of |
108 // |item|, if found. Initialize |count| to zero before calling this | 108 // |item|, if found. Initialize |count| to zero before calling this |
109 // method. |index| will be unchanged if the item is not found, so | 109 // method. |index| will be unchanged if the item is not found, so |
110 // initialize it to -1 to detect this case. | 110 // initialize it to -1 to detect this case. |
111 void RecursiveGetMenuItemIndexAndCount( | 111 void RecursiveGetMenuItemIndexAndCount( |
112 views::View* menu, views::View* item, int* index, int* count); | 112 views::View* menu, views::View* item, int* index, int* count); |
113 | 113 |
114 // Recursively explore the subviews and return the text from the first | 114 // Recursively explore the subviews and return the text from the first |
115 // subview with a role of STATIC_TEXT. | 115 // subview with a role of STATIC_TEXT. |
116 std::string RecursiveGetStaticText(views::View* view); | 116 std::string RecursiveGetStaticText(views::View* view); |
117 | 117 |
118 // The profile associated with the most recent window event - used to | 118 // The profile associated with the most recent window event - used to |
119 // figure out where to route a few events that can't be directly traced | 119 // figure out where to route a few events that can't be directly traced |
120 // to a window with a profile (like menu events). | 120 // to a window with a profile (like menu events). |
121 Profile* most_recent_profile_; | 121 Profile* most_recent_profile_; |
122 | 122 |
123 // Used to defer handling of some events until the next time | 123 // Used to defer handling of some events until the next time |
124 // through the event loop. | 124 // through the event loop. |
125 ScopedRunnableMethodFactory<AccessibilityEventRouterViews> method_factory_; | 125 ScopedRunnableMethodFactory<AccessibilityEventRouterViews> method_factory_; |
126 }; | 126 }; |
127 | 127 |
128 #endif // CHROME_BROWSER_UI_VIEWS_ACCESSIBILITY_EVENT_ROUTER_VIEWS_H_ | 128 #endif // CHROME_BROWSER_UI_VIEWS_ACCESSIBILITY_EVENT_ROUTER_VIEWS_H_ |
OLD | NEW |