| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef WEBKIT_GLUE_WEBACCESSIBILITY_H_ | 5 #ifndef WEBKIT_GLUE_WEBACCESSIBILITY_H_ |
| 6 #define WEBKIT_GLUE_WEBACCESSIBILITY_H_ | 6 #define WEBKIT_GLUE_WEBACCESSIBILITY_H_ |
| 7 | 7 |
| 8 #include <vector> | |
| 9 | |
| 10 #include "base/string16.h" | 8 #include "base/string16.h" |
| 11 #include "third_party/WebKit/WebKit/chromium/public/WebAccessibilityObject.h" | |
| 12 #include "third_party/WebKit/WebKit/chromium/public/WebAccessibilityRole.h" | |
| 13 #include "third_party/WebKit/WebKit/chromium/public/WebRect.h" | |
| 14 | 9 |
| 15 namespace WebKit { | 10 namespace WebKit { |
| 16 class WebAccessibilityCache; | 11 class WebAccessibilityCache; |
| 17 } | 12 } |
| 18 | 13 |
| 19 namespace webkit_glue { | 14 namespace webkit_glue { |
| 20 | 15 |
| 21 // A compact representation of the accessibility information for a | 16 class WebAccessibility { |
| 22 // single web object, in a form that can be serialized and sent from | |
| 23 // the renderer process to the browser process. | |
| 24 struct WebAccessibility { | |
| 25 public: | 17 public: |
| 26 // An alphabetical enumeration of accessibility roles. | 18 // This defines an enumeration of IDs that can uniquely identify a call to a |
| 19 // specific accessibility information function. Should match the support |
| 20 // implemented in WebKit and GlueAccessibilityObject (functions marked with |
| 21 // return value E_NOTIMPL in WebKit are also excluded). |
| 22 enum Function { |
| 23 FUNCTION_NONE = 0, |
| 24 |
| 25 // Supported accessibility information retrieval functions. |
| 26 FUNCTION_DODEFAULTACTION, |
| 27 FUNCTION_HITTEST, |
| 28 FUNCTION_LOCATION, |
| 29 FUNCTION_NAVIGATE, |
| 30 FUNCTION_GETCHILD, |
| 31 FUNCTION_CHILDCOUNT, |
| 32 FUNCTION_DEFAULTACTION, |
| 33 FUNCTION_DESCRIPTION, |
| 34 FUNCTION_GETFOCUSEDCHILD, |
| 35 FUNCTION_HELPTEXT, |
| 36 FUNCTION_KEYBOARDSHORTCUT, |
| 37 FUNCTION_NAME, |
| 38 FUNCTION_GETPARENT, |
| 39 FUNCTION_ROLE, |
| 40 FUNCTION_STATE, |
| 41 FUNCTION_VALUE |
| 42 |
| 43 // The deprecated put_accName and put_accValue (IAccessible) are not |
| 44 // supported here, nor is accSelect, get_accHelpTopic and get_accSelection |
| 45 // (matching WebKit's support for IAccessible). |
| 46 }; |
| 47 |
| 48 // This defines an enumeration of navigation directions based on (but |
| 49 // independent of) the MSAA Navigation Constants. However, to avoid the use of |
| 50 // COM in our Glue layer, we use this as a substitute with a one-to-one |
| 51 // conversion between Browser side (has COM) and Glue. |
| 52 enum Direction { |
| 53 DIRECTION_NONE = 0, |
| 54 |
| 55 // Valid directions. |
| 56 DIRECTION_UP, |
| 57 DIRECTION_DOWN, |
| 58 DIRECTION_LEFT, |
| 59 DIRECTION_RIGHT, |
| 60 DIRECTION_NEXT, |
| 61 DIRECTION_PREVIOUS, |
| 62 DIRECTION_FIRSTCHILD, |
| 63 DIRECTION_LASTCHILD |
| 64 }; |
| 65 |
| 66 // This defines an enumeration (in alphabetical order) of the supported |
| 67 // accessibility roles in our Glue layer (used in |
| 68 // GlueAccessibilityObject::Role). Any interface using roles must provide a |
| 69 // conversion to its own roles (see e.g. BrowserAccessibility::get_accRole and |
| 70 // BrowserAccessibility::MSAARole). |
| 27 enum Role { | 71 enum Role { |
| 28 ROLE_NONE = 0, | |
| 29 | |
| 30 ROLE_APPLICATION, | 72 ROLE_APPLICATION, |
| 31 ROLE_CELL, | 73 ROLE_CELL, |
| 32 ROLE_CHECKBUTTON, | 74 ROLE_CHECKBUTTON, |
| 33 ROLE_CLIENT, | 75 ROLE_CLIENT, |
| 34 ROLE_COLUMN, | 76 ROLE_COLUMN, |
| 35 ROLE_COLUMNHEADER, | 77 ROLE_COLUMNHEADER, |
| 36 ROLE_DOCUMENT, | 78 ROLE_DOCUMENT, |
| 37 ROLE_GRAPHIC, | 79 ROLE_GRAPHIC, |
| 38 ROLE_GROUPING, | 80 ROLE_GROUPING, |
| 39 ROLE_LINK, | 81 ROLE_LINK, |
| (...skipping 10 matching lines...) Expand all Loading... |
| 50 ROLE_RADIOBUTTON, | 92 ROLE_RADIOBUTTON, |
| 51 ROLE_ROW, | 93 ROLE_ROW, |
| 52 ROLE_ROWHEADER, | 94 ROLE_ROWHEADER, |
| 53 ROLE_SEPARATOR, | 95 ROLE_SEPARATOR, |
| 54 ROLE_SLIDER, | 96 ROLE_SLIDER, |
| 55 ROLE_STATICTEXT, | 97 ROLE_STATICTEXT, |
| 56 ROLE_STATUSBAR, | 98 ROLE_STATUSBAR, |
| 57 ROLE_TABLE, | 99 ROLE_TABLE, |
| 58 ROLE_TEXT, | 100 ROLE_TEXT, |
| 59 ROLE_TOOLBAR, | 101 ROLE_TOOLBAR, |
| 60 ROLE_TOOLTIP, | 102 ROLE_TOOLTIP |
| 61 NUM_ROLES | |
| 62 }; | 103 }; |
| 63 | 104 |
| 64 // An alphabetical enumeration of accessibility states. | 105 // This defines an enumeration (in alphabetical order) of the supported |
| 65 // A state bitmask is formed by shifting 1 to the left by each state, | 106 // accessibility states in our Glue layer (used in |
| 66 // for example: | 107 // GlueAccessibilityObject::State). Any interface using states must provide a |
| 67 // int mask = (1 << STATE_CHECKED) | (1 << STATE_FOCUSED); | 108 // conversion to its own states (see e.g. BrowserAccessibility::get_accState |
| 109 // and BrowserAccessibility::MSAAState). |
| 68 enum State { | 110 enum State { |
| 69 STATE_CHECKED, | 111 STATE_CHECKED, |
| 70 STATE_FOCUSABLE, | 112 STATE_FOCUSABLE, |
| 71 STATE_FOCUSED, | 113 STATE_FOCUSED, |
| 72 STATE_HOTTRACKED, | 114 STATE_HOTTRACKED, |
| 73 STATE_INDETERMINATE, | 115 STATE_INDETERMINATE, |
| 74 STATE_LINKED, | 116 STATE_LINKED, |
| 75 STATE_MULTISELECTABLE, | 117 STATE_MULTISELECTABLE, |
| 76 STATE_OFFSCREEN, | 118 STATE_OFFSCREEN, |
| 77 STATE_PRESSED, | 119 STATE_PRESSED, |
| 78 STATE_PROTECTED, | 120 STATE_PROTECTED, |
| 79 STATE_READONLY, | 121 STATE_READONLY, |
| 80 STATE_TRAVERSED, | 122 STATE_TRAVERSED, |
| 81 STATE_UNAVAILABLE | 123 STATE_UNAVAILABLE |
| 82 }; | 124 }; |
| 83 | 125 |
| 84 // Empty constructor, for serialization. | 126 enum ReturnCode { |
| 85 WebAccessibility(); | 127 RETURNCODE_TRUE, // MSAA S_OK |
| 128 RETURNCODE_FALSE, // MSAA S_FALSE |
| 129 RETURNCODE_FAIL // E_FAIL |
| 130 }; |
| 86 | 131 |
| 87 // Construct from a WebAccessibilityObject. Recursively creates child | 132 // Parameters structure to hold a union of the possible accessibility function |
| 88 // nodes as needed to complete the tree. Adds |src| to |cache| and | 133 // INPUT variables, with the unused fields always set to default value. Used |
| 89 // stores its cache ID. | 134 // in ViewMsg_GetAccessibilityInfo, as only parameter. |
| 90 WebAccessibility(const WebKit::WebAccessibilityObject& src, | 135 struct InParams { |
| 91 WebKit::WebAccessibilityCache* cache); | 136 // Identifier to uniquely distinguish which instance of accessibility |
| 137 // information is being called upon on the renderer side. |
| 138 int object_id; |
| 92 | 139 |
| 93 // Initialize an already-created struct, same as the constructor a | 140 // Identifier to resolve which accessibility information retrieval function |
| 94 void Init(const WebKit::WebAccessibilityObject& src, | 141 // is being called. |
| 95 WebKit::WebAccessibilityCache* cache); | 142 int function_id; |
| 96 | 143 |
| 97 // This is a simple serializable struct. All member variables should be | 144 // Id of accessible child, whose information is being requested. |
| 98 // copyable. | 145 int child_id; |
| 99 int32 id; | 146 |
| 100 string16 name; | 147 // LONG input parameters, used differently depending on the function called. |
| 101 string16 value; | 148 long input_long1; |
| 102 string16 action; | 149 long input_long2; |
| 103 string16 description; | 150 }; |
| 104 string16 help; | 151 |
| 105 string16 shortcut; | 152 // Parameters structure to hold a union of the possible accessibility function |
| 106 Role role; | 153 // OUTPUT variables, with the unused fields always set to default value. Used |
| 107 uint32 state; | 154 // in ViewHostMsg_GetAccessibilityInfoResponse, as only parameter. |
| 108 WebKit::WebRect location; | 155 struct OutParams { |
| 109 std::vector<WebAccessibility> children; | 156 // Identifier to uniquely distinguish which instance of accessibility |
| 157 // information is being called upon on the renderer side. |
| 158 int object_id; |
| 159 |
| 160 // LONG output parameters, used differently depending on the function |
| 161 // called. [output_long1] can in some cases be set to -1 to indicate that |
| 162 // the child object found by the called IAccessible function is not a simple |
| 163 // object. |
| 164 long output_long1; |
| 165 long output_long2; |
| 166 long output_long3; |
| 167 long output_long4; |
| 168 |
| 169 // String output parameter. |
| 170 string16 output_string; |
| 171 |
| 172 // Return code of the accessibility function call. |
| 173 int32 return_code; |
| 174 }; |
| 175 |
| 176 static int32 GetAccObjInfo(WebKit::WebAccessibilityCache* cache, |
| 177 const InParams& in_params, OutParams* out_params); |
| 110 }; | 178 }; |
| 111 | 179 |
| 112 } // namespace webkit_glue | 180 } // namespace webkit_glue |
| 113 | 181 |
| 114 #endif // WEBKIT_GLUE_WEBACCESSIBILITY_H_ | 182 #endif // WEBKIT_GLUE_WEBACCESSIBILITY_H_ |
| OLD | NEW |