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 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
66 bool has_submenu); | 66 bool has_submenu); |
67 | 67 |
68 private: | 68 private: |
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 bool IsAccessibilityEnabled(Profile* profile); |
| 77 |
76 // 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 |
77 // Send*Notification methods, below. | 79 // Send*Notification methods, below. |
78 void DispatchAccessibilityNotification( | 80 void DispatchAccessibilityNotification( |
79 views::View* view, NotificationType type); | 81 views::View* view, NotificationType type); |
80 | 82 |
81 // Return the name of a view. | 83 // Return the name of a view. |
82 std::string GetViewName(views::View* view); | 84 std::string GetViewName(views::View* view); |
83 | 85 |
84 // Each of these methods constructs an AccessibilityControlInfo object | 86 // Each of these methods constructs an AccessibilityControlInfo object |
85 // and sends a notification of a specific accessibility event. | 87 // and sends a notification of a specific accessibility event. |
(...skipping 18 matching lines...) Expand all Loading... |
104 bool IsMenuEvent(views::View* view, NotificationType type); | 106 bool IsMenuEvent(views::View* view, NotificationType type); |
105 | 107 |
106 // Recursively explore all menu items of |menu| and return in |count| | 108 // 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 | 109 // the total number of items, and in |index| the 0-based index of |
108 // |item|, if found. Initialize |count| to zero before calling this | 110 // |item|, if found. Initialize |count| to zero before calling this |
109 // method. |index| will be unchanged if the item is not found, so | 111 // method. |index| will be unchanged if the item is not found, so |
110 // initialize it to -1 to detect this case. | 112 // initialize it to -1 to detect this case. |
111 void RecursiveGetMenuItemIndexAndCount( | 113 void RecursiveGetMenuItemIndexAndCount( |
112 views::View* menu, views::View* item, int* index, int* count); | 114 views::View* menu, views::View* item, int* index, int* count); |
113 | 115 |
| 116 // Used for testing only. Overrides the accessibility enabled setting |
| 117 // so the test doesn't depend directly on the ExtensionService and |
| 118 // ExtensionAccessibilityEventRouter. |
| 119 void SetAccessibilityEnabledForTesting(bool enabled); |
| 120 |
114 // The profile associated with the most recent window event - used to | 121 // The profile associated with the most recent window event - used to |
115 // figure out where to route a few events that can't be directly traced | 122 // figure out where to route a few events that can't be directly traced |
116 // to a window with a profile (like menu events). | 123 // to a window with a profile (like menu events). |
117 Profile* most_recent_profile_; | 124 Profile* most_recent_profile_; |
118 | 125 |
119 // Used to defer handling of some events until the next time | 126 // Used to defer handling of some events until the next time |
120 // through the event loop. | 127 // through the event loop. |
121 ScopedRunnableMethodFactory<AccessibilityEventRouterViews> method_factory_; | 128 ScopedRunnableMethodFactory<AccessibilityEventRouterViews> method_factory_; |
| 129 |
| 130 // Used for testing only, with SetAccessibilityEnabledForTesting. |
| 131 bool accessibility_enabled_overridden_for_testing_; |
| 132 bool accessibility_enabled_override_value_; |
122 }; | 133 }; |
123 | 134 |
124 #endif // CHROME_BROWSER_UI_VIEWS_ACCESSIBILITY_EVENT_ROUTER_VIEWS_H_ | 135 #endif // CHROME_BROWSER_UI_VIEWS_ACCESSIBILITY_EVENT_ROUTER_VIEWS_H_ |
OLD | NEW |