[Android WebView] Fix webview perf bot switchover to use org.chromium.webview_shell...
[chromium-blink-merge.git] / content / common / accessibility_messages.h
blob1acd33548345d0a459c47fdd00bdf93f15ad2bc1
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
3 // found in the LICENSE file.
5 // IPC messages for accessibility.
6 // Multiply-included message file, hence no include guard.
8 #include "base/basictypes.h"
9 #include "content/common/content_export.h"
10 #include "content/common/view_message_enums.h"
11 #include "content/public/common/common_param_traits.h"
12 #include "ipc/ipc_message_macros.h"
13 #include "ipc/ipc_message_utils.h"
14 #include "ipc/ipc_param_traits.h"
15 #include "ipc/param_traits_macros.h"
16 #include "third_party/WebKit/public/web/WebAXEnums.h"
17 #include "ui/accessibility/ax_node_data.h"
18 #include "ui/accessibility/ax_tree_update.h"
20 // Singly-included section for custom types.
21 #ifndef CONTENT_COMMON_ACCESSIBILITY_MESSAGES_H_
22 #define CONTENT_COMMON_ACCESSIBILITY_MESSAGES_H_
24 typedef std::map<int32, int> FrameIDMap;
26 #endif // CONTENT_COMMON_ACCESSIBILITY_MESSAGES_H_
28 #undef IPC_MESSAGE_EXPORT
29 #define IPC_MESSAGE_EXPORT CONTENT_EXPORT
31 #define IPC_MESSAGE_START AccessibilityMsgStart
33 IPC_STRUCT_BEGIN(AccessibilityHostMsg_EventParams)
34 // The tree update.
35 IPC_STRUCT_MEMBER(ui::AXTreeUpdate, update)
37 // Mapping from node id to routing id of its child frame - either the
38 // routing id of a RenderFrame or a RenderFrameProxy for an out-of-process
39 // iframe.
40 IPC_STRUCT_MEMBER(FrameIDMap, node_to_frame_routing_id_map)
42 // Mapping from node id to the browser plugin instance id of a child
43 // browser plugin.
44 IPC_STRUCT_MEMBER(FrameIDMap, node_to_browser_plugin_instance_id_map)
46 // Type of event.
47 IPC_STRUCT_MEMBER(ui::AXEvent, event_type)
49 // ID of the node that the event applies to.
50 IPC_STRUCT_MEMBER(int, id)
51 IPC_STRUCT_END()
53 IPC_STRUCT_BEGIN(AccessibilityHostMsg_LocationChangeParams)
54 // ID of the object whose location is changing.
55 IPC_STRUCT_MEMBER(int, id)
57 // The object's new location, in frame-relative coordinates (same
58 // as the coordinates in AccessibilityNodeData).
59 IPC_STRUCT_MEMBER(gfx::Rect, new_location)
60 IPC_STRUCT_END()
62 IPC_STRUCT_BEGIN(AccessibilityHostMsg_FindInPageResultParams)
63 // The find in page request id.
64 IPC_STRUCT_MEMBER(int, request_id)
66 // The index of the result match.
67 IPC_STRUCT_MEMBER(int, match_index)
69 // The id of the accessibility object for the start of the match range.
70 IPC_STRUCT_MEMBER(int, start_id)
72 // The character offset into the text of the start object.
73 IPC_STRUCT_MEMBER(int, start_offset)
75 // The id of the accessibility object for the end of the match range.
76 IPC_STRUCT_MEMBER(int, end_id)
78 // The character offset into the text of the end object.
79 IPC_STRUCT_MEMBER(int, end_offset)
80 IPC_STRUCT_END()
82 // Messages sent from the browser to the renderer.
84 // Relay a request from assistive technology to set focus to a given node.
85 IPC_MESSAGE_ROUTED1(AccessibilityMsg_SetFocus,
86 int /* object id */)
88 // Relay a request from assistive technology to perform the default action
89 // on a given node.
90 IPC_MESSAGE_ROUTED1(AccessibilityMsg_DoDefaultAction,
91 int /* object id */)
93 // Relay a request from assistive technology to make a given object
94 // visible by scrolling as many scrollable containers as possible.
95 // In addition, if it's not possible to make the entire object visible,
96 // scroll so that the |subfocus| rect is visible at least. The subfocus
97 // rect is in local coordinates of the object itself.
98 IPC_MESSAGE_ROUTED2(AccessibilityMsg_ScrollToMakeVisible,
99 int /* object id */,
100 gfx::Rect /* subfocus */)
102 // Relay a request from assistive technology to show the context menu for a
103 // given object.
104 IPC_MESSAGE_ROUTED1(AccessibilityMsg_ShowContextMenu, int /* object id */)
106 // Relay a request from assistive technology to move a given object
107 // to a specific location, in the WebContents area coordinate space, i.e.
108 // (0, 0) is the top-left corner of the WebContents.
109 IPC_MESSAGE_ROUTED2(AccessibilityMsg_ScrollToPoint,
110 int /* object id */,
111 gfx::Point /* new location */)
113 // Relay a request from assistive technology to set the cursor or
114 // selection within an editable text element.
115 IPC_MESSAGE_ROUTED3(AccessibilityMsg_SetTextSelection,
116 int /* object id */,
117 int /* New start offset */,
118 int /* New end offset */)
120 // Relay a request from assistive technology to set the value of an
121 // editable text element.
122 IPC_MESSAGE_ROUTED2(AccessibilityMsg_SetValue,
123 int /* object id */,
124 base::string16 /* Value */)
126 // Determine the accessibility object under a given point and reply with
127 // a AccessibilityHostMsg_HitTestResult with the same id.
128 IPC_MESSAGE_ROUTED1(AccessibilityMsg_HitTest,
129 gfx::Point /* location to test */)
131 // Relay a request from assistive technology to set accessibility focus
132 // to a given node. On platforms where this is used (currently Android),
133 // inline text boxes are only computed for the node with accessibility focus,
134 // rather than for the whole tree.
135 IPC_MESSAGE_ROUTED1(AccessibilityMsg_SetAccessibilityFocus,
136 int /* object id */)
138 // Tells the render view that a AccessibilityHostMsg_Events
139 // message was processed and it can send addition events.
140 IPC_MESSAGE_ROUTED0(AccessibilityMsg_Events_ACK)
142 // Tell the renderer to reset and send a new accessibility tree from
143 // scratch because the browser is out of sync. It passes a sequential
144 // reset token. This should be rare, and if we need reset the same renderer
145 // too many times we just kill it. After sending a reset, the browser ignores
146 // incoming accessibility IPCs until it receives one with the matching reset
147 // token. Conversely, it ignores IPCs with a reset token if it was not
148 // expecting a reset.
149 IPC_MESSAGE_ROUTED1(AccessibilityMsg_Reset,
150 int /* reset token */)
152 // Kill the renderer because we got a fatal error in the accessibility tree
153 // and we've already reset too many times.
154 IPC_MESSAGE_ROUTED0(AccessibilityMsg_FatalError)
156 // Request a one-time snapshot of the accessibility tree without
157 // enabling accessibility if it wasn't already enabled. The passed id
158 // will be returned in the AccessibilityHostMsg_SnapshotResponse message.
159 IPC_MESSAGE_ROUTED1(AccessibilityMsg_SnapshotTree,
160 int /* callback id */)
162 // Messages sent from the renderer to the browser.
164 // Sent to notify the browser about renderer accessibility events.
165 // The browser responds with a AccessibilityMsg_Events_ACK.
166 // The second parameter, reset_token, is set if this IPC was sent in response
167 // to a reset request from the browser. When the browser requests a reset,
168 // it ignores incoming IPCs until it sees one with the correct reset token.
169 // Any other time, it ignores IPCs with a reset token.
170 IPC_MESSAGE_ROUTED2(
171 AccessibilityHostMsg_Events,
172 std::vector<AccessibilityHostMsg_EventParams> /* events */,
173 int /* reset_token */)
175 // Sent to update the browser of the location of accessibility objects.
176 IPC_MESSAGE_ROUTED1(
177 AccessibilityHostMsg_LocationChanges,
178 std::vector<AccessibilityHostMsg_LocationChangeParams>)
180 // Sent to update the browser of the location of accessibility objects.
181 IPC_MESSAGE_ROUTED1(
182 AccessibilityHostMsg_FindInPageResult,
183 AccessibilityHostMsg_FindInPageResultParams)
185 // Sent in response to AccessibilityMsg_SnapshotTree. The callback id that was
186 // passed to the request will be returned in |callback_id|, along with
187 // a standalone snapshot of the accessibility tree.
188 IPC_MESSAGE_ROUTED2(AccessibilityHostMsg_SnapshotResponse,
189 int /* callback_id */,
190 ui::AXTreeUpdate)