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 <vector> | 10 #include <vector> |
11 | 11 |
| 12 #include "base/callback_forward.h" |
12 #include "base/containers/hash_tables.h" | 13 #include "base/containers/hash_tables.h" |
13 #include "base/macros.h" | 14 #include "base/macros.h" |
14 #include "base/memory/scoped_ptr.h" | 15 #include "base/memory/scoped_ptr.h" |
15 #include "build/build_config.h" | 16 #include "build/build_config.h" |
16 #include "content/browser/accessibility/ax_tree_id_registry.h" | 17 #include "content/browser/accessibility/ax_tree_id_registry.h" |
17 #include "content/common/content_export.h" | 18 #include "content/common/content_export.h" |
18 #include "content/public/browser/ax_event_notification_details.h" | 19 #include "content/public/browser/ax_event_notification_details.h" |
19 #include "third_party/WebKit/public/web/WebAXEnums.h" | 20 #include "third_party/WebKit/public/web/WebAXEnums.h" |
20 #include "ui/accessibility/ax_node_data.h" | 21 #include "ui/accessibility/ax_node_data.h" |
21 #include "ui/accessibility/ax_serializable_tree.h" | 22 #include "ui/accessibility/ax_serializable_tree.h" |
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
189 // occurred in the tab. | 190 // occurred in the tab. |
190 void GotMouseDown(); | 191 void GotMouseDown(); |
191 | 192 |
192 // Send a message to the renderer to set focus to this node. | 193 // Send a message to the renderer to set focus to this node. |
193 void SetFocus(const BrowserAccessibility& node); | 194 void SetFocus(const BrowserAccessibility& node); |
194 | 195 |
195 // Pretend that the given node has focus, for testing only. Doesn't | 196 // Pretend that the given node has focus, for testing only. Doesn't |
196 // communicate with the renderer and doesn't fire any events. | 197 // communicate with the renderer and doesn't fire any events. |
197 void SetFocusLocallyForTesting(BrowserAccessibility* node); | 198 void SetFocusLocallyForTesting(BrowserAccessibility* node); |
198 | 199 |
| 200 // For testing only, register a function to be called when focus changes |
| 201 // in any BrowserAccessibilityManager. |
| 202 static void SetFocusChangeCallbackForTesting(const base::Closure& callback); |
| 203 |
199 // Tell the renderer to do the default action for this node. | 204 // Tell the renderer to do the default action for this node. |
200 void DoDefaultAction(const BrowserAccessibility& node); | 205 void DoDefaultAction(const BrowserAccessibility& node); |
201 | 206 |
202 // Tell the renderer to scroll to make |node| visible. | 207 // Tell the renderer to scroll to make |node| visible. |
203 // In addition, if it's not possible to make the entire object visible, | 208 // In addition, if it's not possible to make the entire object visible, |
204 // scroll so that the |subfocus| rect is visible at least. The subfocus | 209 // scroll so that the |subfocus| rect is visible at least. The subfocus |
205 // rect is in local coordinates of the object itself. | 210 // rect is in local coordinates of the object itself. |
206 void ScrollToMakeVisible( | 211 void ScrollToMakeVisible( |
207 const BrowserAccessibility& node, gfx::Rect subfocus); | 212 const BrowserAccessibility& node, gfx::Rect subfocus); |
208 | 213 |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
259 | 264 |
260 #if defined(OS_ANDROID) | 265 #if defined(OS_ANDROID) |
261 BrowserAccessibilityManagerAndroid* ToBrowserAccessibilityManagerAndroid(); | 266 BrowserAccessibilityManagerAndroid* ToBrowserAccessibilityManagerAndroid(); |
262 #endif | 267 #endif |
263 | 268 |
264 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) && defined(USE_X11) | 269 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) && defined(USE_X11) |
265 BrowserAccessibilityManagerAuraLinux* | 270 BrowserAccessibilityManagerAuraLinux* |
266 ToBrowserAccessibilityManagerAuraLinux(); | 271 ToBrowserAccessibilityManagerAuraLinux(); |
267 #endif | 272 #endif |
268 | 273 |
269 // Return the object that has focus. | 274 // Return the object that has focus, starting at the top of the frame tree. |
270 virtual BrowserAccessibility* GetFocus(); | 275 virtual BrowserAccessibility* GetFocus(); |
271 | 276 |
| 277 // Return the object that has focus, only considering this frame and |
| 278 // descendants. |
| 279 BrowserAccessibility* GetFocusFromThisOrDescendantFrame(); |
| 280 |
272 // Given a focused node |focus|, returns a descendant of that node if it | 281 // Given a focused node |focus|, returns a descendant of that node if it |
273 // has an active descendant, otherwise returns |focus|. | 282 // has an active descendant, otherwise returns |focus|. |
274 BrowserAccessibility* GetActiveDescendantFocus(BrowserAccessibility* focus); | 283 BrowserAccessibility* GetActiveDescendantFocus(BrowserAccessibility* focus); |
275 | 284 |
276 // Returns true if native focus is anywhere in this WebContents or not. | 285 // Returns true if native focus is anywhere in this WebContents or not. |
277 bool NativeViewHasFocus(); | 286 bool NativeViewHasFocus(); |
278 | 287 |
279 // True by default, but some platforms want to treat the root | 288 // True by default, but some platforms want to treat the root |
280 // scroll offsets separately. | 289 // scroll offsets separately. |
281 virtual bool UseRootScrollOffsetsWhenComputingBounds(); | 290 virtual bool UseRootScrollOffsetsWhenComputingBounds(); |
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
413 // node within that parent tree. It's computed as needed and cached for | 422 // node within that parent tree. It's computed as needed and cached for |
414 // speed so that it can be accessed quickly if it hasn't changed. | 423 // speed so that it can be accessed quickly if it hasn't changed. |
415 int parent_node_id_from_parent_tree_; | 424 int parent_node_id_from_parent_tree_; |
416 | 425 |
417 DISALLOW_COPY_AND_ASSIGN(BrowserAccessibilityManager); | 426 DISALLOW_COPY_AND_ASSIGN(BrowserAccessibilityManager); |
418 }; | 427 }; |
419 | 428 |
420 } // namespace content | 429 } // namespace content |
421 | 430 |
422 #endif // CONTENT_BROWSER_ACCESSIBILITY_BROWSER_ACCESSIBILITY_MANAGER_H_ | 431 #endif // CONTENT_BROWSER_ACCESSIBILITY_BROWSER_ACCESSIBILITY_MANAGER_H_ |
OLD | NEW |