Update To 11.40.268.0
[platform/framework/web/crosswalk.git] / src / content / common / accessibility_messages.h
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.
4
5 // IPC messages for accessibility.
6 // Multiply-included message file, hence no include guard.
7
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"
19
20 // Singly-included section for custom types.
21 #ifndef CONTENT_COMMON_ACCESSIBILITY_MESSAGES_H_
22 #define CONTENT_COMMON_ACCESSIBILITY_MESSAGES_H_
23
24 typedef std::map<int32, int> FrameIDMap;
25
26 #endif  // CONTENT_COMMON_ACCESSIBILITY_MESSAGES_H_
27
28 #undef IPC_MESSAGE_EXPORT
29 #define IPC_MESSAGE_EXPORT CONTENT_EXPORT
30
31 #define IPC_MESSAGE_START AccessibilityMsgStart
32
33 IPC_ENUM_TRAITS_MAX_VALUE(ui::AXEvent, ui::AX_EVENT_LAST)
34 IPC_ENUM_TRAITS_MAX_VALUE(ui::AXRole, ui::AX_ROLE_LAST)
35
36 IPC_ENUM_TRAITS_MAX_VALUE(ui::AXBoolAttribute, ui::AX_BOOL_ATTRIBUTE_LAST)
37 IPC_ENUM_TRAITS_MAX_VALUE(ui::AXFloatAttribute, ui::AX_FLOAT_ATTRIBUTE_LAST)
38 IPC_ENUM_TRAITS_MAX_VALUE(ui::AXIntAttribute, ui::AX_INT_ATTRIBUTE_LAST)
39 IPC_ENUM_TRAITS_MAX_VALUE(ui::AXIntListAttribute,
40                           ui::AX_INT_LIST_ATTRIBUTE_LAST)
41 IPC_ENUM_TRAITS_MAX_VALUE(ui::AXStringAttribute, ui::AX_STRING_ATTRIBUTE_LAST)
42
43 IPC_STRUCT_TRAITS_BEGIN(ui::AXNodeData)
44   IPC_STRUCT_TRAITS_MEMBER(id)
45   IPC_STRUCT_TRAITS_MEMBER(role)
46   IPC_STRUCT_TRAITS_MEMBER(state)
47   IPC_STRUCT_TRAITS_MEMBER(location)
48   IPC_STRUCT_TRAITS_MEMBER(string_attributes)
49   IPC_STRUCT_TRAITS_MEMBER(int_attributes)
50   IPC_STRUCT_TRAITS_MEMBER(float_attributes)
51   IPC_STRUCT_TRAITS_MEMBER(bool_attributes)
52   IPC_STRUCT_TRAITS_MEMBER(intlist_attributes)
53   IPC_STRUCT_TRAITS_MEMBER(html_attributes)
54   IPC_STRUCT_TRAITS_MEMBER(child_ids)
55 IPC_STRUCT_TRAITS_END()
56
57 IPC_STRUCT_TRAITS_BEGIN(ui::AXTreeUpdate)
58   IPC_STRUCT_TRAITS_MEMBER(node_id_to_clear)
59   IPC_STRUCT_TRAITS_MEMBER(nodes)
60 IPC_STRUCT_TRAITS_END()
61
62 IPC_STRUCT_BEGIN(AccessibilityHostMsg_EventParams)
63   // The tree update.
64   IPC_STRUCT_MEMBER(ui::AXTreeUpdate, update)
65
66   // Mapping from node id to routing id of its child frame - either the
67   // routing id of a RenderFrame or a RenderFrameProxy for an out-of-process
68   // iframe.
69   IPC_STRUCT_MEMBER(FrameIDMap, node_to_frame_routing_id_map)
70
71   // Mapping from node id to the browser plugin instance id of a child
72   // browser plugin.
73   IPC_STRUCT_MEMBER(FrameIDMap, node_to_browser_plugin_instance_id_map)
74
75   // Type of event.
76   IPC_STRUCT_MEMBER(ui::AXEvent, event_type)
77
78   // ID of the node that the event applies to.
79   IPC_STRUCT_MEMBER(int, id)
80 IPC_STRUCT_END()
81
82 IPC_STRUCT_BEGIN(AccessibilityHostMsg_LocationChangeParams)
83   // ID of the object whose location is changing.
84   IPC_STRUCT_MEMBER(int, id)
85
86   // The object's new location, in frame-relative coordinates (same
87   // as the coordinates in AccessibilityNodeData).
88   IPC_STRUCT_MEMBER(gfx::Rect, new_location)
89 IPC_STRUCT_END()
90
91 IPC_STRUCT_BEGIN(AccessibilityHostMsg_FindInPageResultParams)
92   // The find in page request id.
93   IPC_STRUCT_MEMBER(int, request_id)
94
95   // The index of the result match.
96   IPC_STRUCT_MEMBER(int, match_index)
97
98   // The id of the accessibility object for the start of the match range.
99   IPC_STRUCT_MEMBER(int, start_id)
100
101   // The character offset into the text of the start object.
102   IPC_STRUCT_MEMBER(int, start_offset)
103
104   // The id of the accessibility object for the end of the match range.
105   IPC_STRUCT_MEMBER(int, end_id)
106
107   // The character offset into the text of the end object.
108   IPC_STRUCT_MEMBER(int, end_offset)
109 IPC_STRUCT_END()
110
111 // Messages sent from the browser to the renderer.
112
113 // Relay a request from assistive technology to set focus to a given node.
114 IPC_MESSAGE_ROUTED1(AccessibilityMsg_SetFocus,
115                     int /* object id */)
116
117 // Relay a request from assistive technology to perform the default action
118 // on a given node.
119 IPC_MESSAGE_ROUTED1(AccessibilityMsg_DoDefaultAction,
120                     int /* object id */)
121
122 // Relay a request from assistive technology to make a given object
123 // visible by scrolling as many scrollable containers as possible.
124 // In addition, if it's not possible to make the entire object visible,
125 // scroll so that the |subfocus| rect is visible at least. The subfocus
126 // rect is in local coordinates of the object itself.
127 IPC_MESSAGE_ROUTED2(AccessibilityMsg_ScrollToMakeVisible,
128                     int /* object id */,
129                     gfx::Rect /* subfocus */)
130
131 // Relay a request from assistive technology to move a given object
132 // to a specific location, in the WebContents area coordinate space, i.e.
133 // (0, 0) is the top-left corner of the WebContents.
134 IPC_MESSAGE_ROUTED2(AccessibilityMsg_ScrollToPoint,
135                     int /* object id */,
136                     gfx::Point /* new location */)
137
138 // Relay a request from assistive technology to set the cursor or
139 // selection within an editable text element.
140 IPC_MESSAGE_ROUTED3(AccessibilityMsg_SetTextSelection,
141                     int /* object id */,
142                     int /* New start offset */,
143                     int /* New end offset */)
144
145 // Relay a request from assistive technology to set the value of an
146 // editable text element.
147 IPC_MESSAGE_ROUTED2(AccessibilityMsg_SetValue,
148                     int /* object id */,
149                     base::string16 /* Value */)
150
151 // Determine the accessibility object under a given point and reply with
152 // a AccessibilityHostMsg_HitTestResult with the same id.
153 IPC_MESSAGE_ROUTED1(AccessibilityMsg_HitTest,
154                     gfx::Point /* location to test */)
155
156 // Relay a request from assistive technology to set accessibility focus
157 // to a given node. On platforms where this is used (currently Android),
158 // inline text boxes are only computed for the node with accessibility focus,
159 // rather than for the whole tree.
160 IPC_MESSAGE_ROUTED1(AccessibilityMsg_SetAccessibilityFocus,
161                     int /* object id */)
162
163 // Tells the render view that a AccessibilityHostMsg_Events
164 // message was processed and it can send addition events.
165 IPC_MESSAGE_ROUTED0(AccessibilityMsg_Events_ACK)
166
167 // Tell the renderer to reset and send a new accessibility tree from
168 // scratch because the browser is out of sync. It passes a sequential
169 // reset token. This should be rare, and if we need reset the same renderer
170 // too many times we just kill it. After sending a reset, the browser ignores
171 // incoming accessibility IPCs until it receives one with the matching reset
172 // token. Conversely, it ignores IPCs with a reset token if it was not
173 // expecting a reset.
174 IPC_MESSAGE_ROUTED1(AccessibilityMsg_Reset,
175                     int /* reset token */)
176
177 // Kill the renderer because we got a fatal error in the accessibility tree
178 // and we've already reset too many times.
179 IPC_MESSAGE_ROUTED0(AccessibilityMsg_FatalError)
180
181 // Messages sent from the renderer to the browser.
182
183 // Sent to notify the browser about renderer accessibility events.
184 // The browser responds with a AccessibilityMsg_Events_ACK.
185 // The second parameter, reset_token, is set if this IPC was sent in response
186 // to a reset request from the browser. When the browser requests a reset,
187 // it ignores incoming IPCs until it sees one with the correct reset token.
188 // Any other time, it ignores IPCs with a reset token.
189 IPC_MESSAGE_ROUTED2(
190     AccessibilityHostMsg_Events,
191     std::vector<AccessibilityHostMsg_EventParams> /* events */,
192     int /* reset_token */)
193
194 // Sent to update the browser of the location of accessibility objects.
195 IPC_MESSAGE_ROUTED1(
196     AccessibilityHostMsg_LocationChanges,
197     std::vector<AccessibilityHostMsg_LocationChangeParams>)
198
199 // Sent to update the browser of the location of accessibility objects.
200 IPC_MESSAGE_ROUTED1(
201     AccessibilityHostMsg_FindInPageResult,
202     AccessibilityHostMsg_FindInPageResultParams)