Home | History | Annotate | Download | only in common
      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/accessibility_node_data.h"
     10 #include "content/common/accessibility_notification.h"
     11 #include "content/common/content_export.h"
     12 #include "content/common/view_message_enums.h"
     13 #include "content/public/common/common_param_traits.h"
     14 #include "ipc/ipc_message_macros.h"
     15 #include "ipc/ipc_message_utils.h"
     16 #include "ipc/ipc_param_traits.h"
     17 #include "ipc/param_traits_macros.h"
     18 
     19 #undef IPC_MESSAGE_EXPORT
     20 #define IPC_MESSAGE_EXPORT CONTENT_EXPORT
     21 
     22 #define IPC_MESSAGE_START AccessibilityMsgStart
     23 
     24 IPC_ENUM_TRAITS(AccessibilityNotification)
     25 
     26 IPC_ENUM_TRAITS(content::AccessibilityNodeData::BoolAttribute)
     27 IPC_ENUM_TRAITS(content::AccessibilityNodeData::FloatAttribute)
     28 IPC_ENUM_TRAITS(content::AccessibilityNodeData::IntAttribute)
     29 IPC_ENUM_TRAITS(content::AccessibilityNodeData::Role)
     30 IPC_ENUM_TRAITS(content::AccessibilityNodeData::State)
     31 IPC_ENUM_TRAITS(content::AccessibilityNodeData::StringAttribute)
     32 
     33 IPC_STRUCT_TRAITS_BEGIN(content::AccessibilityNodeData)
     34   IPC_STRUCT_TRAITS_MEMBER(id)
     35   IPC_STRUCT_TRAITS_MEMBER(name)
     36   IPC_STRUCT_TRAITS_MEMBER(value)
     37   IPC_STRUCT_TRAITS_MEMBER(role)
     38   IPC_STRUCT_TRAITS_MEMBER(state)
     39   IPC_STRUCT_TRAITS_MEMBER(location)
     40   IPC_STRUCT_TRAITS_MEMBER(string_attributes)
     41   IPC_STRUCT_TRAITS_MEMBER(int_attributes)
     42   IPC_STRUCT_TRAITS_MEMBER(float_attributes)
     43   IPC_STRUCT_TRAITS_MEMBER(bool_attributes)
     44   IPC_STRUCT_TRAITS_MEMBER(child_ids)
     45   IPC_STRUCT_TRAITS_MEMBER(indirect_child_ids)
     46   IPC_STRUCT_TRAITS_MEMBER(html_attributes)
     47   IPC_STRUCT_TRAITS_MEMBER(line_breaks)
     48   IPC_STRUCT_TRAITS_MEMBER(cell_ids)
     49   IPC_STRUCT_TRAITS_MEMBER(unique_cell_ids)
     50 IPC_STRUCT_TRAITS_END()
     51 
     52 IPC_STRUCT_BEGIN(AccessibilityHostMsg_NotificationParams)
     53   // Vector of nodes in the tree that need to be updated before
     54   // sending the notification.
     55   IPC_STRUCT_MEMBER(std::vector<content::AccessibilityNodeData>, nodes)
     56 
     57   // Type of notification.
     58   IPC_STRUCT_MEMBER(AccessibilityNotification, notification_type)
     59 
     60   // ID of the node that the notification applies to.
     61   IPC_STRUCT_MEMBER(int, id)
     62 IPC_STRUCT_END()
     63 
     64 // Messages sent from the browser to the renderer.
     65 
     66 // Relay a request from assistive technology to set focus to a given node.
     67 IPC_MESSAGE_ROUTED1(AccessibilityMsg_SetFocus,
     68                     int /* object id */)
     69 
     70 // Relay a request from assistive technology to perform the default action
     71 // on a given node.
     72 IPC_MESSAGE_ROUTED1(AccessibilityMsg_DoDefaultAction,
     73                     int /* object id */)
     74 
     75 // Relay a request from assistive technology to make a given object
     76 // visible by scrolling as many scrollable containers as possible.
     77 // In addition, if it's not possible to make the entire object visible,
     78 // scroll so that the |subfocus| rect is visible at least. The subfocus
     79 // rect is in local coordinates of the object itself.
     80 IPC_MESSAGE_ROUTED2(AccessibilityMsg_ScrollToMakeVisible,
     81                     int /* object id */,
     82                     gfx::Rect /* subfocus */)
     83 
     84 // Relay a request from assistive technology to move a given object
     85 // to a specific location, in the WebContents area coordinate space, i.e.
     86 // (0, 0) is the top-left corner of the WebContents.
     87 IPC_MESSAGE_ROUTED2(AccessibilityMsg_ScrollToPoint,
     88                     int /* object id */,
     89                     gfx::Point /* new location */)
     90 
     91 // Relay a request from assistive technology to set the cursor or
     92 // selection within an editable text element.
     93 IPC_MESSAGE_ROUTED3(AccessibilityMsg_SetTextSelection,
     94                     int /* object id */,
     95                     int /* New start offset */,
     96                     int /* New end offset */)
     97 
     98 // Tells the render view that a AccessibilityHostMsg_Notifications
     99 // message was processed and it can send addition notifications.
    100 IPC_MESSAGE_ROUTED0(AccessibilityMsg_Notifications_ACK)
    101 
    102 
    103 // Kill the renderer because we got a fatal error in the accessibility tree.
    104 IPC_MESSAGE_ROUTED0(AccessibilityMsg_FatalError)
    105 
    106 // Messages sent from the renderer to the browser.
    107 
    108 // Sent to notify the browser about renderer accessibility notifications.
    109 // The browser responds with a AccessibilityMsg_Notifications_ACK.
    110 IPC_MESSAGE_ROUTED1(
    111     AccessibilityHostMsg_Notifications,
    112     std::vector<AccessibilityHostMsg_NotificationParams>)
    113