Update V8 to version 4.7.47.
[chromium-blink-merge.git] / ui / accessibility / platform / ax_platform_node_delegate.h
blobe6dd24d90413fa1db79d36d6d01477807d2282cf
1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef UI_ACCESSIBILITY_PLATFORM_AX_PLATFORM_NODE_DELEGATE_H_
6 #define UI_ACCESSIBILITY_PLATFORM_AX_PLATFORM_NODE_DELEGATE_H_
8 #include "ui/accessibility/ax_enums.h"
9 #include "ui/accessibility/ax_export.h"
10 #include "ui/gfx/geometry/vector2d.h"
11 #include "ui/gfx/native_widget_types.h"
13 namespace ui {
15 struct AXNodeData;
16 class AXPlatformNode;
18 // An object that wants to be accessible should derive from this class.
19 // AXPlatformNode subclasses use this interface to query all of the information
20 // about the object in order to implement native accessibility APIs.
22 // Note that AXPlatformNode has support for accessibility trees where some
23 // of the objects in the tree are not implemented using AXPlatformNode.
24 // For example, you may have a native window with platform-native widgets
25 // in it, but in that window you have custom controls that use AXPlatformNode
26 // to provide accessibility. That's why GetParent, ChildAtIndex, HitTestSync,
27 // and GetFocus all return a gfx::NativeViewAccessible - so you can return a
28 // native accessible if necessary, and AXPlatformNode::GetNativeViewAccessible
29 // otherwise.
30 class AX_EXPORT AXPlatformNodeDelegate {
31 public:
32 // Get the accessibility data that should be exposed for this node.
33 // Virtually all of the information is obtained from this structure
34 // (role, state, name, cursor position, etc.) - the rest of this interface
35 // is mostly to implement support for walking the accessibility tree.
36 virtual const AXNodeData& GetData() = 0;
38 // Get the parent of the node, which may be an AXPlatformNode or it may
39 // be a native accessible object implemented by another class.
40 virtual gfx::NativeViewAccessible GetParent() = 0;
42 // Get the number of children of this node.
43 virtual int GetChildCount() = 0;
45 // Get the child of a node given a 0-based index.
46 virtual gfx::NativeViewAccessible ChildAtIndex(int index) = 0;
48 // Get the offset to convert local coordinates to screen global coordinates.
49 virtual gfx::Vector2d GetGlobalCoordinateOffset() = 0;
51 // Do a *synchronous* hit test of the given location in global screen
52 // coordinates, and the node within this node's subtree (inclusive) that's
53 // hit, if any.
55 // If the result is anything other than this object or NULL, it will be
56 // hit tested again recursively - that allows hit testing to work across
57 // implementation classes. It's okay to take advantage of this and return
58 // only an immediate child and not the deepest descendant.
60 // This function is mainly used by accessibility debugging software.
61 // Platforms with touch accessibility use a different asynchronous interface.
62 virtual gfx::NativeViewAccessible HitTestSync(int x, int y) = 0;
64 // Return the node within this node's subtree (inclusive) that currently
65 // has focus.
66 virtual gfx::NativeViewAccessible GetFocus() = 0;
69 // Events.
72 // Return the platform-native GUI object that should be used as a target
73 // for accessibility events.
74 virtual gfx::AcceleratedWidget GetTargetForNativeAccessibilityEvent() = 0;
77 // Actions.
80 // Perform the default action, e.g. click a button, follow a link, or
81 // toggle a checkbox.
82 virtual void DoDefaultAction() = 0;
84 // Change the value of a control, such as the text content of a text field.
85 virtual bool SetStringValue(const base::string16& new_value) = 0;
88 } // namespace ui
90 #endif // UI_ACCESSIBILITY_PLATFORM_AX_PLATFORM_NODE_DELEGATE_H_