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 CONTENT_BROWSER_ACCESSIBILITY_BROWSER_ACCESSIBILITY_MANAGER_H_ | 5 #ifndef CONTENT_BROWSER_ACCESSIBILITY_BROWSER_ACCESSIBILITY_MANAGER_H_ |
6 #define CONTENT_BROWSER_ACCESSIBILITY_BROWSER_ACCESSIBILITY_MANAGER_H_ | 6 #define CONTENT_BROWSER_ACCESSIBILITY_BROWSER_ACCESSIBILITY_MANAGER_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <memory> | 10 #include <memory> |
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
177 | 177 |
178 // Pretend that the given node has focus, for testing only. Doesn't | 178 // Pretend that the given node has focus, for testing only. Doesn't |
179 // communicate with the renderer and doesn't fire any events. | 179 // communicate with the renderer and doesn't fire any events. |
180 void SetFocusLocallyForTesting(BrowserAccessibility* node); | 180 void SetFocusLocallyForTesting(BrowserAccessibility* node); |
181 | 181 |
182 // For testing only, register a function to be called when focus changes | 182 // For testing only, register a function to be called when focus changes |
183 // in any BrowserAccessibilityManager. | 183 // in any BrowserAccessibilityManager. |
184 static void SetFocusChangeCallbackForTesting(const base::Closure& callback); | 184 static void SetFocusChangeCallbackForTesting(const base::Closure& callback); |
185 | 185 |
186 // Normally we avoid firing accessibility focus events when the containing | 186 // Normally we avoid firing accessibility focus events when the containing |
187 // native window isn't focused. However, this can lead to test flakiness | 187 // native window isn't focused, and we also delay some other events like |
188 // because we can't control when a window loses focus, so this provides a | 188 // live region events to improve screen reader compatibility. |
189 // way to disable that check for tests. | 189 // However, this can lead to test flakiness, so for testing, simplify |
190 static void NeverSuppressFocusEventsForTesting(); | 190 // this behavior and just fire all events with no delay as if the window |
| 191 // had focus. |
| 192 static void NeverSuppressOrDelayEventsForTesting(); |
191 | 193 |
192 // Accessibility actions. All of these are implemented asynchronously | 194 // Accessibility actions. All of these are implemented asynchronously |
193 // by sending a message to the renderer to perform the respective action | 195 // by sending a message to the renderer to perform the respective action |
194 // on the given node. See the definition of |ui::AXActionData| for more | 196 // on the given node. See the definition of |ui::AXActionData| for more |
195 // information about each of these actions. | 197 // information about each of these actions. |
196 void Decrement(const BrowserAccessibility& node); | 198 void Decrement(const BrowserAccessibility& node); |
197 void DoDefaultAction(const BrowserAccessibility& node); | 199 void DoDefaultAction(const BrowserAccessibility& node); |
198 void GetImageData(const BrowserAccessibility& node, | 200 void GetImageData(const BrowserAccessibility& node, |
199 const gfx::Size& max_size); | 201 const gfx::Size& max_size); |
200 void HitTest(const gfx::Point& point); | 202 void HitTest(const gfx::Point& point); |
(...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
485 int parent_node_id_from_parent_tree_; | 487 int parent_node_id_from_parent_tree_; |
486 | 488 |
487 // The device scale factor for the view associated with this frame, | 489 // The device scale factor for the view associated with this frame, |
488 // cached each time there's any update to the accessibility tree. | 490 // cached each time there's any update to the accessibility tree. |
489 float device_scale_factor_; | 491 float device_scale_factor_; |
490 | 492 |
491 // For testing only: If true, the manually-set device scale factor will be | 493 // For testing only: If true, the manually-set device scale factor will be |
492 // used and it won't be updated from the delegate. | 494 // used and it won't be updated from the delegate. |
493 bool use_custom_device_scale_factor_for_testing_; | 495 bool use_custom_device_scale_factor_for_testing_; |
494 | 496 |
| 497 // Fire all events regardless of focus and with no delay, to avoid test |
| 498 // flakiness. See NeverSuppressOrDelayEventsForTesting() for details. |
| 499 static bool never_suppress_or_delay_events_for_testing_; |
| 500 |
495 private: | 501 private: |
496 DISALLOW_COPY_AND_ASSIGN(BrowserAccessibilityManager); | 502 DISALLOW_COPY_AND_ASSIGN(BrowserAccessibilityManager); |
497 }; | 503 }; |
498 | 504 |
499 } // namespace content | 505 } // namespace content |
500 | 506 |
501 #endif // CONTENT_BROWSER_ACCESSIBILITY_BROWSER_ACCESSIBILITY_MANAGER_H_ | 507 #endif // CONTENT_BROWSER_ACCESSIBILITY_BROWSER_ACCESSIBILITY_MANAGER_H_ |
OLD | NEW |