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 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
184 // occurred in the tab. | 185 // occurred in the tab. |
185 void GotMouseDown(); | 186 void GotMouseDown(); |
186 | 187 |
187 // Send a message to the renderer to set focus to this node. | 188 // Send a message to the renderer to set focus to this node. |
188 void SetFocus(const BrowserAccessibility& node); | 189 void SetFocus(const BrowserAccessibility& node); |
189 | 190 |
190 // Pretend that the given node has focus, for testing only. Doesn't | 191 // Pretend that the given node has focus, for testing only. Doesn't |
191 // communicate with the renderer and doesn't fire any events. | 192 // communicate with the renderer and doesn't fire any events. |
192 void SetFocusLocallyForTesting(BrowserAccessibility* node); | 193 void SetFocusLocallyForTesting(BrowserAccessibility* node); |
193 | 194 |
195 // For testing only, register a function to be called when focus changes | |
196 // in any BrowserAccessibilityManager. | |
197 static void SetFocusChangeCallbackForTesting(base::Closure callback); | |
dcheng
2016/03/24 18:15:11
const base::Closure&
(base::Closure is movable no
dmazzoni
2016/03/25 05:02:22
Done.
| |
198 | |
194 // Tell the renderer to do the default action for this node. | 199 // Tell the renderer to do the default action for this node. |
195 void DoDefaultAction(const BrowserAccessibility& node); | 200 void DoDefaultAction(const BrowserAccessibility& node); |
196 | 201 |
197 // Tell the renderer to scroll to make |node| visible. | 202 // Tell the renderer to scroll to make |node| visible. |
198 // In addition, if it's not possible to make the entire object visible, | 203 // In addition, if it's not possible to make the entire object visible, |
199 // scroll so that the |subfocus| rect is visible at least. The subfocus | 204 // scroll so that the |subfocus| rect is visible at least. The subfocus |
200 // rect is in local coordinates of the object itself. | 205 // rect is in local coordinates of the object itself. |
201 void ScrollToMakeVisible( | 206 void ScrollToMakeVisible( |
202 const BrowserAccessibility& node, gfx::Rect subfocus); | 207 const BrowserAccessibility& node, gfx::Rect subfocus); |
203 | 208 |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
254 | 259 |
255 #if defined(OS_ANDROID) | 260 #if defined(OS_ANDROID) |
256 BrowserAccessibilityManagerAndroid* ToBrowserAccessibilityManagerAndroid(); | 261 BrowserAccessibilityManagerAndroid* ToBrowserAccessibilityManagerAndroid(); |
257 #endif | 262 #endif |
258 | 263 |
259 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) && defined(USE_X11) | 264 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) && defined(USE_X11) |
260 BrowserAccessibilityManagerAuraLinux* | 265 BrowserAccessibilityManagerAuraLinux* |
261 ToBrowserAccessibilityManagerAuraLinux(); | 266 ToBrowserAccessibilityManagerAuraLinux(); |
262 #endif | 267 #endif |
263 | 268 |
264 // Return the object that has focus. | 269 // Return the object that has focus, starting at the top of the frame tree. |
265 virtual BrowserAccessibility* GetFocus(); | 270 virtual BrowserAccessibility* GetFocus(); |
266 | 271 |
272 // Return the object that has focus, only considering this frame and | |
273 // descendants. | |
274 BrowserAccessibility* GetFocusFromThisOrDescendantFrame(); | |
275 | |
267 // Given a focused node |focus|, returns a descendant of that node if it | 276 // Given a focused node |focus|, returns a descendant of that node if it |
268 // has an active descendant, otherwise returns |focus|. | 277 // has an active descendant, otherwise returns |focus|. |
269 BrowserAccessibility* GetActiveDescendantFocus(BrowserAccessibility* focus); | 278 BrowserAccessibility* GetActiveDescendantFocus(BrowserAccessibility* focus); |
270 | 279 |
271 // Returns true if native focus is anywhere in this WebContents or not. | 280 // Returns true if native focus is anywhere in this WebContents or not. |
272 bool NativeViewHasFocus(); | 281 bool NativeViewHasFocus(); |
273 | 282 |
274 // True by default, but some platforms want to treat the root | 283 // True by default, but some platforms want to treat the root |
275 // scroll offsets separately. | 284 // scroll offsets separately. |
276 virtual bool UseRootScrollOffsetsWhenComputingBounds(); | 285 virtual bool UseRootScrollOffsetsWhenComputingBounds(); |
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
408 // node within that parent tree. It's computed as needed and cached for | 417 // node within that parent tree. It's computed as needed and cached for |
409 // speed so that it can be accessed quickly if it hasn't changed. | 418 // speed so that it can be accessed quickly if it hasn't changed. |
410 int parent_node_id_from_parent_tree_; | 419 int parent_node_id_from_parent_tree_; |
411 | 420 |
412 DISALLOW_COPY_AND_ASSIGN(BrowserAccessibilityManager); | 421 DISALLOW_COPY_AND_ASSIGN(BrowserAccessibilityManager); |
413 }; | 422 }; |
414 | 423 |
415 } // namespace content | 424 } // namespace content |
416 | 425 |
417 #endif // CONTENT_BROWSER_ACCESSIBILITY_BROWSER_ACCESSIBILITY_MANAGER_H_ | 426 #endif // CONTENT_BROWSER_ACCESSIBILITY_BROWSER_ACCESSIBILITY_MANAGER_H_ |
OLD | NEW |