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
)
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
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
44 IPC_STRUCT_MEMBER(FrameIDMap
, node_to_browser_plugin_instance_id_map
)
47 IPC_STRUCT_MEMBER(ui::AXEvent
, event_type
)
49 // ID of the node that the event applies to.
50 IPC_STRUCT_MEMBER(int, id
)
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
)
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
)
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
,
88 // Relay a request from assistive technology to perform the default action
90 IPC_MESSAGE_ROUTED1(AccessibilityMsg_DoDefaultAction
,
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
,
100 gfx::Rect
/* subfocus */)
102 // Relay a request from assistive technology to show the context menu for a
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
,
111 gfx::Point
/* new location */)
113 // Relay a request from assistive technology to set the scroll offset
114 // of an accessibility object that's a scroll container, to a specific
116 IPC_MESSAGE_ROUTED2(AccessibilityMsg_SetScrollOffset
,
118 gfx::Point
/* new offset */)
120 // Relay a request from assistive technology to set the cursor or
121 // selection within an editable text element.
122 IPC_MESSAGE_ROUTED3(AccessibilityMsg_SetTextSelection
,
124 int /* New start offset */,
125 int /* New end offset */)
127 // Relay a request from assistive technology to set the value of an
128 // editable text element.
129 IPC_MESSAGE_ROUTED2(AccessibilityMsg_SetValue
,
131 base::string16
/* Value */)
133 // Determine the accessibility object under a given point and reply with
134 // a AccessibilityHostMsg_HitTestResult with the same id.
135 IPC_MESSAGE_ROUTED1(AccessibilityMsg_HitTest
,
136 gfx::Point
/* location to test */)
138 // Relay a request from assistive technology to set accessibility focus
139 // to a given node. On platforms where this is used (currently Android),
140 // inline text boxes are only computed for the node with accessibility focus,
141 // rather than for the whole tree.
142 IPC_MESSAGE_ROUTED1(AccessibilityMsg_SetAccessibilityFocus
,
145 // Tells the render view that a AccessibilityHostMsg_Events
146 // message was processed and it can send addition events.
147 IPC_MESSAGE_ROUTED0(AccessibilityMsg_Events_ACK
)
149 // Tell the renderer to reset and send a new accessibility tree from
150 // scratch because the browser is out of sync. It passes a sequential
151 // reset token. This should be rare, and if we need reset the same renderer
152 // too many times we just kill it. After sending a reset, the browser ignores
153 // incoming accessibility IPCs until it receives one with the matching reset
154 // token. Conversely, it ignores IPCs with a reset token if it was not
155 // expecting a reset.
156 IPC_MESSAGE_ROUTED1(AccessibilityMsg_Reset
,
157 int /* reset token */)
159 // Kill the renderer because we got a fatal error in the accessibility tree
160 // and we've already reset too many times.
161 IPC_MESSAGE_ROUTED0(AccessibilityMsg_FatalError
)
163 // Request a one-time snapshot of the accessibility tree without
164 // enabling accessibility if it wasn't already enabled. The passed id
165 // will be returned in the AccessibilityHostMsg_SnapshotResponse message.
166 IPC_MESSAGE_ROUTED1(AccessibilityMsg_SnapshotTree
,
167 int /* callback id */)
169 // Messages sent from the renderer to the browser.
171 // Sent to notify the browser about renderer accessibility events.
172 // The browser responds with a AccessibilityMsg_Events_ACK.
173 // The second parameter, reset_token, is set if this IPC was sent in response
174 // to a reset request from the browser. When the browser requests a reset,
175 // it ignores incoming IPCs until it sees one with the correct reset token.
176 // Any other time, it ignores IPCs with a reset token.
178 AccessibilityHostMsg_Events
,
179 std::vector
<AccessibilityHostMsg_EventParams
> /* events */,
180 int /* reset_token */)
182 // Sent to update the browser of the location of accessibility objects.
184 AccessibilityHostMsg_LocationChanges
,
185 std::vector
<AccessibilityHostMsg_LocationChangeParams
>)
187 // Sent to update the browser of the location of accessibility objects.
189 AccessibilityHostMsg_FindInPageResult
,
190 AccessibilityHostMsg_FindInPageResultParams
)
192 // Sent in response to AccessibilityMsg_SnapshotTree. The callback id that was
193 // passed to the request will be returned in |callback_id|, along with
194 // a standalone snapshot of the accessibility tree.
195 IPC_MESSAGE_ROUTED2(AccessibilityHostMsg_SnapshotResponse
,
196 int /* callback_id */,