Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 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 #include "content/browser/accessibility/browser_accessibility_win.h" | 5 #include "content/browser/accessibility/browser_accessibility_win.h" |
| 6 | 6 |
| 7 #include <UIAutomationClient.h> | 7 #include <UIAutomationClient.h> |
| 8 #include <UIAutomationCoreApi.h> | 8 #include <UIAutomationCoreApi.h> |
| 9 | 9 |
| 10 #include <algorithm> | 10 #include <algorithm> |
| 11 #include <iterator> | 11 #include <iterator> |
| 12 #include <utility> | 12 #include <utility> |
| 13 | 13 |
| 14 #include "base/metrics/histogram_macros.h" | |
| 14 #include "base/strings/string_number_conversions.h" | 15 #include "base/strings/string_number_conversions.h" |
| 15 #include "base/strings/string_split.h" | 16 #include "base/strings/string_split.h" |
| 16 #include "base/strings/string_util.h" | 17 #include "base/strings/string_util.h" |
| 17 #include "base/strings/utf_string_conversions.h" | 18 #include "base/strings/utf_string_conversions.h" |
| 18 #include "base/win/enum_variant.h" | 19 #include "base/win/enum_variant.h" |
| 19 #include "base/win/scoped_comptr.h" | 20 #include "base/win/scoped_comptr.h" |
| 20 #include "base/win/windows_version.h" | 21 #include "base/win/windows_version.h" |
| 21 #include "content/browser/accessibility/browser_accessibility_event_win.h" | 22 #include "content/browser/accessibility/browser_accessibility_event_win.h" |
| 22 #include "content/browser/accessibility/browser_accessibility_manager_win.h" | 23 #include "content/browser/accessibility/browser_accessibility_manager_win.h" |
| 23 #include "content/browser/accessibility/browser_accessibility_state_impl.h" | 24 #include "content/browser/accessibility/browser_accessibility_state_impl.h" |
| 24 #include "content/common/accessibility_messages.h" | 25 #include "content/common/accessibility_messages.h" |
| 25 #include "content/public/common/content_client.h" | 26 #include "content/public/common/content_client.h" |
| 26 #include "third_party/skia/include/core/SkColor.h" | 27 #include "third_party/skia/include/core/SkColor.h" |
| 27 #include "ui/accessibility/ax_text_utils.h" | 28 #include "ui/accessibility/ax_text_utils.h" |
| 28 #include "ui/base/win/accessibility_ids_win.h" | 29 #include "ui/base/win/accessibility_ids_win.h" |
| 29 #include "ui/base/win/accessibility_misc_utils.h" | 30 #include "ui/base/win/accessibility_misc_utils.h" |
| 30 #include "ui/base/win/atl_module.h" | 31 #include "ui/base/win/atl_module.h" |
| 31 | 32 |
| 32 namespace content { | 33 namespace content { |
| 33 | 34 |
| 35 enum { | |
|
Mark P
2016/09/15 23:36:56
optional: Consider an anonymous namespace.
Mark P
2016/09/15 23:36:56
Please put a comment here, something like
// These
dmazzoni
2016/09/16 16:27:15
Done
| |
| 36 UMA_API_ACC_DO_DEFAULT_ACTION = 0, | |
| 37 UMA_API_ACC_HIT_TEST, | |
|
Mark P
2016/09/15 23:36:56
Please explicitly do =1, =2, etc. This will make
dmazzoni
2016/09/16 16:27:16
Done. That also makes it easier to spot-check that
| |
| 38 UMA_API_ACC_LOCATION, | |
| 39 UMA_API_ACC_NAVIGATE, | |
| 40 UMA_API_ACC_SELECT, | |
| 41 UMA_API_ADD_SELECTION, | |
| 42 UMA_API_DO_ACTION, | |
| 43 UMA_API_GET_ACCESSIBLE_AT, | |
| 44 UMA_API_GET_ACC_CHILD, | |
| 45 UMA_API_GET_ACC_CHILD_COUNT, | |
| 46 UMA_API_GET_ACC_DEFAULT_ACTION, | |
| 47 UMA_API_GET_ACC_DESCRIPTION, | |
| 48 UMA_API_GET_ACC_FOCUS, | |
| 49 UMA_API_GET_ACC_HELP, | |
| 50 UMA_API_GET_ACC_HELP_TOPIC, | |
| 51 UMA_API_GET_ACC_KEYBOARD_SHORTCUT, | |
| 52 UMA_API_GET_ACC_NAME, | |
| 53 UMA_API_GET_ACC_PARENT, | |
| 54 UMA_API_GET_ACC_ROLE, | |
| 55 UMA_API_GET_ACC_SELECTION, | |
| 56 UMA_API_GET_ACC_STATE, | |
| 57 UMA_API_GET_ACC_VALUE, | |
| 58 UMA_API_GET_ANCHOR, | |
| 59 UMA_API_GET_ANCHOR_TARGET, | |
| 60 UMA_API_GET_APP_NAME, | |
| 61 UMA_API_GET_APP_VERSION, | |
| 62 UMA_API_GET_ATTRIBUTES_FOR_NAMES, | |
| 63 UMA_API_GET_CAPTION, | |
| 64 UMA_API_GET_CARET_OFFSET, | |
| 65 UMA_API_GET_CELL_AT, | |
| 66 UMA_API_GET_CHARACTER_EXTENTS, | |
| 67 UMA_API_GET_CHILD_AT, | |
| 68 UMA_API_GET_CHILD_INDEX, | |
| 69 UMA_API_GET_CLIPPED_SUBSTRING_BOUNDS, | |
| 70 UMA_API_GET_COLUMN_DESCRIPTION, | |
| 71 UMA_API_GET_COLUMN_EXTENT, | |
| 72 UMA_API_GET_COLUMN_EXTENT_AT, | |
| 73 UMA_API_GET_COLUMN_HEADER, | |
| 74 UMA_API_GET_COLUMN_HEADER_CELLS, | |
| 75 UMA_API_GET_COLUMN_INDEX, | |
| 76 UMA_API_GET_COMPUTED_STYLE, | |
| 77 UMA_API_GET_COMPUTED_STYLE_FOR_PROPERTIES, | |
| 78 UMA_API_GET_CURRENT_VALUE, | |
| 79 UMA_API_GET_DESCRIPTION, | |
| 80 UMA_API_GET_DOC_TYPE, | |
| 81 UMA_API_GET_DOM_TEXT, | |
| 82 UMA_API_GET_END_INDEX, | |
| 83 UMA_API_GET_EXTENDED_ROLE, | |
| 84 UMA_API_GET_FIRST_CHILD, | |
| 85 UMA_API_GET_FONT_FAMILY, | |
| 86 UMA_API_GET_GROUP_POSITION, | |
| 87 UMA_API_GET_HOST_RAW_ELEMENT_PROVIDER, | |
| 88 UMA_API_GET_HYPERLINK, | |
| 89 UMA_API_GET_HYPERLINK_INDEX, | |
| 90 UMA_API_GET_IMAGE_POSITION, | |
| 91 UMA_API_GET_IMAGE_SIZE, | |
| 92 UMA_API_GET_INDEX_IN_PARENT, | |
| 93 UMA_API_GET_INNER_HTML, | |
| 94 UMA_API_GET_IS_COLUMN_SELECTED, | |
| 95 UMA_API_GET_IS_ROW_SELECTED, | |
| 96 UMA_API_GET_IS_SELECTED, | |
| 97 UMA_API_GET_KEY_BINDING, | |
| 98 UMA_API_GET_LANGUAGE, | |
| 99 UMA_API_GET_LAST_CHILD, | |
| 100 UMA_API_GET_LOCALE, | |
| 101 UMA_API_GET_MAXIMUM_VALUE, | |
| 102 UMA_API_GET_MIME_TYPE, | |
| 103 UMA_API_GET_MINIMUM_VALUE, | |
| 104 UMA_API_GET_NAME, | |
| 105 UMA_API_GET_NEW_TEXT, | |
| 106 UMA_API_GET_NEXT_SIBLING, | |
| 107 UMA_API_GET_NODE_INFO, | |
| 108 UMA_API_GET_N_CHARACTERS, | |
| 109 UMA_API_GET_N_COLUMNS, | |
| 110 UMA_API_GET_N_HYPERLINKS, | |
| 111 UMA_API_GET_N_RELATIONS, | |
| 112 UMA_API_GET_N_ROWS, | |
| 113 UMA_API_GET_N_SELECTED_CELLS, | |
| 114 UMA_API_GET_N_SELECTED_CHILDREN, | |
| 115 UMA_API_GET_N_SELECTED_COLUMNS, | |
| 116 UMA_API_GET_N_SELECTED_ROWS, | |
| 117 UMA_API_GET_N_SELECTIONS, | |
| 118 UMA_API_GET_OFFSET_AT_POINT, | |
| 119 UMA_API_GET_OLD_TEXT, | |
| 120 UMA_API_GET_PARENT_NODE, | |
| 121 UMA_API_GET_PATTERN_PROVIDER, | |
| 122 UMA_API_GET_PREVIOUS_SIBLING, | |
| 123 UMA_API_GET_PROPERTY_VALUE, | |
| 124 UMA_API_GET_PROVIDER_OPTIONS, | |
| 125 UMA_API_GET_RELATION, | |
| 126 UMA_API_GET_RELATIONS, | |
| 127 UMA_API_GET_ROW_COLUMN_EXTENTS, | |
| 128 UMA_API_GET_ROW_COLUMN_EXTENTS_AT_INDEX, | |
| 129 UMA_API_GET_ROW_DESCRIPTION, | |
| 130 UMA_API_GET_ROW_EXTENT, | |
| 131 UMA_API_GET_ROW_EXTENT_AT, | |
| 132 UMA_API_GET_ROW_HEADER, | |
| 133 UMA_API_GET_ROW_HEADER_CELLS, | |
| 134 UMA_API_GET_ROW_INDEX, | |
| 135 UMA_API_GET_RUNTIME_ID, | |
| 136 UMA_API_GET_SELECTED_CELLS, | |
| 137 UMA_API_GET_SELECTED_CHILDREN, | |
| 138 UMA_API_GET_SELECTED_COLUMNS, | |
| 139 UMA_API_GET_SELECTED_ROWS, | |
| 140 UMA_API_GET_SELECTION, | |
| 141 UMA_API_GET_START_INDEX, | |
| 142 UMA_API_GET_STATES, | |
| 143 UMA_API_GET_STRING_ATTRIBUTE_AS_BSTR, | |
| 144 UMA_API_GET_SUMMARY, | |
| 145 UMA_API_GET_TABLE, | |
| 146 UMA_API_GET_TEXT, | |
| 147 UMA_API_GET_TEXT_AFTER_OFFSET, | |
| 148 UMA_API_GET_TEXT_AT_OFFSET, | |
| 149 UMA_API_GET_TEXT_BEFORE_OFFSET, | |
| 150 UMA_API_GET_TITLE, | |
| 151 UMA_API_GET_TOOLKIT_NAME, | |
| 152 UMA_API_GET_TOOLKIT_VERSION, | |
| 153 UMA_API_GET_UNCLIPPED_SUBSTRING_BOUNDS, | |
| 154 UMA_API_GET_UNIQUE_ID, | |
| 155 UMA_API_GET_URL, | |
| 156 UMA_API_GET_VALID, | |
| 157 UMA_API_GET_WINDOW_HANDLE, | |
| 158 UMA_API_IA2_GET_ATTRIBUTES, | |
| 159 UMA_API_IA2_SCROLL_TO, | |
| 160 UMA_API_IATEXT_GET_ATTRIBUTES, | |
| 161 UMA_API_ISIMPLEDOMNODE_GET_ATTRIBUTES, | |
| 162 UMA_API_ISIMPLEDOMNODE_SCROLL_TO, | |
| 163 UMA_API_N_ACTIONS, | |
| 164 UMA_API_QUERY_SERVICE, | |
| 165 UMA_API_REMOVE_SELECTION, | |
| 166 UMA_API_ROLE, | |
| 167 UMA_API_SCROLL_SUBSTRING_TO, | |
| 168 UMA_API_SCROLL_SUBSTRING_TO_POINT, | |
| 169 UMA_API_SCROLL_TO_POINT, | |
| 170 UMA_API_SCROLL_TO_SUBSTRING, | |
| 171 UMA_API_SELECT_COLUMN, | |
| 172 UMA_API_SELECT_ROW, | |
| 173 UMA_API_SET_CARET_OFFSET, | |
| 174 UMA_API_SET_CURRENT_VALUE, | |
| 175 UMA_API_SET_SELECTION, | |
| 176 UMA_API_TABLE2_GET_SELECTED_COLUMNS, | |
| 177 UMA_API_TABLE2_GET_SELECTED_ROWS, | |
| 178 UMA_API_TABLECELL_GET_COLUMN_INDEX, | |
| 179 UMA_API_TABLECELL_GET_IS_SELECTED, | |
| 180 UMA_API_TABLECELL_GET_ROW_INDEX, | |
| 181 UMA_API_UNSELECT_COLUMN, | |
| 182 UMA_API_UNSELECT_ROW, | |
| 183 UMA_API_MAX | |
|
Mark P
2016/09/15 23:36:56
Comment this last entry.
// This enum value must b
dmazzoni
2016/09/16 16:27:15
Done
| |
| 184 }; | |
| 185 | |
| 186 #define WIN_ACCESSIBILITY_API_HISTOGRAM(enum_value) \ | |
| 187 UMA_HISTOGRAM_ENUMERATION("Accessibility.WinAPIs", enum_value, UMA_API_MAX) | |
| 188 | |
| 34 // These nonstandard GUIDs are taken directly from the Mozilla sources | 189 // These nonstandard GUIDs are taken directly from the Mozilla sources |
| 35 // (accessible/src/msaa/nsAccessNodeWrap.cpp); some documentation is here: | 190 // (accessible/src/msaa/nsAccessNodeWrap.cpp); some documentation is here: |
| 36 // http://developer.mozilla.org/en/Accessibility/AT-APIs/ImplementationFeatures/ MSAA | 191 // http://developer.mozilla.org/en/Accessibility/AT-APIs/ImplementationFeatures/ MSAA |
| 37 const GUID GUID_ISimpleDOM = {0x0c539790, | 192 const GUID GUID_ISimpleDOM = {0x0c539790, |
| 38 0x12e4, | 193 0x12e4, |
| 39 0x11cf, | 194 0x11cf, |
| 40 {0xb6, 0x61, 0x00, 0xaa, 0x00, 0x4c, 0xd6, 0xd8}}; | 195 {0xb6, 0x61, 0x00, 0xaa, 0x00, 0x4c, 0xd6, 0xd8}}; |
| 41 const GUID GUID_IAccessibleContentDocument = { | 196 const GUID GUID_IAccessibleContentDocument = { |
| 42 0xa5d8e1f3, | 197 0xa5d8e1f3, |
| 43 0x3571, | 198 0x3571, |
| (...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 229 // | 384 // |
| 230 // IAccessible methods. | 385 // IAccessible methods. |
| 231 // | 386 // |
| 232 // Conventions: | 387 // Conventions: |
| 233 // * Always test for instance_active() first and return E_FAIL if it's false. | 388 // * Always test for instance_active() first and return E_FAIL if it's false. |
| 234 // * Always check for invalid arguments first, even if they're unused. | 389 // * Always check for invalid arguments first, even if they're unused. |
| 235 // * Return S_FALSE if the only output is a string argument and it's empty. | 390 // * Return S_FALSE if the only output is a string argument and it's empty. |
| 236 // | 391 // |
| 237 | 392 |
| 238 HRESULT BrowserAccessibilityWin::accDoDefaultAction(VARIANT var_id) { | 393 HRESULT BrowserAccessibilityWin::accDoDefaultAction(VARIANT var_id) { |
| 394 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_ACC_DO_DEFAULT_ACTION); | |
| 239 if (!instance_active()) | 395 if (!instance_active()) |
| 240 return E_FAIL; | 396 return E_FAIL; |
| 241 | 397 |
| 242 BrowserAccessibilityWin* target = GetTargetFromChildID(var_id); | 398 BrowserAccessibilityWin* target = GetTargetFromChildID(var_id); |
| 243 if (!target) | 399 if (!target) |
| 244 return E_INVALIDARG; | 400 return E_INVALIDARG; |
| 245 | 401 |
| 246 // Return an error if it's not clickable. | 402 // Return an error if it's not clickable. |
| 247 if (!target->HasStringAttribute(ui::AX_ATTR_ACTION)) | 403 if (!target->HasStringAttribute(ui::AX_ATTR_ACTION)) |
| 248 return DISP_E_MEMBERNOTFOUND; | 404 return DISP_E_MEMBERNOTFOUND; |
| 249 | 405 |
| 250 manager()->DoDefaultAction(*target); | 406 manager()->DoDefaultAction(*target); |
| 251 return S_OK; | 407 return S_OK; |
| 252 } | 408 } |
| 253 | 409 |
| 254 STDMETHODIMP BrowserAccessibilityWin::accHitTest(LONG x_left, | 410 STDMETHODIMP BrowserAccessibilityWin::accHitTest(LONG x_left, |
| 255 LONG y_top, | 411 LONG y_top, |
| 256 VARIANT* child) { | 412 VARIANT* child) { |
| 413 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_ACC_HIT_TEST); | |
| 257 if (!instance_active()) | 414 if (!instance_active()) |
| 258 return E_FAIL; | 415 return E_FAIL; |
| 259 | 416 |
| 260 if (!child) | 417 if (!child) |
| 261 return E_INVALIDARG; | 418 return E_INVALIDARG; |
| 262 | 419 |
| 263 gfx::Point point(x_left, y_top); | 420 gfx::Point point(x_left, y_top); |
| 264 if (!GetScreenBoundsRect().Contains(point)) { | 421 if (!GetScreenBoundsRect().Contains(point)) { |
| 265 // Return S_FALSE and VT_EMPTY when outside the object's boundaries. | 422 // Return S_FALSE and VT_EMPTY when outside the object's boundaries. |
| 266 child->vt = VT_EMPTY; | 423 child->vt = VT_EMPTY; |
| (...skipping 10 matching lines...) Expand all Loading... | |
| 277 child->pdispVal = ToBrowserAccessibilityWin(result)->NewReference(); | 434 child->pdispVal = ToBrowserAccessibilityWin(result)->NewReference(); |
| 278 } | 435 } |
| 279 return S_OK; | 436 return S_OK; |
| 280 } | 437 } |
| 281 | 438 |
| 282 STDMETHODIMP BrowserAccessibilityWin::accLocation(LONG* x_left, | 439 STDMETHODIMP BrowserAccessibilityWin::accLocation(LONG* x_left, |
| 283 LONG* y_top, | 440 LONG* y_top, |
| 284 LONG* width, | 441 LONG* width, |
| 285 LONG* height, | 442 LONG* height, |
| 286 VARIANT var_id) { | 443 VARIANT var_id) { |
| 444 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_ACC_LOCATION); | |
| 287 if (!instance_active()) | 445 if (!instance_active()) |
| 288 return E_FAIL; | 446 return E_FAIL; |
| 289 | 447 |
| 290 if (!x_left || !y_top || !width || !height) | 448 if (!x_left || !y_top || !width || !height) |
| 291 return E_INVALIDARG; | 449 return E_INVALIDARG; |
| 292 | 450 |
| 293 BrowserAccessibilityWin* target = GetTargetFromChildID(var_id); | 451 BrowserAccessibilityWin* target = GetTargetFromChildID(var_id); |
| 294 if (!target) | 452 if (!target) |
| 295 return E_INVALIDARG; | 453 return E_INVALIDARG; |
| 296 | 454 |
| 297 gfx::Rect bounds = target->GetScreenBoundsRect(); | 455 gfx::Rect bounds = target->GetScreenBoundsRect(); |
| 298 *x_left = bounds.x(); | 456 *x_left = bounds.x(); |
| 299 *y_top = bounds.y(); | 457 *y_top = bounds.y(); |
| 300 *width = bounds.width(); | 458 *width = bounds.width(); |
| 301 *height = bounds.height(); | 459 *height = bounds.height(); |
| 302 | 460 |
| 303 return S_OK; | 461 return S_OK; |
| 304 } | 462 } |
| 305 | 463 |
| 306 STDMETHODIMP BrowserAccessibilityWin::accNavigate(LONG nav_dir, | 464 STDMETHODIMP BrowserAccessibilityWin::accNavigate(LONG nav_dir, |
| 307 VARIANT start, | 465 VARIANT start, |
| 308 VARIANT* end) { | 466 VARIANT* end) { |
| 467 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_ACC_NAVIGATE); | |
| 309 BrowserAccessibilityWin* target = GetTargetFromChildID(start); | 468 BrowserAccessibilityWin* target = GetTargetFromChildID(start); |
| 310 if (!target) | 469 if (!target) |
| 311 return E_INVALIDARG; | 470 return E_INVALIDARG; |
| 312 | 471 |
| 313 if ((nav_dir == NAVDIR_LASTCHILD || nav_dir == NAVDIR_FIRSTCHILD) && | 472 if ((nav_dir == NAVDIR_LASTCHILD || nav_dir == NAVDIR_FIRSTCHILD) && |
| 314 start.lVal != CHILDID_SELF) { | 473 start.lVal != CHILDID_SELF) { |
| 315 // MSAA states that navigating to first/last child can only be from self. | 474 // MSAA states that navigating to first/last child can only be from self. |
| 316 return E_INVALIDARG; | 475 return E_INVALIDARG; |
| 317 } | 476 } |
| 318 | 477 |
| (...skipping 28 matching lines...) Expand all Loading... | |
| 347 return S_FALSE; | 506 return S_FALSE; |
| 348 } | 507 } |
| 349 | 508 |
| 350 end->vt = VT_DISPATCH; | 509 end->vt = VT_DISPATCH; |
| 351 end->pdispVal = ToBrowserAccessibilityWin(result)->NewReference(); | 510 end->pdispVal = ToBrowserAccessibilityWin(result)->NewReference(); |
| 352 return S_OK; | 511 return S_OK; |
| 353 } | 512 } |
| 354 | 513 |
| 355 STDMETHODIMP BrowserAccessibilityWin::get_accChild(VARIANT var_child, | 514 STDMETHODIMP BrowserAccessibilityWin::get_accChild(VARIANT var_child, |
| 356 IDispatch** disp_child) { | 515 IDispatch** disp_child) { |
| 516 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_ACC_CHILD); | |
| 357 if (!instance_active()) | 517 if (!instance_active()) |
| 358 return E_FAIL; | 518 return E_FAIL; |
| 359 | 519 |
| 360 if (!disp_child) | 520 if (!disp_child) |
| 361 return E_INVALIDARG; | 521 return E_INVALIDARG; |
| 362 | 522 |
| 363 *disp_child = NULL; | 523 *disp_child = NULL; |
| 364 | 524 |
| 365 BrowserAccessibilityWin* target = GetTargetFromChildID(var_child); | 525 BrowserAccessibilityWin* target = GetTargetFromChildID(var_child); |
| 366 if (!target) | 526 if (!target) |
| 367 return E_INVALIDARG; | 527 return E_INVALIDARG; |
| 368 | 528 |
| 369 (*disp_child) = target->NewReference(); | 529 (*disp_child) = target->NewReference(); |
| 370 return S_OK; | 530 return S_OK; |
| 371 } | 531 } |
| 372 | 532 |
| 373 STDMETHODIMP BrowserAccessibilityWin::get_accChildCount(LONG* child_count) { | 533 STDMETHODIMP BrowserAccessibilityWin::get_accChildCount(LONG* child_count) { |
| 534 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_ACC_CHILD_COUNT); | |
| 374 if (!instance_active()) | 535 if (!instance_active()) |
| 375 return E_FAIL; | 536 return E_FAIL; |
| 376 | 537 |
| 377 if (!child_count) | 538 if (!child_count) |
| 378 return E_INVALIDARG; | 539 return E_INVALIDARG; |
| 379 | 540 |
| 380 *child_count = PlatformChildCount(); | 541 *child_count = PlatformChildCount(); |
| 381 | 542 |
| 382 return S_OK; | 543 return S_OK; |
| 383 } | 544 } |
| 384 | 545 |
| 385 STDMETHODIMP BrowserAccessibilityWin::get_accDefaultAction(VARIANT var_id, | 546 STDMETHODIMP BrowserAccessibilityWin::get_accDefaultAction(VARIANT var_id, |
| 386 BSTR* def_action) { | 547 BSTR* def_action) { |
| 548 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_ACC_DEFAULT_ACTION); | |
| 387 if (!instance_active()) | 549 if (!instance_active()) |
| 388 return E_FAIL; | 550 return E_FAIL; |
| 389 | 551 |
| 390 if (!def_action) | 552 if (!def_action) |
| 391 return E_INVALIDARG; | 553 return E_INVALIDARG; |
| 392 | 554 |
| 393 BrowserAccessibilityWin* target = GetTargetFromChildID(var_id); | 555 BrowserAccessibilityWin* target = GetTargetFromChildID(var_id); |
| 394 if (!target) | 556 if (!target) |
| 395 return E_INVALIDARG; | 557 return E_INVALIDARG; |
| 396 | 558 |
| 397 return target->GetStringAttributeAsBstr( | 559 return target->GetStringAttributeAsBstr( |
| 398 ui::AX_ATTR_ACTION, def_action); | 560 ui::AX_ATTR_ACTION, def_action); |
| 399 } | 561 } |
| 400 | 562 |
| 401 STDMETHODIMP BrowserAccessibilityWin::get_accDescription(VARIANT var_id, | 563 STDMETHODIMP BrowserAccessibilityWin::get_accDescription(VARIANT var_id, |
| 402 BSTR* desc) { | 564 BSTR* desc) { |
| 565 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_ACC_DESCRIPTION); | |
| 403 if (!instance_active()) | 566 if (!instance_active()) |
| 404 return E_FAIL; | 567 return E_FAIL; |
| 405 | 568 |
| 406 if (!desc) | 569 if (!desc) |
| 407 return E_INVALIDARG; | 570 return E_INVALIDARG; |
| 408 | 571 |
| 409 BrowserAccessibilityWin* target = GetTargetFromChildID(var_id); | 572 BrowserAccessibilityWin* target = GetTargetFromChildID(var_id); |
| 410 if (!target) | 573 if (!target) |
| 411 return E_INVALIDARG; | 574 return E_INVALIDARG; |
| 412 | 575 |
| 413 base::string16 description_str = target->description(); | 576 base::string16 description_str = target->description(); |
| 414 if (description_str.empty()) | 577 if (description_str.empty()) |
| 415 return S_FALSE; | 578 return S_FALSE; |
| 416 | 579 |
| 417 *desc = SysAllocString(description_str.c_str()); | 580 *desc = SysAllocString(description_str.c_str()); |
| 418 | 581 |
| 419 DCHECK(*desc); | 582 DCHECK(*desc); |
| 420 return S_OK; | 583 return S_OK; |
| 421 } | 584 } |
| 422 | 585 |
| 423 STDMETHODIMP BrowserAccessibilityWin::get_accFocus(VARIANT* focus_child) { | 586 STDMETHODIMP BrowserAccessibilityWin::get_accFocus(VARIANT* focus_child) { |
| 587 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_ACC_FOCUS); | |
| 424 if (!instance_active()) | 588 if (!instance_active()) |
| 425 return E_FAIL; | 589 return E_FAIL; |
| 426 | 590 |
| 427 if (!focus_child) | 591 if (!focus_child) |
| 428 return E_INVALIDARG; | 592 return E_INVALIDARG; |
| 429 | 593 |
| 430 BrowserAccessibilityWin* focus = static_cast<BrowserAccessibilityWin*>( | 594 BrowserAccessibilityWin* focus = static_cast<BrowserAccessibilityWin*>( |
| 431 manager()->GetFocus()); | 595 manager()->GetFocus()); |
| 432 if (focus == this) { | 596 if (focus == this) { |
| 433 focus_child->vt = VT_I4; | 597 focus_child->vt = VT_I4; |
| 434 focus_child->lVal = CHILDID_SELF; | 598 focus_child->lVal = CHILDID_SELF; |
| 435 } else if (focus == NULL) { | 599 } else if (focus == NULL) { |
| 436 focus_child->vt = VT_EMPTY; | 600 focus_child->vt = VT_EMPTY; |
| 437 } else { | 601 } else { |
| 438 focus_child->vt = VT_DISPATCH; | 602 focus_child->vt = VT_DISPATCH; |
| 439 focus_child->pdispVal = focus->NewReference(); | 603 focus_child->pdispVal = focus->NewReference(); |
| 440 } | 604 } |
| 441 | 605 |
| 442 return S_OK; | 606 return S_OK; |
| 443 } | 607 } |
| 444 | 608 |
| 445 STDMETHODIMP BrowserAccessibilityWin::get_accHelp(VARIANT var_id, BSTR* help) { | 609 STDMETHODIMP BrowserAccessibilityWin::get_accHelp(VARIANT var_id, BSTR* help) { |
| 610 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_ACC_HELP); | |
| 446 if (!instance_active()) | 611 if (!instance_active()) |
| 447 return E_FAIL; | 612 return E_FAIL; |
| 448 | 613 |
| 449 if (!help) | 614 if (!help) |
| 450 return E_INVALIDARG; | 615 return E_INVALIDARG; |
| 451 | 616 |
| 452 return S_FALSE; | 617 return S_FALSE; |
| 453 } | 618 } |
| 454 | 619 |
| 455 STDMETHODIMP BrowserAccessibilityWin::get_accKeyboardShortcut(VARIANT var_id, | 620 STDMETHODIMP BrowserAccessibilityWin::get_accKeyboardShortcut(VARIANT var_id, |
| 456 BSTR* acc_key) { | 621 BSTR* acc_key) { |
| 622 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_ACC_KEYBOARD_SHORTCUT); | |
| 457 if (!instance_active()) | 623 if (!instance_active()) |
| 458 return E_FAIL; | 624 return E_FAIL; |
| 459 | 625 |
| 460 if (!acc_key) | 626 if (!acc_key) |
| 461 return E_INVALIDARG; | 627 return E_INVALIDARG; |
| 462 | 628 |
| 463 BrowserAccessibilityWin* target = GetTargetFromChildID(var_id); | 629 BrowserAccessibilityWin* target = GetTargetFromChildID(var_id); |
| 464 if (!target) | 630 if (!target) |
| 465 return E_INVALIDARG; | 631 return E_INVALIDARG; |
| 466 | 632 |
| 467 return target->GetStringAttributeAsBstr( | 633 return target->GetStringAttributeAsBstr( |
| 468 ui::AX_ATTR_SHORTCUT, acc_key); | 634 ui::AX_ATTR_SHORTCUT, acc_key); |
| 469 } | 635 } |
| 470 | 636 |
| 471 STDMETHODIMP BrowserAccessibilityWin::get_accName(VARIANT var_id, BSTR* name) { | 637 STDMETHODIMP BrowserAccessibilityWin::get_accName(VARIANT var_id, BSTR* name) { |
| 638 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_ACC_NAME); | |
| 472 if (!instance_active()) | 639 if (!instance_active()) |
| 473 return E_FAIL; | 640 return E_FAIL; |
| 474 | 641 |
| 475 if (!name) | 642 if (!name) |
| 476 return E_INVALIDARG; | 643 return E_INVALIDARG; |
| 477 | 644 |
| 478 BrowserAccessibilityWin* target = GetTargetFromChildID(var_id); | 645 BrowserAccessibilityWin* target = GetTargetFromChildID(var_id); |
| 479 if (!target) | 646 if (!target) |
| 480 return E_INVALIDARG; | 647 return E_INVALIDARG; |
| 481 | 648 |
| 482 base::string16 name_str = target->name(); | 649 base::string16 name_str = target->name(); |
| 483 if (name_str.empty()) { | 650 if (name_str.empty()) { |
| 484 if (target->ia2_role() == ROLE_SYSTEM_DOCUMENT && GetParent()) { | 651 if (target->ia2_role() == ROLE_SYSTEM_DOCUMENT && GetParent()) { |
| 485 // Hack: Some versions of JAWS crash if they get an empty name on | 652 // Hack: Some versions of JAWS crash if they get an empty name on |
| 486 // a document that's the child of an iframe, so always return a | 653 // a document that's the child of an iframe, so always return a |
| 487 // nonempty string for this role. https://crbug.com/583057 | 654 // nonempty string for this role. https://crbug.com/583057 |
| 488 name_str = L" "; | 655 name_str = L" "; |
| 489 } else { | 656 } else { |
| 490 return S_FALSE; | 657 return S_FALSE; |
| 491 } | 658 } |
| 492 } | 659 } |
| 493 | 660 |
| 494 *name = SysAllocString(name_str.c_str()); | 661 *name = SysAllocString(name_str.c_str()); |
| 495 | 662 |
| 496 DCHECK(*name); | 663 DCHECK(*name); |
| 497 return S_OK; | 664 return S_OK; |
| 498 } | 665 } |
| 499 | 666 |
| 500 STDMETHODIMP BrowserAccessibilityWin::get_accParent(IDispatch** disp_parent) { | 667 STDMETHODIMP BrowserAccessibilityWin::get_accParent(IDispatch** disp_parent) { |
| 668 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_ACC_PARENT); | |
| 501 if (!instance_active()) | 669 if (!instance_active()) |
| 502 return E_FAIL; | 670 return E_FAIL; |
| 503 | 671 |
| 504 if (!disp_parent) | 672 if (!disp_parent) |
| 505 return E_INVALIDARG; | 673 return E_INVALIDARG; |
| 506 | 674 |
| 507 IAccessible* parent_obj = ToBrowserAccessibilityWin(GetParent()); | 675 IAccessible* parent_obj = ToBrowserAccessibilityWin(GetParent()); |
| 508 if (parent_obj == NULL) { | 676 if (parent_obj == NULL) { |
| 509 // This happens if we're the root of the tree; | 677 // This happens if we're the root of the tree; |
| 510 // return the IAccessible for the window. | 678 // return the IAccessible for the window. |
| (...skipping 10 matching lines...) Expand all Loading... | |
| 521 return E_FAIL; | 689 return E_FAIL; |
| 522 } | 690 } |
| 523 } | 691 } |
| 524 parent_obj->AddRef(); | 692 parent_obj->AddRef(); |
| 525 *disp_parent = parent_obj; | 693 *disp_parent = parent_obj; |
| 526 return S_OK; | 694 return S_OK; |
| 527 } | 695 } |
| 528 | 696 |
| 529 STDMETHODIMP BrowserAccessibilityWin::get_accRole(VARIANT var_id, | 697 STDMETHODIMP BrowserAccessibilityWin::get_accRole(VARIANT var_id, |
| 530 VARIANT* role) { | 698 VARIANT* role) { |
| 699 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_ACC_ROLE); | |
| 531 if (!instance_active()) | 700 if (!instance_active()) |
| 532 return E_FAIL; | 701 return E_FAIL; |
| 533 | 702 |
| 534 if (!role) | 703 if (!role) |
| 535 return E_INVALIDARG; | 704 return E_INVALIDARG; |
| 536 | 705 |
| 537 BrowserAccessibilityWin* target = GetTargetFromChildID(var_id); | 706 BrowserAccessibilityWin* target = GetTargetFromChildID(var_id); |
| 538 if (!target) | 707 if (!target) |
| 539 return E_INVALIDARG; | 708 return E_INVALIDARG; |
| 540 | 709 |
| 541 if (!target->role_name().empty()) { | 710 if (!target->role_name().empty()) { |
| 542 role->vt = VT_BSTR; | 711 role->vt = VT_BSTR; |
| 543 role->bstrVal = SysAllocString(target->role_name().c_str()); | 712 role->bstrVal = SysAllocString(target->role_name().c_str()); |
| 544 } else { | 713 } else { |
| 545 role->vt = VT_I4; | 714 role->vt = VT_I4; |
| 546 role->lVal = target->ia_role(); | 715 role->lVal = target->ia_role(); |
| 547 } | 716 } |
| 548 return S_OK; | 717 return S_OK; |
| 549 } | 718 } |
| 550 | 719 |
| 551 STDMETHODIMP BrowserAccessibilityWin::get_accState(VARIANT var_id, | 720 STDMETHODIMP BrowserAccessibilityWin::get_accState(VARIANT var_id, |
| 552 VARIANT* state) { | 721 VARIANT* state) { |
| 722 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_ACC_STATE); | |
| 553 if (!instance_active()) | 723 if (!instance_active()) |
| 554 return E_FAIL; | 724 return E_FAIL; |
| 555 | 725 |
| 556 if (!state) | 726 if (!state) |
| 557 return E_INVALIDARG; | 727 return E_INVALIDARG; |
| 558 | 728 |
| 559 BrowserAccessibilityWin* target = GetTargetFromChildID(var_id); | 729 BrowserAccessibilityWin* target = GetTargetFromChildID(var_id); |
| 560 if (!target) | 730 if (!target) |
| 561 return E_INVALIDARG; | 731 return E_INVALIDARG; |
| 562 | 732 |
| 563 state->vt = VT_I4; | 733 state->vt = VT_I4; |
| 564 state->lVal = target->ia_state(); | 734 state->lVal = target->ia_state(); |
| 565 if (manager()->GetFocus() == this) | 735 if (manager()->GetFocus() == this) |
| 566 state->lVal |= STATE_SYSTEM_FOCUSED; | 736 state->lVal |= STATE_SYSTEM_FOCUSED; |
| 567 | 737 |
| 568 return S_OK; | 738 return S_OK; |
| 569 } | 739 } |
| 570 | 740 |
| 571 STDMETHODIMP BrowserAccessibilityWin::get_accValue(VARIANT var_id, | 741 STDMETHODIMP BrowserAccessibilityWin::get_accValue(VARIANT var_id, |
| 572 BSTR* value) { | 742 BSTR* value) { |
| 743 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_ACC_VALUE); | |
| 573 if (!instance_active()) | 744 if (!instance_active()) |
| 574 return E_FAIL; | 745 return E_FAIL; |
| 575 | 746 |
| 576 if (!value) | 747 if (!value) |
| 577 return E_INVALIDARG; | 748 return E_INVALIDARG; |
| 578 | 749 |
| 579 BrowserAccessibilityWin* target = GetTargetFromChildID(var_id); | 750 BrowserAccessibilityWin* target = GetTargetFromChildID(var_id); |
| 580 if (!target) | 751 if (!target) |
| 581 return E_INVALIDARG; | 752 return E_INVALIDARG; |
| 582 | 753 |
| (...skipping 23 matching lines...) Expand all Loading... | |
| 606 } | 777 } |
| 607 | 778 |
| 608 *value = SysAllocString(target->value().c_str()); | 779 *value = SysAllocString(target->value().c_str()); |
| 609 DCHECK(*value); | 780 DCHECK(*value); |
| 610 return S_OK; | 781 return S_OK; |
| 611 } | 782 } |
| 612 | 783 |
| 613 STDMETHODIMP BrowserAccessibilityWin::get_accHelpTopic(BSTR* help_file, | 784 STDMETHODIMP BrowserAccessibilityWin::get_accHelpTopic(BSTR* help_file, |
| 614 VARIANT var_id, | 785 VARIANT var_id, |
| 615 LONG* topic_id) { | 786 LONG* topic_id) { |
| 787 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_ACC_HELP_TOPIC); | |
| 616 return E_NOTIMPL; | 788 return E_NOTIMPL; |
| 617 } | 789 } |
| 618 | 790 |
| 619 STDMETHODIMP BrowserAccessibilityWin::get_accSelection(VARIANT* selected) { | 791 STDMETHODIMP BrowserAccessibilityWin::get_accSelection(VARIANT* selected) { |
| 792 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_ACC_SELECTION); | |
| 620 if (!instance_active()) | 793 if (!instance_active()) |
| 621 return E_FAIL; | 794 return E_FAIL; |
| 622 | 795 |
| 623 if (GetRole() != ui::AX_ROLE_LIST_BOX) | 796 if (GetRole() != ui::AX_ROLE_LIST_BOX) |
| 624 return E_NOTIMPL; | 797 return E_NOTIMPL; |
| 625 | 798 |
| 626 unsigned long selected_count = 0; | 799 unsigned long selected_count = 0; |
| 627 for (size_t i = 0; i < InternalChildCount(); ++i) { | 800 for (size_t i = 0; i < InternalChildCount(); ++i) { |
| 628 if (InternalGetChild(i)->HasState(ui::AX_STATE_SELECTED)) | 801 if (InternalGetChild(i)->HasState(ui::AX_STATE_SELECTED)) |
| 629 ++selected_count; | 802 ++selected_count; |
| (...skipping 29 matching lines...) Expand all Loading... | |
| 659 } | 832 } |
| 660 } | 833 } |
| 661 selected->vt = VT_UNKNOWN; | 834 selected->vt = VT_UNKNOWN; |
| 662 selected->punkVal = static_cast<IUnknown*>( | 835 selected->punkVal = static_cast<IUnknown*>( |
| 663 static_cast<base::win::IUnknownImpl*>(enum_variant)); | 836 static_cast<base::win::IUnknownImpl*>(enum_variant)); |
| 664 return S_OK; | 837 return S_OK; |
| 665 } | 838 } |
| 666 | 839 |
| 667 STDMETHODIMP BrowserAccessibilityWin::accSelect( | 840 STDMETHODIMP BrowserAccessibilityWin::accSelect( |
| 668 LONG flags_sel, VARIANT var_id) { | 841 LONG flags_sel, VARIANT var_id) { |
| 842 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_ACC_SELECT); | |
| 669 if (!instance_active()) | 843 if (!instance_active()) |
| 670 return E_FAIL; | 844 return E_FAIL; |
| 671 | 845 |
| 672 if (flags_sel & SELFLAG_TAKEFOCUS) { | 846 if (flags_sel & SELFLAG_TAKEFOCUS) { |
| 673 manager()->SetFocus(*this); | 847 manager()->SetFocus(*this); |
| 674 return S_OK; | 848 return S_OK; |
| 675 } | 849 } |
| 676 | 850 |
| 677 return S_FALSE; | 851 return S_FALSE; |
| 678 } | 852 } |
| 679 | 853 |
| 680 STDMETHODIMP | 854 STDMETHODIMP |
| 681 BrowserAccessibilityWin::put_accName(VARIANT var_id, BSTR put_name) { | 855 BrowserAccessibilityWin::put_accName(VARIANT var_id, BSTR put_name) { |
| 682 return E_NOTIMPL; | 856 return E_NOTIMPL; |
| 683 } | 857 } |
| 684 STDMETHODIMP | 858 STDMETHODIMP |
| 685 BrowserAccessibilityWin::put_accValue(VARIANT var_id, BSTR put_val) { | 859 BrowserAccessibilityWin::put_accValue(VARIANT var_id, BSTR put_val) { |
| 686 return E_NOTIMPL; | 860 return E_NOTIMPL; |
| 687 } | 861 } |
| 688 | 862 |
| 689 // | 863 // |
| 690 // IAccessible2 methods. | 864 // IAccessible2 methods. |
| 691 // | 865 // |
| 692 | 866 |
| 693 STDMETHODIMP BrowserAccessibilityWin::role(LONG* role) { | 867 STDMETHODIMP BrowserAccessibilityWin::role(LONG* role) { |
| 868 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_ROLE); | |
| 694 if (!instance_active()) | 869 if (!instance_active()) |
| 695 return E_FAIL; | 870 return E_FAIL; |
| 696 | 871 |
| 697 if (!role) | 872 if (!role) |
| 698 return E_INVALIDARG; | 873 return E_INVALIDARG; |
| 699 | 874 |
| 700 *role = ia2_role(); | 875 *role = ia2_role(); |
| 701 return S_OK; | 876 return S_OK; |
| 702 } | 877 } |
| 703 | 878 |
| 704 STDMETHODIMP BrowserAccessibilityWin::get_attributes(BSTR* attributes) { | 879 STDMETHODIMP BrowserAccessibilityWin::get_attributes(BSTR* attributes) { |
| 880 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_IA2_GET_ATTRIBUTES); | |
| 705 if (!attributes) | 881 if (!attributes) |
| 706 return E_INVALIDARG; | 882 return E_INVALIDARG; |
| 707 *attributes = nullptr; | 883 *attributes = nullptr; |
| 708 | 884 |
| 709 if (!instance_active()) | 885 if (!instance_active()) |
| 710 return E_FAIL; | 886 return E_FAIL; |
| 711 | 887 |
| 712 base::string16 str; | 888 base::string16 str; |
| 713 for (const base::string16& attribute : ia2_attributes()) | 889 for (const base::string16& attribute : ia2_attributes()) |
| 714 str += attribute + L';'; | 890 str += attribute + L';'; |
| 715 | 891 |
| 716 if (str.empty()) | 892 if (str.empty()) |
| 717 return S_FALSE; | 893 return S_FALSE; |
| 718 | 894 |
| 719 *attributes = SysAllocString(str.c_str()); | 895 *attributes = SysAllocString(str.c_str()); |
| 720 DCHECK(*attributes); | 896 DCHECK(*attributes); |
| 721 return S_OK; | 897 return S_OK; |
| 722 } | 898 } |
| 723 | 899 |
| 724 STDMETHODIMP BrowserAccessibilityWin::get_states(AccessibleStates* states) { | 900 STDMETHODIMP BrowserAccessibilityWin::get_states(AccessibleStates* states) { |
| 901 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_STATES); | |
| 725 if (!instance_active()) | 902 if (!instance_active()) |
| 726 return E_FAIL; | 903 return E_FAIL; |
| 727 | 904 |
| 728 if (!states) | 905 if (!states) |
| 729 return E_INVALIDARG; | 906 return E_INVALIDARG; |
| 730 | 907 |
| 731 *states = ia2_state(); | 908 *states = ia2_state(); |
| 732 | 909 |
| 733 return S_OK; | 910 return S_OK; |
| 734 } | 911 } |
| 735 | 912 |
| 736 STDMETHODIMP BrowserAccessibilityWin::get_uniqueID(LONG* unique_id) { | 913 STDMETHODIMP BrowserAccessibilityWin::get_uniqueID(LONG* unique_id) { |
| 914 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_UNIQUE_ID); | |
| 737 if (!instance_active()) | 915 if (!instance_active()) |
| 738 return E_FAIL; | 916 return E_FAIL; |
| 739 | 917 |
| 740 if (!unique_id) | 918 if (!unique_id) |
| 741 return E_INVALIDARG; | 919 return E_INVALIDARG; |
| 742 | 920 |
| 743 *unique_id = -this->unique_id(); | 921 *unique_id = -this->unique_id(); |
| 744 return S_OK; | 922 return S_OK; |
| 745 } | 923 } |
| 746 | 924 |
| 747 STDMETHODIMP BrowserAccessibilityWin::get_windowHandle(HWND* window_handle) { | 925 STDMETHODIMP BrowserAccessibilityWin::get_windowHandle(HWND* window_handle) { |
| 926 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_WINDOW_HANDLE); | |
| 748 if (!instance_active()) | 927 if (!instance_active()) |
| 749 return E_FAIL; | 928 return E_FAIL; |
| 750 | 929 |
| 751 if (!window_handle) | 930 if (!window_handle) |
| 752 return E_INVALIDARG; | 931 return E_INVALIDARG; |
| 753 | 932 |
| 754 *window_handle = | 933 *window_handle = |
| 755 manager()->ToBrowserAccessibilityManagerWin()->GetParentHWND(); | 934 manager()->ToBrowserAccessibilityManagerWin()->GetParentHWND(); |
| 756 if (!*window_handle) | 935 if (!*window_handle) |
| 757 return E_FAIL; | 936 return E_FAIL; |
| 758 | 937 |
| 759 return S_OK; | 938 return S_OK; |
| 760 } | 939 } |
| 761 | 940 |
| 762 STDMETHODIMP BrowserAccessibilityWin::get_indexInParent(LONG* index_in_parent) { | 941 STDMETHODIMP BrowserAccessibilityWin::get_indexInParent(LONG* index_in_parent) { |
| 942 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_INDEX_IN_PARENT); | |
| 763 if (!instance_active()) | 943 if (!instance_active()) |
| 764 return E_FAIL; | 944 return E_FAIL; |
| 765 | 945 |
| 766 if (!index_in_parent) | 946 if (!index_in_parent) |
| 767 return E_INVALIDARG; | 947 return E_INVALIDARG; |
| 768 | 948 |
| 769 *index_in_parent = this->GetIndexInParent(); | 949 *index_in_parent = this->GetIndexInParent(); |
| 770 return S_OK; | 950 return S_OK; |
| 771 } | 951 } |
| 772 | 952 |
| 773 STDMETHODIMP BrowserAccessibilityWin::get_nRelations(LONG* n_relations) { | 953 STDMETHODIMP BrowserAccessibilityWin::get_nRelations(LONG* n_relations) { |
| 954 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_N_RELATIONS); | |
| 774 if (!instance_active()) | 955 if (!instance_active()) |
| 775 return E_FAIL; | 956 return E_FAIL; |
| 776 | 957 |
| 777 if (!n_relations) | 958 if (!n_relations) |
| 778 return E_INVALIDARG; | 959 return E_INVALIDARG; |
| 779 | 960 |
| 780 *n_relations = relations_.size(); | 961 *n_relations = relations_.size(); |
| 781 return S_OK; | 962 return S_OK; |
| 782 } | 963 } |
| 783 | 964 |
| 784 STDMETHODIMP BrowserAccessibilityWin::get_relation( | 965 STDMETHODIMP BrowserAccessibilityWin::get_relation( |
| 785 LONG relation_index, | 966 LONG relation_index, |
| 786 IAccessibleRelation** relation) { | 967 IAccessibleRelation** relation) { |
| 968 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_RELATION); | |
| 787 if (!instance_active()) | 969 if (!instance_active()) |
| 788 return E_FAIL; | 970 return E_FAIL; |
| 789 | 971 |
| 790 if (relation_index < 0 || | 972 if (relation_index < 0 || |
| 791 relation_index >= static_cast<long>(relations_.size())) { | 973 relation_index >= static_cast<long>(relations_.size())) { |
| 792 return E_INVALIDARG; | 974 return E_INVALIDARG; |
| 793 } | 975 } |
| 794 | 976 |
| 795 if (!relation) | 977 if (!relation) |
| 796 return E_INVALIDARG; | 978 return E_INVALIDARG; |
| 797 | 979 |
| 798 relations_[relation_index]->AddRef(); | 980 relations_[relation_index]->AddRef(); |
| 799 *relation = relations_[relation_index]; | 981 *relation = relations_[relation_index]; |
| 800 return S_OK; | 982 return S_OK; |
| 801 } | 983 } |
| 802 | 984 |
| 803 STDMETHODIMP BrowserAccessibilityWin::get_relations( | 985 STDMETHODIMP BrowserAccessibilityWin::get_relations( |
| 804 LONG max_relations, | 986 LONG max_relations, |
| 805 IAccessibleRelation** relations, | 987 IAccessibleRelation** relations, |
| 806 LONG* n_relations) { | 988 LONG* n_relations) { |
| 989 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_RELATIONS); | |
| 807 if (!instance_active()) | 990 if (!instance_active()) |
| 808 return E_FAIL; | 991 return E_FAIL; |
| 809 | 992 |
| 810 if (!relations || !n_relations) | 993 if (!relations || !n_relations) |
| 811 return E_INVALIDARG; | 994 return E_INVALIDARG; |
| 812 | 995 |
| 813 long count = static_cast<long>(relations_.size()); | 996 long count = static_cast<long>(relations_.size()); |
| 814 *n_relations = count; | 997 *n_relations = count; |
| 815 if (count == 0) | 998 if (count == 0) |
| 816 return S_FALSE; | 999 return S_FALSE; |
| 817 | 1000 |
| 818 for (long i = 0; i < count; ++i) { | 1001 for (long i = 0; i < count; ++i) { |
| 819 relations_[i]->AddRef(); | 1002 relations_[i]->AddRef(); |
| 820 relations[i] = relations_[i]; | 1003 relations[i] = relations_[i]; |
| 821 } | 1004 } |
| 822 | 1005 |
| 823 return S_OK; | 1006 return S_OK; |
| 824 } | 1007 } |
| 825 | 1008 |
| 826 STDMETHODIMP BrowserAccessibilityWin::scrollTo(IA2ScrollType scroll_type) { | 1009 STDMETHODIMP BrowserAccessibilityWin::scrollTo(IA2ScrollType scroll_type) { |
| 1010 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_IA2_SCROLL_TO); | |
| 827 if (!instance_active()) | 1011 if (!instance_active()) |
| 828 return E_FAIL; | 1012 return E_FAIL; |
| 829 | 1013 |
| 830 gfx::Rect r = GetFrameBoundsRect(); | 1014 gfx::Rect r = GetFrameBoundsRect(); |
| 831 switch(scroll_type) { | 1015 switch(scroll_type) { |
| 832 case IA2_SCROLL_TYPE_TOP_LEFT: | 1016 case IA2_SCROLL_TYPE_TOP_LEFT: |
| 833 manager()->ScrollToMakeVisible(*this, gfx::Rect(r.x(), r.y(), 0, 0)); | 1017 manager()->ScrollToMakeVisible(*this, gfx::Rect(r.x(), r.y(), 0, 0)); |
| 834 break; | 1018 break; |
| 835 case IA2_SCROLL_TYPE_BOTTOM_RIGHT: | 1019 case IA2_SCROLL_TYPE_BOTTOM_RIGHT: |
| 836 manager()->ScrollToMakeVisible( | 1020 manager()->ScrollToMakeVisible( |
| (...skipping 22 matching lines...) Expand all Loading... | |
| 859 } | 1043 } |
| 860 | 1044 |
| 861 manager()->ToBrowserAccessibilityManagerWin()->TrackScrollingObject(this); | 1045 manager()->ToBrowserAccessibilityManagerWin()->TrackScrollingObject(this); |
| 862 return S_OK; | 1046 return S_OK; |
| 863 } | 1047 } |
| 864 | 1048 |
| 865 STDMETHODIMP BrowserAccessibilityWin::scrollToPoint( | 1049 STDMETHODIMP BrowserAccessibilityWin::scrollToPoint( |
| 866 IA2CoordinateType coordinate_type, | 1050 IA2CoordinateType coordinate_type, |
| 867 LONG x, | 1051 LONG x, |
| 868 LONG y) { | 1052 LONG y) { |
| 1053 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_SCROLL_TO_POINT); | |
| 869 if (!instance_active()) | 1054 if (!instance_active()) |
| 870 return E_FAIL; | 1055 return E_FAIL; |
| 871 | 1056 |
| 872 gfx::Point scroll_to(x, y); | 1057 gfx::Point scroll_to(x, y); |
| 873 | 1058 |
| 874 if (coordinate_type == IA2_COORDTYPE_SCREEN_RELATIVE) { | 1059 if (coordinate_type == IA2_COORDTYPE_SCREEN_RELATIVE) { |
| 875 scroll_to -= manager()->GetViewBounds().OffsetFromOrigin(); | 1060 scroll_to -= manager()->GetViewBounds().OffsetFromOrigin(); |
| 876 } else if (coordinate_type == IA2_COORDTYPE_PARENT_RELATIVE) { | 1061 } else if (coordinate_type == IA2_COORDTYPE_PARENT_RELATIVE) { |
| 877 if (GetParent()) | 1062 if (GetParent()) |
| 878 scroll_to += GetParent()->GetFrameBoundsRect().OffsetFromOrigin(); | 1063 scroll_to += GetParent()->GetFrameBoundsRect().OffsetFromOrigin(); |
| 879 } else { | 1064 } else { |
| 880 return E_INVALIDARG; | 1065 return E_INVALIDARG; |
| 881 } | 1066 } |
| 882 | 1067 |
| 883 manager()->ScrollToPoint(*this, scroll_to); | 1068 manager()->ScrollToPoint(*this, scroll_to); |
| 884 manager()->ToBrowserAccessibilityManagerWin()->TrackScrollingObject(this); | 1069 manager()->ToBrowserAccessibilityManagerWin()->TrackScrollingObject(this); |
| 885 | 1070 |
| 886 return S_OK; | 1071 return S_OK; |
| 887 } | 1072 } |
| 888 | 1073 |
| 889 STDMETHODIMP BrowserAccessibilityWin::get_groupPosition( | 1074 STDMETHODIMP BrowserAccessibilityWin::get_groupPosition( |
| 890 LONG* group_level, | 1075 LONG* group_level, |
| 891 LONG* similar_items_in_group, | 1076 LONG* similar_items_in_group, |
| 892 LONG* position_in_group) { | 1077 LONG* position_in_group) { |
| 1078 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_GROUP_POSITION); | |
| 893 if (!instance_active()) | 1079 if (!instance_active()) |
| 894 return E_FAIL; | 1080 return E_FAIL; |
| 895 | 1081 |
| 896 if (!group_level || !similar_items_in_group || !position_in_group) | 1082 if (!group_level || !similar_items_in_group || !position_in_group) |
| 897 return E_INVALIDARG; | 1083 return E_INVALIDARG; |
| 898 | 1084 |
| 899 *group_level = GetIntAttribute(ui::AX_ATTR_HIERARCHICAL_LEVEL); | 1085 *group_level = GetIntAttribute(ui::AX_ATTR_HIERARCHICAL_LEVEL); |
| 900 *similar_items_in_group = GetIntAttribute(ui::AX_ATTR_SET_SIZE); | 1086 *similar_items_in_group = GetIntAttribute(ui::AX_ATTR_SET_SIZE); |
| 901 *position_in_group = GetIntAttribute(ui::AX_ATTR_POS_IN_SET); | 1087 *position_in_group = GetIntAttribute(ui::AX_ATTR_POS_IN_SET); |
| 902 | 1088 |
| 903 if (*group_level == *similar_items_in_group == *position_in_group == 0) | 1089 if (*group_level == *similar_items_in_group == *position_in_group == 0) |
| 904 return S_FALSE; | 1090 return S_FALSE; |
| 905 return S_OK; | 1091 return S_OK; |
| 906 } | 1092 } |
| 907 | 1093 |
| 908 // | 1094 // |
| 909 // IAccessibleEx methods not implemented. | 1095 // IAccessibleEx methods not implemented. |
| 910 // | 1096 // |
| 911 | 1097 |
| 912 STDMETHODIMP BrowserAccessibilityWin::get_extendedRole(BSTR* extended_role) { | 1098 STDMETHODIMP BrowserAccessibilityWin::get_extendedRole(BSTR* extended_role) { |
| 1099 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_EXTENDED_ROLE); | |
| 913 return E_NOTIMPL; | 1100 return E_NOTIMPL; |
| 914 } | 1101 } |
| 915 STDMETHODIMP | 1102 STDMETHODIMP |
| 916 BrowserAccessibilityWin::get_localizedExtendedRole( | 1103 BrowserAccessibilityWin::get_localizedExtendedRole( |
| 917 BSTR* localized_extended_role) { | 1104 BSTR* localized_extended_role) { |
| 918 return E_NOTIMPL; | 1105 return E_NOTIMPL; |
|
Mark P
2016/09/15 23:36:56
You're logging the above not implemented function
| |
| 919 } | 1106 } |
| 920 STDMETHODIMP | 1107 STDMETHODIMP |
| 921 BrowserAccessibilityWin::get_nExtendedStates(LONG* n_extended_states) { | 1108 BrowserAccessibilityWin::get_nExtendedStates(LONG* n_extended_states) { |
| 922 return E_NOTIMPL; | 1109 return E_NOTIMPL; |
| 923 } | 1110 } |
| 924 STDMETHODIMP | 1111 STDMETHODIMP |
| 925 BrowserAccessibilityWin::get_extendedStates(LONG max_extended_states, | 1112 BrowserAccessibilityWin::get_extendedStates(LONG max_extended_states, |
| 926 BSTR** extended_states, | 1113 BSTR** extended_states, |
| 927 LONG* n_extended_states) { | 1114 LONG* n_extended_states) { |
| 928 return E_NOTIMPL; | 1115 return E_NOTIMPL; |
| 929 } | 1116 } |
| 930 STDMETHODIMP | 1117 STDMETHODIMP |
| 931 BrowserAccessibilityWin::get_localizedExtendedStates( | 1118 BrowserAccessibilityWin::get_localizedExtendedStates( |
| 932 LONG max_localized_extended_states, | 1119 LONG max_localized_extended_states, |
| 933 BSTR** localized_extended_states, | 1120 BSTR** localized_extended_states, |
| 934 LONG* n_localized_extended_states) { | 1121 LONG* n_localized_extended_states) { |
| 935 return E_NOTIMPL; | 1122 return E_NOTIMPL; |
| 936 } | 1123 } |
| 937 STDMETHODIMP BrowserAccessibilityWin::get_locale(IA2Locale* locale) { | 1124 STDMETHODIMP BrowserAccessibilityWin::get_locale(IA2Locale* locale) { |
| 1125 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_LOCALE); | |
| 938 return E_NOTIMPL; | 1126 return E_NOTIMPL; |
| 939 } | 1127 } |
| 940 | 1128 |
| 941 // | 1129 // |
| 942 // IAccessibleApplication methods. | 1130 // IAccessibleApplication methods. |
| 943 // | 1131 // |
| 944 | 1132 |
| 945 STDMETHODIMP BrowserAccessibilityWin::get_appName(BSTR* app_name) { | 1133 STDMETHODIMP BrowserAccessibilityWin::get_appName(BSTR* app_name) { |
| 1134 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_APP_NAME); | |
| 946 // No need to check |instance_active()| because this interface is | 1135 // No need to check |instance_active()| because this interface is |
| 947 // global, and doesn't depend on any local state. | 1136 // global, and doesn't depend on any local state. |
| 948 | 1137 |
| 949 if (!app_name) | 1138 if (!app_name) |
| 950 return E_INVALIDARG; | 1139 return E_INVALIDARG; |
| 951 | 1140 |
| 952 // GetProduct() returns a string like "Chrome/aa.bb.cc.dd", split out | 1141 // GetProduct() returns a string like "Chrome/aa.bb.cc.dd", split out |
| 953 // the part before the "/". | 1142 // the part before the "/". |
| 954 std::vector<std::string> product_components = base::SplitString( | 1143 std::vector<std::string> product_components = base::SplitString( |
| 955 GetContentClient()->GetProduct(), "/", | 1144 GetContentClient()->GetProduct(), "/", |
| 956 base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL); | 1145 base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL); |
| 957 DCHECK_EQ(2U, product_components.size()); | 1146 DCHECK_EQ(2U, product_components.size()); |
| 958 if (product_components.size() != 2) | 1147 if (product_components.size() != 2) |
| 959 return E_FAIL; | 1148 return E_FAIL; |
| 960 *app_name = SysAllocString(base::UTF8ToUTF16(product_components[0]).c_str()); | 1149 *app_name = SysAllocString(base::UTF8ToUTF16(product_components[0]).c_str()); |
| 961 DCHECK(*app_name); | 1150 DCHECK(*app_name); |
| 962 return *app_name ? S_OK : E_FAIL; | 1151 return *app_name ? S_OK : E_FAIL; |
| 963 } | 1152 } |
| 964 | 1153 |
| 965 STDMETHODIMP BrowserAccessibilityWin::get_appVersion(BSTR* app_version) { | 1154 STDMETHODIMP BrowserAccessibilityWin::get_appVersion(BSTR* app_version) { |
| 1155 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_APP_VERSION); | |
| 966 // No need to check |instance_active()| because this interface is | 1156 // No need to check |instance_active()| because this interface is |
| 967 // global, and doesn't depend on any local state. | 1157 // global, and doesn't depend on any local state. |
| 968 | 1158 |
| 969 if (!app_version) | 1159 if (!app_version) |
| 970 return E_INVALIDARG; | 1160 return E_INVALIDARG; |
| 971 | 1161 |
| 972 // GetProduct() returns a string like "Chrome/aa.bb.cc.dd", split out | 1162 // GetProduct() returns a string like "Chrome/aa.bb.cc.dd", split out |
| 973 // the part after the "/". | 1163 // the part after the "/". |
| 974 std::vector<std::string> product_components = base::SplitString( | 1164 std::vector<std::string> product_components = base::SplitString( |
| 975 GetContentClient()->GetProduct(), "/", | 1165 GetContentClient()->GetProduct(), "/", |
| 976 base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL); | 1166 base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL); |
| 977 DCHECK_EQ(2U, product_components.size()); | 1167 DCHECK_EQ(2U, product_components.size()); |
| 978 if (product_components.size() != 2) | 1168 if (product_components.size() != 2) |
| 979 return E_FAIL; | 1169 return E_FAIL; |
| 980 *app_version = | 1170 *app_version = |
| 981 SysAllocString(base::UTF8ToUTF16(product_components[1]).c_str()); | 1171 SysAllocString(base::UTF8ToUTF16(product_components[1]).c_str()); |
| 982 DCHECK(*app_version); | 1172 DCHECK(*app_version); |
| 983 return *app_version ? S_OK : E_FAIL; | 1173 return *app_version ? S_OK : E_FAIL; |
| 984 } | 1174 } |
| 985 | 1175 |
| 986 STDMETHODIMP BrowserAccessibilityWin::get_toolkitName(BSTR* toolkit_name) { | 1176 STDMETHODIMP BrowserAccessibilityWin::get_toolkitName(BSTR* toolkit_name) { |
| 1177 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_TOOLKIT_NAME); | |
| 987 // No need to check |instance_active()| because this interface is | 1178 // No need to check |instance_active()| because this interface is |
| 988 // global, and doesn't depend on any local state. | 1179 // global, and doesn't depend on any local state. |
| 989 | 1180 |
| 990 if (!toolkit_name) | 1181 if (!toolkit_name) |
| 991 return E_INVALIDARG; | 1182 return E_INVALIDARG; |
| 992 | 1183 |
| 993 // This is hard-coded; all products based on the Chromium engine | 1184 // This is hard-coded; all products based on the Chromium engine |
| 994 // will have the same toolkit name, so that assistive technology can | 1185 // will have the same toolkit name, so that assistive technology can |
| 995 // detect any Chrome-based product. | 1186 // detect any Chrome-based product. |
| 996 *toolkit_name = SysAllocString(L"Chrome"); | 1187 *toolkit_name = SysAllocString(L"Chrome"); |
| 997 DCHECK(*toolkit_name); | 1188 DCHECK(*toolkit_name); |
| 998 return *toolkit_name ? S_OK : E_FAIL; | 1189 return *toolkit_name ? S_OK : E_FAIL; |
| 999 } | 1190 } |
| 1000 | 1191 |
| 1001 STDMETHODIMP BrowserAccessibilityWin::get_toolkitVersion( | 1192 STDMETHODIMP BrowserAccessibilityWin::get_toolkitVersion( |
| 1002 BSTR* toolkit_version) { | 1193 BSTR* toolkit_version) { |
| 1194 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_TOOLKIT_VERSION); | |
| 1003 // No need to check |instance_active()| because this interface is | 1195 // No need to check |instance_active()| because this interface is |
| 1004 // global, and doesn't depend on any local state. | 1196 // global, and doesn't depend on any local state. |
| 1005 | 1197 |
| 1006 if (!toolkit_version) | 1198 if (!toolkit_version) |
| 1007 return E_INVALIDARG; | 1199 return E_INVALIDARG; |
| 1008 | 1200 |
| 1009 std::string user_agent = GetContentClient()->GetUserAgent(); | 1201 std::string user_agent = GetContentClient()->GetUserAgent(); |
| 1010 *toolkit_version = SysAllocString(base::UTF8ToUTF16(user_agent).c_str()); | 1202 *toolkit_version = SysAllocString(base::UTF8ToUTF16(user_agent).c_str()); |
| 1011 DCHECK(*toolkit_version); | 1203 DCHECK(*toolkit_version); |
| 1012 return *toolkit_version ? S_OK : E_FAIL; | 1204 return *toolkit_version ? S_OK : E_FAIL; |
| 1013 } | 1205 } |
| 1014 | 1206 |
| 1015 // | 1207 // |
| 1016 // IAccessibleImage methods. | 1208 // IAccessibleImage methods. |
| 1017 // | 1209 // |
| 1018 | 1210 |
| 1019 STDMETHODIMP BrowserAccessibilityWin::get_description(BSTR* desc) { | 1211 STDMETHODIMP BrowserAccessibilityWin::get_description(BSTR* desc) { |
| 1212 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_DESCRIPTION); | |
| 1020 if (!instance_active()) | 1213 if (!instance_active()) |
| 1021 return E_FAIL; | 1214 return E_FAIL; |
| 1022 | 1215 |
| 1023 if (!desc) | 1216 if (!desc) |
| 1024 return E_INVALIDARG; | 1217 return E_INVALIDARG; |
| 1025 | 1218 |
| 1026 if (description().empty()) | 1219 if (description().empty()) |
| 1027 return S_FALSE; | 1220 return S_FALSE; |
| 1028 | 1221 |
| 1029 *desc = SysAllocString(description().c_str()); | 1222 *desc = SysAllocString(description().c_str()); |
| 1030 | 1223 |
| 1031 DCHECK(*desc); | 1224 DCHECK(*desc); |
| 1032 return S_OK; | 1225 return S_OK; |
| 1033 } | 1226 } |
| 1034 | 1227 |
| 1035 STDMETHODIMP BrowserAccessibilityWin::get_imagePosition( | 1228 STDMETHODIMP BrowserAccessibilityWin::get_imagePosition( |
| 1036 IA2CoordinateType coordinate_type, | 1229 IA2CoordinateType coordinate_type, |
| 1037 LONG* x, | 1230 LONG* x, |
| 1038 LONG* y) { | 1231 LONG* y) { |
| 1232 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_IMAGE_POSITION); | |
| 1039 if (!instance_active()) | 1233 if (!instance_active()) |
| 1040 return E_FAIL; | 1234 return E_FAIL; |
| 1041 | 1235 |
| 1042 if (!x || !y) | 1236 if (!x || !y) |
| 1043 return E_INVALIDARG; | 1237 return E_INVALIDARG; |
| 1044 | 1238 |
| 1045 if (coordinate_type == IA2_COORDTYPE_SCREEN_RELATIVE) { | 1239 if (coordinate_type == IA2_COORDTYPE_SCREEN_RELATIVE) { |
| 1046 gfx::Rect bounds = GetScreenBoundsRect(); | 1240 gfx::Rect bounds = GetScreenBoundsRect(); |
| 1047 *x = bounds.x(); | 1241 *x = bounds.x(); |
| 1048 *y = bounds.y(); | 1242 *y = bounds.y(); |
| 1049 } else if (coordinate_type == IA2_COORDTYPE_PARENT_RELATIVE) { | 1243 } else if (coordinate_type == IA2_COORDTYPE_PARENT_RELATIVE) { |
| 1050 gfx::Rect bounds = GetPageBoundsRect(); | 1244 gfx::Rect bounds = GetPageBoundsRect(); |
| 1051 gfx::Rect parent_bounds = | 1245 gfx::Rect parent_bounds = |
| 1052 GetParent() ? GetParent()->GetPageBoundsRect() : gfx::Rect(); | 1246 GetParent() ? GetParent()->GetPageBoundsRect() : gfx::Rect(); |
| 1053 *x = bounds.x() - parent_bounds.x(); | 1247 *x = bounds.x() - parent_bounds.x(); |
| 1054 *y = bounds.y() - parent_bounds.y(); | 1248 *y = bounds.y() - parent_bounds.y(); |
| 1055 } else { | 1249 } else { |
| 1056 return E_INVALIDARG; | 1250 return E_INVALIDARG; |
| 1057 } | 1251 } |
| 1058 | 1252 |
| 1059 return S_OK; | 1253 return S_OK; |
| 1060 } | 1254 } |
| 1061 | 1255 |
| 1062 STDMETHODIMP BrowserAccessibilityWin::get_imageSize(LONG* height, LONG* width) { | 1256 STDMETHODIMP BrowserAccessibilityWin::get_imageSize(LONG* height, LONG* width) { |
| 1257 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_IMAGE_SIZE); | |
| 1063 if (!instance_active()) | 1258 if (!instance_active()) |
| 1064 return E_FAIL; | 1259 return E_FAIL; |
| 1065 | 1260 |
| 1066 if (!height || !width) | 1261 if (!height || !width) |
| 1067 return E_INVALIDARG; | 1262 return E_INVALIDARG; |
| 1068 | 1263 |
| 1069 *height = GetPageBoundsRect().height(); | 1264 *height = GetPageBoundsRect().height(); |
| 1070 *width = GetPageBoundsRect().width(); | 1265 *width = GetPageBoundsRect().width(); |
| 1071 return S_OK; | 1266 return S_OK; |
| 1072 } | 1267 } |
| 1073 | 1268 |
| 1074 // | 1269 // |
| 1075 // IAccessibleTable methods. | 1270 // IAccessibleTable methods. |
| 1076 // | 1271 // |
| 1077 | 1272 |
| 1078 STDMETHODIMP BrowserAccessibilityWin::get_accessibleAt( | 1273 STDMETHODIMP BrowserAccessibilityWin::get_accessibleAt( |
| 1079 long row, | 1274 long row, |
| 1080 long column, | 1275 long column, |
| 1081 IUnknown** accessible) { | 1276 IUnknown** accessible) { |
| 1277 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_ACCESSIBLE_AT); | |
| 1082 if (!instance_active()) | 1278 if (!instance_active()) |
| 1083 return E_FAIL; | 1279 return E_FAIL; |
| 1084 | 1280 |
| 1085 if (!accessible) | 1281 if (!accessible) |
| 1086 return E_INVALIDARG; | 1282 return E_INVALIDARG; |
| 1087 | 1283 |
| 1088 int columns; | 1284 int columns; |
| 1089 int rows; | 1285 int rows; |
| 1090 if (!GetIntAttribute( | 1286 if (!GetIntAttribute( |
| 1091 ui::AX_ATTR_TABLE_COLUMN_COUNT, &columns) || | 1287 ui::AX_ATTR_TABLE_COLUMN_COUNT, &columns) || |
| (...skipping 16 matching lines...) Expand all Loading... | |
| 1108 if (cell) { | 1304 if (cell) { |
| 1109 *accessible = static_cast<IAccessible*>(cell->NewReference()); | 1305 *accessible = static_cast<IAccessible*>(cell->NewReference()); |
| 1110 return S_OK; | 1306 return S_OK; |
| 1111 } | 1307 } |
| 1112 | 1308 |
| 1113 *accessible = NULL; | 1309 *accessible = NULL; |
| 1114 return E_INVALIDARG; | 1310 return E_INVALIDARG; |
| 1115 } | 1311 } |
| 1116 | 1312 |
| 1117 STDMETHODIMP BrowserAccessibilityWin::get_caption(IUnknown** accessible) { | 1313 STDMETHODIMP BrowserAccessibilityWin::get_caption(IUnknown** accessible) { |
| 1314 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_CAPTION); | |
| 1118 if (!instance_active()) | 1315 if (!instance_active()) |
| 1119 return E_FAIL; | 1316 return E_FAIL; |
| 1120 | 1317 |
| 1121 if (!accessible) | 1318 if (!accessible) |
| 1122 return E_INVALIDARG; | 1319 return E_INVALIDARG; |
| 1123 | 1320 |
| 1124 // TODO(dmazzoni): implement | 1321 // TODO(dmazzoni): implement |
| 1125 return S_FALSE; | 1322 return S_FALSE; |
| 1126 } | 1323 } |
| 1127 | 1324 |
| 1128 STDMETHODIMP BrowserAccessibilityWin::get_childIndex(long row, | 1325 STDMETHODIMP BrowserAccessibilityWin::get_childIndex(long row, |
| 1129 long column, | 1326 long column, |
| 1130 long* cell_index) { | 1327 long* cell_index) { |
| 1328 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_CHILD_INDEX); | |
| 1131 if (!instance_active()) | 1329 if (!instance_active()) |
| 1132 return E_FAIL; | 1330 return E_FAIL; |
| 1133 | 1331 |
| 1134 if (!cell_index) | 1332 if (!cell_index) |
| 1135 return E_INVALIDARG; | 1333 return E_INVALIDARG; |
| 1136 | 1334 |
| 1137 int columns; | 1335 int columns; |
| 1138 int rows; | 1336 int rows; |
| 1139 if (!GetIntAttribute( | 1337 if (!GetIntAttribute( |
| 1140 ui::AX_ATTR_TABLE_COLUMN_COUNT, &columns) || | 1338 ui::AX_ATTR_TABLE_COLUMN_COUNT, &columns) || |
| (...skipping 18 matching lines...) Expand all Loading... | |
| 1159 *cell_index = (long)i; | 1357 *cell_index = (long)i; |
| 1160 return S_OK; | 1358 return S_OK; |
| 1161 } | 1359 } |
| 1162 } | 1360 } |
| 1163 | 1361 |
| 1164 return S_FALSE; | 1362 return S_FALSE; |
| 1165 } | 1363 } |
| 1166 | 1364 |
| 1167 STDMETHODIMP BrowserAccessibilityWin::get_columnDescription(long column, | 1365 STDMETHODIMP BrowserAccessibilityWin::get_columnDescription(long column, |
| 1168 BSTR* description) { | 1366 BSTR* description) { |
| 1367 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_COLUMN_DESCRIPTION); | |
| 1169 if (!instance_active()) | 1368 if (!instance_active()) |
| 1170 return E_FAIL; | 1369 return E_FAIL; |
| 1171 | 1370 |
| 1172 if (!description) | 1371 if (!description) |
| 1173 return E_INVALIDARG; | 1372 return E_INVALIDARG; |
| 1174 | 1373 |
| 1175 int columns; | 1374 int columns; |
| 1176 int rows; | 1375 int rows; |
| 1177 if (!GetIntAttribute( | 1376 if (!GetIntAttribute( |
| 1178 ui::AX_ATTR_TABLE_COLUMN_COUNT, &columns) || | 1377 ui::AX_ATTR_TABLE_COLUMN_COUNT, &columns) || |
| (...skipping 26 matching lines...) Expand all Loading... | |
| 1205 } | 1404 } |
| 1206 } | 1405 } |
| 1207 | 1406 |
| 1208 return S_FALSE; | 1407 return S_FALSE; |
| 1209 } | 1408 } |
| 1210 | 1409 |
| 1211 STDMETHODIMP BrowserAccessibilityWin::get_columnExtentAt( | 1410 STDMETHODIMP BrowserAccessibilityWin::get_columnExtentAt( |
| 1212 long row, | 1411 long row, |
| 1213 long column, | 1412 long column, |
| 1214 long* n_columns_spanned) { | 1413 long* n_columns_spanned) { |
| 1414 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_COLUMN_EXTENT_AT); | |
| 1215 if (!instance_active()) | 1415 if (!instance_active()) |
| 1216 return E_FAIL; | 1416 return E_FAIL; |
| 1217 | 1417 |
| 1218 if (!n_columns_spanned) | 1418 if (!n_columns_spanned) |
| 1219 return E_INVALIDARG; | 1419 return E_INVALIDARG; |
| 1220 | 1420 |
| 1221 int columns; | 1421 int columns; |
| 1222 int rows; | 1422 int rows; |
| 1223 if (!GetIntAttribute( | 1423 if (!GetIntAttribute( |
| 1224 ui::AX_ATTR_TABLE_COLUMN_COUNT, &columns) || | 1424 ui::AX_ATTR_TABLE_COLUMN_COUNT, &columns) || |
| (...skipping 18 matching lines...) Expand all Loading... | |
| 1243 *n_columns_spanned = colspan; | 1443 *n_columns_spanned = colspan; |
| 1244 return S_OK; | 1444 return S_OK; |
| 1245 } | 1445 } |
| 1246 | 1446 |
| 1247 return S_FALSE; | 1447 return S_FALSE; |
| 1248 } | 1448 } |
| 1249 | 1449 |
| 1250 STDMETHODIMP BrowserAccessibilityWin::get_columnHeader( | 1450 STDMETHODIMP BrowserAccessibilityWin::get_columnHeader( |
| 1251 IAccessibleTable** accessible_table, | 1451 IAccessibleTable** accessible_table, |
| 1252 long* starting_row_index) { | 1452 long* starting_row_index) { |
| 1453 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_COLUMN_HEADER); | |
| 1253 // TODO(dmazzoni): implement | 1454 // TODO(dmazzoni): implement |
| 1254 return E_NOTIMPL; | 1455 return E_NOTIMPL; |
| 1255 } | 1456 } |
| 1256 | 1457 |
| 1257 STDMETHODIMP BrowserAccessibilityWin::get_columnIndex(long cell_index, | 1458 STDMETHODIMP BrowserAccessibilityWin::get_columnIndex(long cell_index, |
| 1258 long* column_index) { | 1459 long* column_index) { |
| 1460 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_COLUMN_INDEX); | |
| 1259 if (!instance_active()) | 1461 if (!instance_active()) |
| 1260 return E_FAIL; | 1462 return E_FAIL; |
| 1261 | 1463 |
| 1262 if (!column_index) | 1464 if (!column_index) |
| 1263 return E_INVALIDARG; | 1465 return E_INVALIDARG; |
| 1264 | 1466 |
| 1265 const std::vector<int32_t>& unique_cell_ids = | 1467 const std::vector<int32_t>& unique_cell_ids = |
| 1266 GetIntListAttribute(ui::AX_ATTR_UNIQUE_CELL_IDS); | 1468 GetIntListAttribute(ui::AX_ATTR_UNIQUE_CELL_IDS); |
| 1267 int cell_id_count = static_cast<int>(unique_cell_ids.size()); | 1469 int cell_id_count = static_cast<int>(unique_cell_ids.size()); |
| 1268 if (cell_index < 0) | 1470 if (cell_index < 0) |
| 1269 return E_INVALIDARG; | 1471 return E_INVALIDARG; |
| 1270 if (cell_index >= cell_id_count) | 1472 if (cell_index >= cell_id_count) |
| 1271 return S_FALSE; | 1473 return S_FALSE; |
| 1272 | 1474 |
| 1273 int cell_id = unique_cell_ids[cell_index]; | 1475 int cell_id = unique_cell_ids[cell_index]; |
| 1274 BrowserAccessibilityWin* cell = GetFromID(cell_id); | 1476 BrowserAccessibilityWin* cell = GetFromID(cell_id); |
| 1275 int col_index; | 1477 int col_index; |
| 1276 if (cell && | 1478 if (cell && |
| 1277 cell->GetIntAttribute( | 1479 cell->GetIntAttribute( |
| 1278 ui::AX_ATTR_TABLE_CELL_COLUMN_INDEX, &col_index)) { | 1480 ui::AX_ATTR_TABLE_CELL_COLUMN_INDEX, &col_index)) { |
| 1279 *column_index = col_index; | 1481 *column_index = col_index; |
| 1280 return S_OK; | 1482 return S_OK; |
| 1281 } | 1483 } |
| 1282 | 1484 |
| 1283 return S_FALSE; | 1485 return S_FALSE; |
| 1284 } | 1486 } |
| 1285 | 1487 |
| 1286 STDMETHODIMP BrowserAccessibilityWin::get_nColumns(long* column_count) { | 1488 STDMETHODIMP BrowserAccessibilityWin::get_nColumns(long* column_count) { |
| 1489 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_N_COLUMNS); | |
| 1287 if (!instance_active()) | 1490 if (!instance_active()) |
| 1288 return E_FAIL; | 1491 return E_FAIL; |
| 1289 | 1492 |
| 1290 if (!column_count) | 1493 if (!column_count) |
| 1291 return E_INVALIDARG; | 1494 return E_INVALIDARG; |
| 1292 | 1495 |
| 1293 int columns; | 1496 int columns; |
| 1294 if (GetIntAttribute( | 1497 if (GetIntAttribute( |
| 1295 ui::AX_ATTR_TABLE_COLUMN_COUNT, &columns)) { | 1498 ui::AX_ATTR_TABLE_COLUMN_COUNT, &columns)) { |
| 1296 *column_count = columns; | 1499 *column_count = columns; |
| 1297 return S_OK; | 1500 return S_OK; |
| 1298 } | 1501 } |
| 1299 | 1502 |
| 1300 return S_FALSE; | 1503 return S_FALSE; |
| 1301 } | 1504 } |
| 1302 | 1505 |
| 1303 STDMETHODIMP BrowserAccessibilityWin::get_nRows(long* row_count) { | 1506 STDMETHODIMP BrowserAccessibilityWin::get_nRows(long* row_count) { |
| 1507 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_N_ROWS); | |
| 1304 if (!instance_active()) | 1508 if (!instance_active()) |
| 1305 return E_FAIL; | 1509 return E_FAIL; |
| 1306 | 1510 |
| 1307 if (!row_count) | 1511 if (!row_count) |
| 1308 return E_INVALIDARG; | 1512 return E_INVALIDARG; |
| 1309 | 1513 |
| 1310 int rows; | 1514 int rows; |
| 1311 if (GetIntAttribute(ui::AX_ATTR_TABLE_ROW_COUNT, &rows)) { | 1515 if (GetIntAttribute(ui::AX_ATTR_TABLE_ROW_COUNT, &rows)) { |
| 1312 *row_count = rows; | 1516 *row_count = rows; |
| 1313 return S_OK; | 1517 return S_OK; |
| 1314 } | 1518 } |
| 1315 | 1519 |
| 1316 return S_FALSE; | 1520 return S_FALSE; |
| 1317 } | 1521 } |
| 1318 | 1522 |
| 1319 STDMETHODIMP BrowserAccessibilityWin::get_nSelectedChildren(long* cell_count) { | 1523 STDMETHODIMP BrowserAccessibilityWin::get_nSelectedChildren(long* cell_count) { |
| 1524 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_N_SELECTED_CHILDREN); | |
| 1320 if (!instance_active()) | 1525 if (!instance_active()) |
| 1321 return E_FAIL; | 1526 return E_FAIL; |
| 1322 | 1527 |
| 1323 if (!cell_count) | 1528 if (!cell_count) |
| 1324 return E_INVALIDARG; | 1529 return E_INVALIDARG; |
| 1325 | 1530 |
| 1326 // TODO(dmazzoni): add support for selected cells/rows/columns in tables. | 1531 // TODO(dmazzoni): add support for selected cells/rows/columns in tables. |
| 1327 *cell_count = 0; | 1532 *cell_count = 0; |
| 1328 return S_OK; | 1533 return S_OK; |
| 1329 } | 1534 } |
| 1330 | 1535 |
| 1331 STDMETHODIMP BrowserAccessibilityWin::get_nSelectedColumns(long* column_count) { | 1536 STDMETHODIMP BrowserAccessibilityWin::get_nSelectedColumns(long* column_count) { |
| 1537 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_N_SELECTED_COLUMNS); | |
| 1332 if (!instance_active()) | 1538 if (!instance_active()) |
| 1333 return E_FAIL; | 1539 return E_FAIL; |
| 1334 | 1540 |
| 1335 if (!column_count) | 1541 if (!column_count) |
| 1336 return E_INVALIDARG; | 1542 return E_INVALIDARG; |
| 1337 | 1543 |
| 1338 *column_count = 0; | 1544 *column_count = 0; |
| 1339 return S_OK; | 1545 return S_OK; |
| 1340 } | 1546 } |
| 1341 | 1547 |
| 1342 STDMETHODIMP BrowserAccessibilityWin::get_nSelectedRows(long* row_count) { | 1548 STDMETHODIMP BrowserAccessibilityWin::get_nSelectedRows(long* row_count) { |
| 1549 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_N_SELECTED_ROWS); | |
| 1343 if (!instance_active()) | 1550 if (!instance_active()) |
| 1344 return E_FAIL; | 1551 return E_FAIL; |
| 1345 | 1552 |
| 1346 if (!row_count) | 1553 if (!row_count) |
| 1347 return E_INVALIDARG; | 1554 return E_INVALIDARG; |
| 1348 | 1555 |
| 1349 *row_count = 0; | 1556 *row_count = 0; |
| 1350 return S_OK; | 1557 return S_OK; |
| 1351 } | 1558 } |
| 1352 | 1559 |
| 1353 STDMETHODIMP BrowserAccessibilityWin::get_rowDescription(long row, | 1560 STDMETHODIMP BrowserAccessibilityWin::get_rowDescription(long row, |
| 1354 BSTR* description) { | 1561 BSTR* description) { |
| 1562 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_ROW_DESCRIPTION); | |
| 1355 if (!instance_active()) | 1563 if (!instance_active()) |
| 1356 return E_FAIL; | 1564 return E_FAIL; |
| 1357 | 1565 |
| 1358 if (!description) | 1566 if (!description) |
| 1359 return E_INVALIDARG; | 1567 return E_INVALIDARG; |
| 1360 | 1568 |
| 1361 int columns; | 1569 int columns; |
| 1362 int rows; | 1570 int rows; |
| 1363 if (!GetIntAttribute( | 1571 if (!GetIntAttribute( |
| 1364 ui::AX_ATTR_TABLE_COLUMN_COUNT, &columns) || | 1572 ui::AX_ATTR_TABLE_COLUMN_COUNT, &columns) || |
| (...skipping 25 matching lines...) Expand all Loading... | |
| 1390 } | 1598 } |
| 1391 } | 1599 } |
| 1392 } | 1600 } |
| 1393 | 1601 |
| 1394 return S_FALSE; | 1602 return S_FALSE; |
| 1395 } | 1603 } |
| 1396 | 1604 |
| 1397 STDMETHODIMP BrowserAccessibilityWin::get_rowExtentAt(long row, | 1605 STDMETHODIMP BrowserAccessibilityWin::get_rowExtentAt(long row, |
| 1398 long column, | 1606 long column, |
| 1399 long* n_rows_spanned) { | 1607 long* n_rows_spanned) { |
| 1608 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_ROW_EXTENT_AT); | |
| 1400 if (!instance_active()) | 1609 if (!instance_active()) |
| 1401 return E_FAIL; | 1610 return E_FAIL; |
| 1402 | 1611 |
| 1403 if (!n_rows_spanned) | 1612 if (!n_rows_spanned) |
| 1404 return E_INVALIDARG; | 1613 return E_INVALIDARG; |
| 1405 | 1614 |
| 1406 int columns; | 1615 int columns; |
| 1407 int rows; | 1616 int rows; |
| 1408 if (!GetIntAttribute( | 1617 if (!GetIntAttribute( |
| 1409 ui::AX_ATTR_TABLE_COLUMN_COUNT, &columns) || | 1618 ui::AX_ATTR_TABLE_COLUMN_COUNT, &columns) || |
| (...skipping 18 matching lines...) Expand all Loading... | |
| 1428 *n_rows_spanned = rowspan; | 1637 *n_rows_spanned = rowspan; |
| 1429 return S_OK; | 1638 return S_OK; |
| 1430 } | 1639 } |
| 1431 | 1640 |
| 1432 return S_FALSE; | 1641 return S_FALSE; |
| 1433 } | 1642 } |
| 1434 | 1643 |
| 1435 STDMETHODIMP BrowserAccessibilityWin::get_rowHeader( | 1644 STDMETHODIMP BrowserAccessibilityWin::get_rowHeader( |
| 1436 IAccessibleTable** accessible_table, | 1645 IAccessibleTable** accessible_table, |
| 1437 long* starting_column_index) { | 1646 long* starting_column_index) { |
| 1647 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_ROW_HEADER); | |
| 1438 // TODO(dmazzoni): implement | 1648 // TODO(dmazzoni): implement |
| 1439 return E_NOTIMPL; | 1649 return E_NOTIMPL; |
| 1440 } | 1650 } |
| 1441 | 1651 |
| 1442 STDMETHODIMP BrowserAccessibilityWin::get_rowIndex(long cell_index, | 1652 STDMETHODIMP BrowserAccessibilityWin::get_rowIndex(long cell_index, |
| 1443 long* row_index) { | 1653 long* row_index) { |
| 1654 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_ROW_INDEX); | |
| 1444 if (!instance_active()) | 1655 if (!instance_active()) |
| 1445 return E_FAIL; | 1656 return E_FAIL; |
| 1446 | 1657 |
| 1447 if (!row_index) | 1658 if (!row_index) |
| 1448 return E_INVALIDARG; | 1659 return E_INVALIDARG; |
| 1449 | 1660 |
| 1450 const std::vector<int32_t>& unique_cell_ids = | 1661 const std::vector<int32_t>& unique_cell_ids = |
| 1451 GetIntListAttribute(ui::AX_ATTR_UNIQUE_CELL_IDS); | 1662 GetIntListAttribute(ui::AX_ATTR_UNIQUE_CELL_IDS); |
| 1452 int cell_id_count = static_cast<int>(unique_cell_ids.size()); | 1663 int cell_id_count = static_cast<int>(unique_cell_ids.size()); |
| 1453 if (cell_index < 0) | 1664 if (cell_index < 0) |
| (...skipping 10 matching lines...) Expand all Loading... | |
| 1464 *row_index = cell_row_index; | 1675 *row_index = cell_row_index; |
| 1465 return S_OK; | 1676 return S_OK; |
| 1466 } | 1677 } |
| 1467 | 1678 |
| 1468 return S_FALSE; | 1679 return S_FALSE; |
| 1469 } | 1680 } |
| 1470 | 1681 |
| 1471 STDMETHODIMP BrowserAccessibilityWin::get_selectedChildren(long max_children, | 1682 STDMETHODIMP BrowserAccessibilityWin::get_selectedChildren(long max_children, |
| 1472 long** children, | 1683 long** children, |
| 1473 long* n_children) { | 1684 long* n_children) { |
| 1685 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_SELECTED_CHILDREN); | |
| 1474 if (!instance_active()) | 1686 if (!instance_active()) |
| 1475 return E_FAIL; | 1687 return E_FAIL; |
| 1476 | 1688 |
| 1477 if (!children || !n_children) | 1689 if (!children || !n_children) |
| 1478 return E_INVALIDARG; | 1690 return E_INVALIDARG; |
| 1479 | 1691 |
| 1480 // TODO(dmazzoni): Implement this. | 1692 // TODO(dmazzoni): Implement this. |
| 1481 *n_children = 0; | 1693 *n_children = 0; |
| 1482 return S_OK; | 1694 return S_OK; |
| 1483 } | 1695 } |
| 1484 | 1696 |
| 1485 STDMETHODIMP BrowserAccessibilityWin::get_selectedColumns(long max_columns, | 1697 STDMETHODIMP BrowserAccessibilityWin::get_selectedColumns(long max_columns, |
| 1486 long** columns, | 1698 long** columns, |
| 1487 long* n_columns) { | 1699 long* n_columns) { |
| 1700 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_SELECTED_COLUMNS); | |
| 1488 if (!instance_active()) | 1701 if (!instance_active()) |
| 1489 return E_FAIL; | 1702 return E_FAIL; |
| 1490 | 1703 |
| 1491 if (!columns || !n_columns) | 1704 if (!columns || !n_columns) |
| 1492 return E_INVALIDARG; | 1705 return E_INVALIDARG; |
| 1493 | 1706 |
| 1494 // TODO(dmazzoni): Implement this. | 1707 // TODO(dmazzoni): Implement this. |
| 1495 *n_columns = 0; | 1708 *n_columns = 0; |
| 1496 return S_OK; | 1709 return S_OK; |
| 1497 } | 1710 } |
| 1498 | 1711 |
| 1499 STDMETHODIMP BrowserAccessibilityWin::get_selectedRows(long max_rows, | 1712 STDMETHODIMP BrowserAccessibilityWin::get_selectedRows(long max_rows, |
| 1500 long** rows, | 1713 long** rows, |
| 1501 long* n_rows) { | 1714 long* n_rows) { |
| 1715 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_SELECTED_ROWS); | |
| 1502 if (!instance_active()) | 1716 if (!instance_active()) |
| 1503 return E_FAIL; | 1717 return E_FAIL; |
| 1504 | 1718 |
| 1505 if (!rows || !n_rows) | 1719 if (!rows || !n_rows) |
| 1506 return E_INVALIDARG; | 1720 return E_INVALIDARG; |
| 1507 | 1721 |
| 1508 // TODO(dmazzoni): Implement this. | 1722 // TODO(dmazzoni): Implement this. |
| 1509 *n_rows = 0; | 1723 *n_rows = 0; |
| 1510 return S_OK; | 1724 return S_OK; |
| 1511 } | 1725 } |
| 1512 | 1726 |
| 1513 STDMETHODIMP BrowserAccessibilityWin::get_summary(IUnknown** accessible) { | 1727 STDMETHODIMP BrowserAccessibilityWin::get_summary(IUnknown** accessible) { |
| 1728 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_SUMMARY); | |
| 1514 if (!instance_active()) | 1729 if (!instance_active()) |
| 1515 return E_FAIL; | 1730 return E_FAIL; |
| 1516 | 1731 |
| 1517 if (!accessible) | 1732 if (!accessible) |
| 1518 return E_INVALIDARG; | 1733 return E_INVALIDARG; |
| 1519 | 1734 |
| 1520 // TODO(dmazzoni): implement | 1735 // TODO(dmazzoni): implement |
| 1521 return S_FALSE; | 1736 return S_FALSE; |
| 1522 } | 1737 } |
| 1523 | 1738 |
| 1524 STDMETHODIMP BrowserAccessibilityWin::get_isColumnSelected( | 1739 STDMETHODIMP BrowserAccessibilityWin::get_isColumnSelected( |
| 1525 long column, | 1740 long column, |
| 1526 boolean* is_selected) { | 1741 boolean* is_selected) { |
| 1742 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_IS_COLUMN_SELECTED); | |
| 1527 if (!instance_active()) | 1743 if (!instance_active()) |
| 1528 return E_FAIL; | 1744 return E_FAIL; |
| 1529 | 1745 |
| 1530 if (!is_selected) | 1746 if (!is_selected) |
| 1531 return E_INVALIDARG; | 1747 return E_INVALIDARG; |
| 1532 | 1748 |
| 1533 // TODO(dmazzoni): Implement this. | 1749 // TODO(dmazzoni): Implement this. |
| 1534 *is_selected = false; | 1750 *is_selected = false; |
| 1535 return S_OK; | 1751 return S_OK; |
| 1536 } | 1752 } |
| 1537 | 1753 |
| 1538 STDMETHODIMP BrowserAccessibilityWin::get_isRowSelected(long row, | 1754 STDMETHODIMP BrowserAccessibilityWin::get_isRowSelected(long row, |
| 1539 boolean* is_selected) { | 1755 boolean* is_selected) { |
| 1756 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_IS_ROW_SELECTED); | |
| 1540 if (!instance_active()) | 1757 if (!instance_active()) |
| 1541 return E_FAIL; | 1758 return E_FAIL; |
| 1542 | 1759 |
| 1543 if (!is_selected) | 1760 if (!is_selected) |
| 1544 return E_INVALIDARG; | 1761 return E_INVALIDARG; |
| 1545 | 1762 |
| 1546 // TODO(dmazzoni): Implement this. | 1763 // TODO(dmazzoni): Implement this. |
| 1547 *is_selected = false; | 1764 *is_selected = false; |
| 1548 return S_OK; | 1765 return S_OK; |
| 1549 } | 1766 } |
| 1550 | 1767 |
| 1551 STDMETHODIMP BrowserAccessibilityWin::get_isSelected(long row, | 1768 STDMETHODIMP BrowserAccessibilityWin::get_isSelected(long row, |
| 1552 long column, | 1769 long column, |
| 1553 boolean* is_selected) { | 1770 boolean* is_selected) { |
| 1771 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_IS_SELECTED); | |
| 1554 if (!instance_active()) | 1772 if (!instance_active()) |
| 1555 return E_FAIL; | 1773 return E_FAIL; |
| 1556 | 1774 |
| 1557 if (!is_selected) | 1775 if (!is_selected) |
| 1558 return E_INVALIDARG; | 1776 return E_INVALIDARG; |
| 1559 | 1777 |
| 1560 // TODO(dmazzoni): Implement this. | 1778 // TODO(dmazzoni): Implement this. |
| 1561 *is_selected = false; | 1779 *is_selected = false; |
| 1562 return S_OK; | 1780 return S_OK; |
| 1563 } | 1781 } |
| 1564 | 1782 |
| 1565 STDMETHODIMP BrowserAccessibilityWin::get_rowColumnExtentsAtIndex( | 1783 STDMETHODIMP BrowserAccessibilityWin::get_rowColumnExtentsAtIndex( |
| 1566 long index, | 1784 long index, |
| 1567 long* row, | 1785 long* row, |
| 1568 long* column, | 1786 long* column, |
| 1569 long* row_extents, | 1787 long* row_extents, |
| 1570 long* column_extents, | 1788 long* column_extents, |
| 1571 boolean* is_selected) { | 1789 boolean* is_selected) { |
| 1790 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_ROW_COLUMN_EXTENTS_AT_INDEX); | |
| 1572 if (!instance_active()) | 1791 if (!instance_active()) |
| 1573 return E_FAIL; | 1792 return E_FAIL; |
| 1574 | 1793 |
| 1575 if (!row || !column || !row_extents || !column_extents || !is_selected) | 1794 if (!row || !column || !row_extents || !column_extents || !is_selected) |
| 1576 return E_INVALIDARG; | 1795 return E_INVALIDARG; |
| 1577 | 1796 |
| 1578 const std::vector<int32_t>& unique_cell_ids = | 1797 const std::vector<int32_t>& unique_cell_ids = |
| 1579 GetIntListAttribute(ui::AX_ATTR_UNIQUE_CELL_IDS); | 1798 GetIntListAttribute(ui::AX_ATTR_UNIQUE_CELL_IDS); |
| 1580 int cell_id_count = static_cast<int>(unique_cell_ids.size()); | 1799 int cell_id_count = static_cast<int>(unique_cell_ids.size()); |
| 1581 if (index < 0) | 1800 if (index < 0) |
| (...skipping 14 matching lines...) Expand all Loading... | |
| 1596 colspan >= 1) { | 1815 colspan >= 1) { |
| 1597 *row_extents = rowspan; | 1816 *row_extents = rowspan; |
| 1598 *column_extents = colspan; | 1817 *column_extents = colspan; |
| 1599 return S_OK; | 1818 return S_OK; |
| 1600 } | 1819 } |
| 1601 | 1820 |
| 1602 return S_FALSE; | 1821 return S_FALSE; |
| 1603 } | 1822 } |
| 1604 | 1823 |
| 1605 STDMETHODIMP BrowserAccessibilityWin::selectRow(long row) { | 1824 STDMETHODIMP BrowserAccessibilityWin::selectRow(long row) { |
| 1825 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_SELECT_ROW); | |
| 1606 return E_NOTIMPL; | 1826 return E_NOTIMPL; |
| 1607 } | 1827 } |
| 1608 | 1828 |
| 1609 STDMETHODIMP BrowserAccessibilityWin::selectColumn(long column) { | 1829 STDMETHODIMP BrowserAccessibilityWin::selectColumn(long column) { |
| 1830 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_SELECT_COLUMN); | |
| 1610 return E_NOTIMPL; | 1831 return E_NOTIMPL; |
| 1611 } | 1832 } |
| 1612 | 1833 |
| 1613 STDMETHODIMP BrowserAccessibilityWin::unselectRow(long row) { | 1834 STDMETHODIMP BrowserAccessibilityWin::unselectRow(long row) { |
| 1835 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_UNSELECT_ROW); | |
| 1614 return E_NOTIMPL; | 1836 return E_NOTIMPL; |
| 1615 } | 1837 } |
| 1616 | 1838 |
| 1617 STDMETHODIMP BrowserAccessibilityWin::unselectColumn(long column) { | 1839 STDMETHODIMP BrowserAccessibilityWin::unselectColumn(long column) { |
| 1840 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_UNSELECT_COLUMN); | |
| 1618 return E_NOTIMPL; | 1841 return E_NOTIMPL; |
| 1619 } | 1842 } |
| 1620 | 1843 |
| 1621 STDMETHODIMP | 1844 STDMETHODIMP |
| 1622 BrowserAccessibilityWin::get_modelChange(IA2TableModelChange* model_change) { | 1845 BrowserAccessibilityWin::get_modelChange(IA2TableModelChange* model_change) { |
| 1623 return E_NOTIMPL; | 1846 return E_NOTIMPL; |
| 1624 } | 1847 } |
| 1625 | 1848 |
| 1626 // | 1849 // |
| 1627 // IAccessibleTable2 methods. | 1850 // IAccessibleTable2 methods. |
| 1628 // | 1851 // |
| 1629 | 1852 |
| 1630 STDMETHODIMP BrowserAccessibilityWin::get_cellAt(long row, | 1853 STDMETHODIMP BrowserAccessibilityWin::get_cellAt(long row, |
| 1631 long column, | 1854 long column, |
| 1632 IUnknown** cell) { | 1855 IUnknown** cell) { |
| 1856 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_CELL_AT); | |
| 1633 return get_accessibleAt(row, column, cell); | 1857 return get_accessibleAt(row, column, cell); |
| 1634 } | 1858 } |
| 1635 | 1859 |
| 1636 STDMETHODIMP BrowserAccessibilityWin::get_nSelectedCells(long* cell_count) { | 1860 STDMETHODIMP BrowserAccessibilityWin::get_nSelectedCells(long* cell_count) { |
| 1861 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_N_SELECTED_CELLS); | |
| 1637 return get_nSelectedChildren(cell_count); | 1862 return get_nSelectedChildren(cell_count); |
| 1638 } | 1863 } |
| 1639 | 1864 |
| 1640 STDMETHODIMP BrowserAccessibilityWin::get_selectedCells( | 1865 STDMETHODIMP BrowserAccessibilityWin::get_selectedCells( |
| 1641 IUnknown*** cells, | 1866 IUnknown*** cells, |
| 1642 long* n_selected_cells) { | 1867 long* n_selected_cells) { |
| 1868 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_SELECTED_CELLS); | |
| 1643 if (!instance_active()) | 1869 if (!instance_active()) |
| 1644 return E_FAIL; | 1870 return E_FAIL; |
| 1645 | 1871 |
| 1646 if (!cells || !n_selected_cells) | 1872 if (!cells || !n_selected_cells) |
| 1647 return E_INVALIDARG; | 1873 return E_INVALIDARG; |
| 1648 | 1874 |
| 1649 // TODO(dmazzoni): Implement this. | 1875 // TODO(dmazzoni): Implement this. |
| 1650 *n_selected_cells = 0; | 1876 *n_selected_cells = 0; |
| 1651 return S_OK; | 1877 return S_OK; |
| 1652 } | 1878 } |
| 1653 | 1879 |
| 1654 STDMETHODIMP BrowserAccessibilityWin::get_selectedColumns(long** columns, | 1880 STDMETHODIMP BrowserAccessibilityWin::get_selectedColumns(long** columns, |
| 1655 long* n_columns) { | 1881 long* n_columns) { |
| 1882 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_TABLE2_GET_SELECTED_COLUMNS); | |
| 1656 if (!instance_active()) | 1883 if (!instance_active()) |
| 1657 return E_FAIL; | 1884 return E_FAIL; |
| 1658 | 1885 |
| 1659 if (!columns || !n_columns) | 1886 if (!columns || !n_columns) |
| 1660 return E_INVALIDARG; | 1887 return E_INVALIDARG; |
| 1661 | 1888 |
| 1662 // TODO(dmazzoni): Implement this. | 1889 // TODO(dmazzoni): Implement this. |
| 1663 *n_columns = 0; | 1890 *n_columns = 0; |
| 1664 return S_OK; | 1891 return S_OK; |
| 1665 } | 1892 } |
| 1666 | 1893 |
| 1667 STDMETHODIMP BrowserAccessibilityWin::get_selectedRows(long** rows, | 1894 STDMETHODIMP BrowserAccessibilityWin::get_selectedRows(long** rows, |
| 1668 long* n_rows) { | 1895 long* n_rows) { |
| 1896 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_TABLE2_GET_SELECTED_ROWS); | |
| 1669 if (!instance_active()) | 1897 if (!instance_active()) |
| 1670 return E_FAIL; | 1898 return E_FAIL; |
| 1671 | 1899 |
| 1672 if (!rows || !n_rows) | 1900 if (!rows || !n_rows) |
| 1673 return E_INVALIDARG; | 1901 return E_INVALIDARG; |
| 1674 | 1902 |
| 1675 // TODO(dmazzoni): Implement this. | 1903 // TODO(dmazzoni): Implement this. |
| 1676 *n_rows = 0; | 1904 *n_rows = 0; |
| 1677 return S_OK; | 1905 return S_OK; |
| 1678 } | 1906 } |
| 1679 | 1907 |
| 1680 | 1908 |
| 1681 // | 1909 // |
| 1682 // IAccessibleTableCell methods. | 1910 // IAccessibleTableCell methods. |
| 1683 // | 1911 // |
| 1684 | 1912 |
| 1685 STDMETHODIMP BrowserAccessibilityWin::get_columnExtent( | 1913 STDMETHODIMP BrowserAccessibilityWin::get_columnExtent( |
| 1686 long* n_columns_spanned) { | 1914 long* n_columns_spanned) { |
| 1915 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_COLUMN_EXTENT); | |
| 1687 if (!instance_active()) | 1916 if (!instance_active()) |
| 1688 return E_FAIL; | 1917 return E_FAIL; |
| 1689 | 1918 |
| 1690 if (!n_columns_spanned) | 1919 if (!n_columns_spanned) |
| 1691 return E_INVALIDARG; | 1920 return E_INVALIDARG; |
| 1692 | 1921 |
| 1693 int colspan; | 1922 int colspan; |
| 1694 if (GetIntAttribute( | 1923 if (GetIntAttribute( |
| 1695 ui::AX_ATTR_TABLE_CELL_COLUMN_SPAN, &colspan) && | 1924 ui::AX_ATTR_TABLE_CELL_COLUMN_SPAN, &colspan) && |
| 1696 colspan >= 1) { | 1925 colspan >= 1) { |
| 1697 *n_columns_spanned = colspan; | 1926 *n_columns_spanned = colspan; |
| 1698 return S_OK; | 1927 return S_OK; |
| 1699 } | 1928 } |
| 1700 | 1929 |
| 1701 return S_FALSE; | 1930 return S_FALSE; |
| 1702 } | 1931 } |
| 1703 | 1932 |
| 1704 STDMETHODIMP BrowserAccessibilityWin::get_columnHeaderCells( | 1933 STDMETHODIMP BrowserAccessibilityWin::get_columnHeaderCells( |
| 1705 IUnknown*** cell_accessibles, | 1934 IUnknown*** cell_accessibles, |
| 1706 long* n_column_header_cells) { | 1935 long* n_column_header_cells) { |
| 1936 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_COLUMN_HEADER_CELLS); | |
| 1707 if (!instance_active()) | 1937 if (!instance_active()) |
| 1708 return E_FAIL; | 1938 return E_FAIL; |
| 1709 | 1939 |
| 1710 if (!cell_accessibles || !n_column_header_cells) | 1940 if (!cell_accessibles || !n_column_header_cells) |
| 1711 return E_INVALIDARG; | 1941 return E_INVALIDARG; |
| 1712 | 1942 |
| 1713 *n_column_header_cells = 0; | 1943 *n_column_header_cells = 0; |
| 1714 | 1944 |
| 1715 int column; | 1945 int column; |
| 1716 if (!GetIntAttribute( | 1946 if (!GetIntAttribute( |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1757 (*cell_accessibles)[index] = static_cast<IAccessible*>( | 1987 (*cell_accessibles)[index] = static_cast<IAccessible*>( |
| 1758 ToBrowserAccessibilityWin(cell)->NewReference()); | 1988 ToBrowserAccessibilityWin(cell)->NewReference()); |
| 1759 ++index; | 1989 ++index; |
| 1760 } | 1990 } |
| 1761 } | 1991 } |
| 1762 | 1992 |
| 1763 return S_OK; | 1993 return S_OK; |
| 1764 } | 1994 } |
| 1765 | 1995 |
| 1766 STDMETHODIMP BrowserAccessibilityWin::get_columnIndex(long* column_index) { | 1996 STDMETHODIMP BrowserAccessibilityWin::get_columnIndex(long* column_index) { |
| 1997 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_TABLECELL_GET_COLUMN_INDEX); | |
| 1767 if (!instance_active()) | 1998 if (!instance_active()) |
| 1768 return E_FAIL; | 1999 return E_FAIL; |
| 1769 | 2000 |
| 1770 if (!column_index) | 2001 if (!column_index) |
| 1771 return E_INVALIDARG; | 2002 return E_INVALIDARG; |
| 1772 | 2003 |
| 1773 int column; | 2004 int column; |
| 1774 if (GetIntAttribute( | 2005 if (GetIntAttribute( |
| 1775 ui::AX_ATTR_TABLE_CELL_COLUMN_INDEX, &column)) { | 2006 ui::AX_ATTR_TABLE_CELL_COLUMN_INDEX, &column)) { |
| 1776 *column_index = column; | 2007 *column_index = column; |
| 1777 return S_OK; | 2008 return S_OK; |
| 1778 } | 2009 } |
| 1779 | 2010 |
| 1780 return S_FALSE; | 2011 return S_FALSE; |
| 1781 } | 2012 } |
| 1782 | 2013 |
| 1783 STDMETHODIMP BrowserAccessibilityWin::get_rowExtent(long* n_rows_spanned) { | 2014 STDMETHODIMP BrowserAccessibilityWin::get_rowExtent(long* n_rows_spanned) { |
| 2015 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_ROW_EXTENT); | |
| 1784 if (!instance_active()) | 2016 if (!instance_active()) |
| 1785 return E_FAIL; | 2017 return E_FAIL; |
| 1786 | 2018 |
| 1787 if (!n_rows_spanned) | 2019 if (!n_rows_spanned) |
| 1788 return E_INVALIDARG; | 2020 return E_INVALIDARG; |
| 1789 | 2021 |
| 1790 int rowspan; | 2022 int rowspan; |
| 1791 if (GetIntAttribute( | 2023 if (GetIntAttribute( |
| 1792 ui::AX_ATTR_TABLE_CELL_ROW_SPAN, &rowspan) && | 2024 ui::AX_ATTR_TABLE_CELL_ROW_SPAN, &rowspan) && |
| 1793 rowspan >= 1) { | 2025 rowspan >= 1) { |
| 1794 *n_rows_spanned = rowspan; | 2026 *n_rows_spanned = rowspan; |
| 1795 return S_OK; | 2027 return S_OK; |
| 1796 } | 2028 } |
| 1797 | 2029 |
| 1798 return S_FALSE; | 2030 return S_FALSE; |
| 1799 } | 2031 } |
| 1800 | 2032 |
| 1801 STDMETHODIMP BrowserAccessibilityWin::get_rowHeaderCells( | 2033 STDMETHODIMP BrowserAccessibilityWin::get_rowHeaderCells( |
| 1802 IUnknown*** cell_accessibles, | 2034 IUnknown*** cell_accessibles, |
| 1803 long* n_row_header_cells) { | 2035 long* n_row_header_cells) { |
| 2036 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_ROW_HEADER_CELLS); | |
| 1804 if (!instance_active()) | 2037 if (!instance_active()) |
| 1805 return E_FAIL; | 2038 return E_FAIL; |
| 1806 | 2039 |
| 1807 if (!cell_accessibles || !n_row_header_cells) | 2040 if (!cell_accessibles || !n_row_header_cells) |
| 1808 return E_INVALIDARG; | 2041 return E_INVALIDARG; |
| 1809 | 2042 |
| 1810 *n_row_header_cells = 0; | 2043 *n_row_header_cells = 0; |
| 1811 | 2044 |
| 1812 int row; | 2045 int row; |
| 1813 if (!GetIntAttribute( | 2046 if (!GetIntAttribute( |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1854 (*cell_accessibles)[index] = static_cast<IAccessible*>( | 2087 (*cell_accessibles)[index] = static_cast<IAccessible*>( |
| 1855 ToBrowserAccessibilityWin(cell)->NewReference()); | 2088 ToBrowserAccessibilityWin(cell)->NewReference()); |
| 1856 ++index; | 2089 ++index; |
| 1857 } | 2090 } |
| 1858 } | 2091 } |
| 1859 | 2092 |
| 1860 return S_OK; | 2093 return S_OK; |
| 1861 } | 2094 } |
| 1862 | 2095 |
| 1863 STDMETHODIMP BrowserAccessibilityWin::get_rowIndex(long* row_index) { | 2096 STDMETHODIMP BrowserAccessibilityWin::get_rowIndex(long* row_index) { |
| 2097 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_TABLECELL_GET_ROW_INDEX); | |
| 1864 if (!instance_active()) | 2098 if (!instance_active()) |
| 1865 return E_FAIL; | 2099 return E_FAIL; |
| 1866 | 2100 |
| 1867 if (!row_index) | 2101 if (!row_index) |
| 1868 return E_INVALIDARG; | 2102 return E_INVALIDARG; |
| 1869 | 2103 |
| 1870 int row; | 2104 int row; |
| 1871 if (GetIntAttribute(ui::AX_ATTR_TABLE_CELL_ROW_INDEX, &row)) { | 2105 if (GetIntAttribute(ui::AX_ATTR_TABLE_CELL_ROW_INDEX, &row)) { |
| 1872 *row_index = row; | 2106 *row_index = row; |
| 1873 return S_OK; | 2107 return S_OK; |
| 1874 } | 2108 } |
| 1875 return S_FALSE; | 2109 return S_FALSE; |
| 1876 } | 2110 } |
| 1877 | 2111 |
| 1878 STDMETHODIMP BrowserAccessibilityWin::get_isSelected(boolean* is_selected) { | 2112 STDMETHODIMP BrowserAccessibilityWin::get_isSelected(boolean* is_selected) { |
| 2113 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_TABLECELL_GET_IS_SELECTED); | |
| 1879 if (!instance_active()) | 2114 if (!instance_active()) |
| 1880 return E_FAIL; | 2115 return E_FAIL; |
| 1881 | 2116 |
| 1882 if (!is_selected) | 2117 if (!is_selected) |
| 1883 return E_INVALIDARG; | 2118 return E_INVALIDARG; |
| 1884 | 2119 |
| 1885 *is_selected = false; | 2120 *is_selected = false; |
| 1886 return S_OK; | 2121 return S_OK; |
| 1887 } | 2122 } |
| 1888 | 2123 |
| 1889 STDMETHODIMP BrowserAccessibilityWin::get_rowColumnExtents( | 2124 STDMETHODIMP BrowserAccessibilityWin::get_rowColumnExtents( |
| 1890 long* row_index, | 2125 long* row_index, |
| 1891 long* column_index, | 2126 long* column_index, |
| 1892 long* row_extents, | 2127 long* row_extents, |
| 1893 long* column_extents, | 2128 long* column_extents, |
| 1894 boolean* is_selected) { | 2129 boolean* is_selected) { |
| 2130 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_ROW_COLUMN_EXTENTS); | |
| 1895 if (!instance_active()) | 2131 if (!instance_active()) |
| 1896 return E_FAIL; | 2132 return E_FAIL; |
| 1897 | 2133 |
| 1898 if (!row_index || | 2134 if (!row_index || |
| 1899 !column_index || | 2135 !column_index || |
| 1900 !row_extents || | 2136 !row_extents || |
| 1901 !column_extents || | 2137 !column_extents || |
| 1902 !is_selected) { | 2138 !is_selected) { |
| 1903 return E_INVALIDARG; | 2139 return E_INVALIDARG; |
| 1904 } | 2140 } |
| (...skipping 14 matching lines...) Expand all Loading... | |
| 1919 *row_extents = rowspan; | 2155 *row_extents = rowspan; |
| 1920 *column_extents = colspan; | 2156 *column_extents = colspan; |
| 1921 *is_selected = false; | 2157 *is_selected = false; |
| 1922 return S_OK; | 2158 return S_OK; |
| 1923 } | 2159 } |
| 1924 | 2160 |
| 1925 return S_FALSE; | 2161 return S_FALSE; |
| 1926 } | 2162 } |
| 1927 | 2163 |
| 1928 STDMETHODIMP BrowserAccessibilityWin::get_table(IUnknown** table) { | 2164 STDMETHODIMP BrowserAccessibilityWin::get_table(IUnknown** table) { |
| 2165 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_TABLE); | |
| 1929 if (!instance_active()) | 2166 if (!instance_active()) |
| 1930 return E_FAIL; | 2167 return E_FAIL; |
| 1931 | 2168 |
| 1932 if (!table) | 2169 if (!table) |
| 1933 return E_INVALIDARG; | 2170 return E_INVALIDARG; |
| 1934 | 2171 |
| 1935 | 2172 |
| 1936 int row; | 2173 int row; |
| 1937 int column; | 2174 int column; |
| 1938 GetIntAttribute(ui::AX_ATTR_TABLE_CELL_ROW_INDEX, &row); | 2175 GetIntAttribute(ui::AX_ATTR_TABLE_CELL_ROW_INDEX, &row); |
| (...skipping 11 matching lines...) Expand all Loading... | |
| 1950 ToBrowserAccessibilityWin(find_table)->NewReference()); | 2187 ToBrowserAccessibilityWin(find_table)->NewReference()); |
| 1951 | 2188 |
| 1952 return S_OK; | 2189 return S_OK; |
| 1953 } | 2190 } |
| 1954 | 2191 |
| 1955 // | 2192 // |
| 1956 // IAccessibleText methods. | 2193 // IAccessibleText methods. |
| 1957 // | 2194 // |
| 1958 | 2195 |
| 1959 STDMETHODIMP BrowserAccessibilityWin::get_nCharacters(LONG* n_characters) { | 2196 STDMETHODIMP BrowserAccessibilityWin::get_nCharacters(LONG* n_characters) { |
| 2197 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_N_CHARACTERS); | |
| 1960 if (!instance_active()) | 2198 if (!instance_active()) |
| 1961 return E_FAIL; | 2199 return E_FAIL; |
| 1962 | 2200 |
| 1963 if (!n_characters) | 2201 if (!n_characters) |
| 1964 return E_INVALIDARG; | 2202 return E_INVALIDARG; |
| 1965 | 2203 |
| 1966 *n_characters = static_cast<LONG>(GetText().size()); | 2204 *n_characters = static_cast<LONG>(GetText().size()); |
| 1967 return S_OK; | 2205 return S_OK; |
| 1968 } | 2206 } |
| 1969 | 2207 |
| 1970 STDMETHODIMP BrowserAccessibilityWin::get_caretOffset(LONG* offset) { | 2208 STDMETHODIMP BrowserAccessibilityWin::get_caretOffset(LONG* offset) { |
| 2209 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_CARET_OFFSET); | |
| 1971 if (!instance_active()) | 2210 if (!instance_active()) |
| 1972 return E_FAIL; | 2211 return E_FAIL; |
| 1973 | 2212 |
| 1974 if (!offset) | 2213 if (!offset) |
| 1975 return E_INVALIDARG; | 2214 return E_INVALIDARG; |
| 1976 | 2215 |
| 1977 if (!HasCaret()) | 2216 if (!HasCaret()) |
| 1978 return S_FALSE; | 2217 return S_FALSE; |
| 1979 | 2218 |
| 1980 int selection_start, selection_end; | 2219 int selection_start, selection_end; |
| 1981 GetSelectionOffsets(&selection_start, &selection_end); | 2220 GetSelectionOffsets(&selection_start, &selection_end); |
| 1982 // The caret is always at the end of the selection. | 2221 // The caret is always at the end of the selection. |
| 1983 *offset = selection_end; | 2222 *offset = selection_end; |
| 1984 if (*offset < 0) | 2223 if (*offset < 0) |
| 1985 return S_FALSE; | 2224 return S_FALSE; |
| 1986 | 2225 |
| 1987 return S_OK; | 2226 return S_OK; |
| 1988 } | 2227 } |
| 1989 | 2228 |
| 1990 STDMETHODIMP BrowserAccessibilityWin::get_characterExtents( | 2229 STDMETHODIMP BrowserAccessibilityWin::get_characterExtents( |
| 1991 LONG offset, | 2230 LONG offset, |
| 1992 IA2CoordinateType coordinate_type, | 2231 IA2CoordinateType coordinate_type, |
| 1993 LONG* out_x, | 2232 LONG* out_x, |
| 1994 LONG* out_y, | 2233 LONG* out_y, |
| 1995 LONG* out_width, | 2234 LONG* out_width, |
| 1996 LONG* out_height) { | 2235 LONG* out_height) { |
| 2236 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_CHARACTER_EXTENTS); | |
| 1997 if (!instance_active()) | 2237 if (!instance_active()) |
| 1998 return E_FAIL; | 2238 return E_FAIL; |
| 1999 | 2239 |
| 2000 if (!out_x || !out_y || !out_width || !out_height) | 2240 if (!out_x || !out_y || !out_width || !out_height) |
| 2001 return E_INVALIDARG; | 2241 return E_INVALIDARG; |
| 2002 | 2242 |
| 2003 const base::string16& text_str = GetText(); | 2243 const base::string16& text_str = GetText(); |
| 2004 HandleSpecialTextOffset(text_str, &offset); | 2244 HandleSpecialTextOffset(text_str, &offset); |
| 2005 | 2245 |
| 2006 if (offset < 0 || offset > static_cast<LONG>(text_str.size())) | 2246 if (offset < 0 || offset > static_cast<LONG>(text_str.size())) |
| (...skipping 12 matching lines...) Expand all Loading... | |
| 2019 | 2259 |
| 2020 *out_x = character_bounds.x(); | 2260 *out_x = character_bounds.x(); |
| 2021 *out_y = character_bounds.y(); | 2261 *out_y = character_bounds.y(); |
| 2022 *out_width = character_bounds.width(); | 2262 *out_width = character_bounds.width(); |
| 2023 *out_height = character_bounds.height(); | 2263 *out_height = character_bounds.height(); |
| 2024 | 2264 |
| 2025 return S_OK; | 2265 return S_OK; |
| 2026 } | 2266 } |
| 2027 | 2267 |
| 2028 STDMETHODIMP BrowserAccessibilityWin::get_nSelections(LONG* n_selections) { | 2268 STDMETHODIMP BrowserAccessibilityWin::get_nSelections(LONG* n_selections) { |
| 2269 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_N_SELECTIONS); | |
| 2029 if (!instance_active()) | 2270 if (!instance_active()) |
| 2030 return E_FAIL; | 2271 return E_FAIL; |
| 2031 | 2272 |
| 2032 if (!n_selections) | 2273 if (!n_selections) |
| 2033 return E_INVALIDARG; | 2274 return E_INVALIDARG; |
| 2034 | 2275 |
| 2035 *n_selections = 0; | 2276 *n_selections = 0; |
| 2036 int selection_start, selection_end; | 2277 int selection_start, selection_end; |
| 2037 GetSelectionOffsets(&selection_start, &selection_end); | 2278 GetSelectionOffsets(&selection_start, &selection_end); |
| 2038 if (selection_start >= 0 && selection_end >= 0 && | 2279 if (selection_start >= 0 && selection_end >= 0 && |
| 2039 selection_start != selection_end) { | 2280 selection_start != selection_end) { |
| 2040 *n_selections = 1; | 2281 *n_selections = 1; |
| 2041 } | 2282 } |
| 2042 | 2283 |
| 2043 return S_OK; | 2284 return S_OK; |
| 2044 } | 2285 } |
| 2045 | 2286 |
| 2046 STDMETHODIMP BrowserAccessibilityWin::get_selection(LONG selection_index, | 2287 STDMETHODIMP BrowserAccessibilityWin::get_selection(LONG selection_index, |
| 2047 LONG* start_offset, | 2288 LONG* start_offset, |
| 2048 LONG* end_offset) { | 2289 LONG* end_offset) { |
| 2290 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_SELECTION); | |
| 2049 if (!instance_active()) | 2291 if (!instance_active()) |
| 2050 return E_FAIL; | 2292 return E_FAIL; |
| 2051 | 2293 |
| 2052 if (!start_offset || !end_offset || selection_index != 0) | 2294 if (!start_offset || !end_offset || selection_index != 0) |
| 2053 return E_INVALIDARG; | 2295 return E_INVALIDARG; |
| 2054 | 2296 |
| 2055 LONG n_selections = 0; | 2297 LONG n_selections = 0; |
| 2056 if (FAILED(get_nSelections(&n_selections)) || n_selections < 1) | 2298 if (FAILED(get_nSelections(&n_selections)) || n_selections < 1) |
| 2057 return E_INVALIDARG; | 2299 return E_INVALIDARG; |
| 2058 | 2300 |
| (...skipping 12 matching lines...) Expand all Loading... | |
| 2071 *start_offset = selection_start; | 2313 *start_offset = selection_start; |
| 2072 *end_offset = selection_end; | 2314 *end_offset = selection_end; |
| 2073 } | 2315 } |
| 2074 | 2316 |
| 2075 return S_OK; | 2317 return S_OK; |
| 2076 } | 2318 } |
| 2077 | 2319 |
| 2078 STDMETHODIMP BrowserAccessibilityWin::get_text(LONG start_offset, | 2320 STDMETHODIMP BrowserAccessibilityWin::get_text(LONG start_offset, |
| 2079 LONG end_offset, | 2321 LONG end_offset, |
| 2080 BSTR* text) { | 2322 BSTR* text) { |
| 2323 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_TEXT); | |
| 2081 if (!instance_active()) | 2324 if (!instance_active()) |
| 2082 return E_FAIL; | 2325 return E_FAIL; |
| 2083 | 2326 |
| 2084 if (!text) | 2327 if (!text) |
| 2085 return E_INVALIDARG; | 2328 return E_INVALIDARG; |
| 2086 | 2329 |
| 2087 const base::string16& text_str = GetText(); | 2330 const base::string16& text_str = GetText(); |
| 2088 HandleSpecialTextOffset(text_str, &start_offset); | 2331 HandleSpecialTextOffset(text_str, &start_offset); |
| 2089 HandleSpecialTextOffset(text_str, &end_offset); | 2332 HandleSpecialTextOffset(text_str, &end_offset); |
| 2090 | 2333 |
| (...skipping 22 matching lines...) Expand all Loading... | |
| 2113 DCHECK(*text); | 2356 DCHECK(*text); |
| 2114 return S_OK; | 2357 return S_OK; |
| 2115 } | 2358 } |
| 2116 | 2359 |
| 2117 STDMETHODIMP BrowserAccessibilityWin::get_textAtOffset( | 2360 STDMETHODIMP BrowserAccessibilityWin::get_textAtOffset( |
| 2118 LONG offset, | 2361 LONG offset, |
| 2119 IA2TextBoundaryType boundary_type, | 2362 IA2TextBoundaryType boundary_type, |
| 2120 LONG* start_offset, | 2363 LONG* start_offset, |
| 2121 LONG* end_offset, | 2364 LONG* end_offset, |
| 2122 BSTR* text) { | 2365 BSTR* text) { |
| 2366 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_TEXT_AT_OFFSET); | |
| 2123 if (!instance_active()) | 2367 if (!instance_active()) |
| 2124 return E_FAIL; | 2368 return E_FAIL; |
| 2125 | 2369 |
| 2126 if (!start_offset || !end_offset || !text) | 2370 if (!start_offset || !end_offset || !text) |
| 2127 return E_INVALIDARG; | 2371 return E_INVALIDARG; |
| 2128 | 2372 |
| 2129 const base::string16& text_str = GetText(); | 2373 const base::string16& text_str = GetText(); |
| 2130 HandleSpecialTextOffset(text_str, &offset); | 2374 HandleSpecialTextOffset(text_str, &offset); |
| 2131 if (offset < 0) | 2375 if (offset < 0) |
| 2132 return E_INVALIDARG; | 2376 return E_INVALIDARG; |
| (...skipping 30 matching lines...) Expand all Loading... | |
| 2163 text_str, boundary_type, offset, ui::FORWARDS_DIRECTION); | 2407 text_str, boundary_type, offset, ui::FORWARDS_DIRECTION); |
| 2164 return get_text(*start_offset, *end_offset, text); | 2408 return get_text(*start_offset, *end_offset, text); |
| 2165 } | 2409 } |
| 2166 | 2410 |
| 2167 STDMETHODIMP BrowserAccessibilityWin::get_textBeforeOffset( | 2411 STDMETHODIMP BrowserAccessibilityWin::get_textBeforeOffset( |
| 2168 LONG offset, | 2412 LONG offset, |
| 2169 IA2TextBoundaryType boundary_type, | 2413 IA2TextBoundaryType boundary_type, |
| 2170 LONG* start_offset, | 2414 LONG* start_offset, |
| 2171 LONG* end_offset, | 2415 LONG* end_offset, |
| 2172 BSTR* text) { | 2416 BSTR* text) { |
| 2417 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_TEXT_BEFORE_OFFSET); | |
| 2173 if (!instance_active()) | 2418 if (!instance_active()) |
| 2174 return E_FAIL; | 2419 return E_FAIL; |
| 2175 | 2420 |
| 2176 if (!start_offset || !end_offset || !text) | 2421 if (!start_offset || !end_offset || !text) |
| 2177 return E_INVALIDARG; | 2422 return E_INVALIDARG; |
| 2178 | 2423 |
| 2179 // The IAccessible2 spec says we don't have to implement the "sentence" | 2424 // The IAccessible2 spec says we don't have to implement the "sentence" |
| 2180 // boundary type, we can just let the screenreader handle it. | 2425 // boundary type, we can just let the screenreader handle it. |
| 2181 if (boundary_type == IA2_TEXT_BOUNDARY_SENTENCE) { | 2426 if (boundary_type == IA2_TEXT_BOUNDARY_SENTENCE) { |
| 2182 *start_offset = 0; | 2427 *start_offset = 0; |
| 2183 *end_offset = 0; | 2428 *end_offset = 0; |
| 2184 *text = NULL; | 2429 *text = NULL; |
| 2185 return S_FALSE; | 2430 return S_FALSE; |
| 2186 } | 2431 } |
| 2187 | 2432 |
| 2188 const base::string16& text_str = GetText(); | 2433 const base::string16& text_str = GetText(); |
| 2189 | 2434 |
| 2190 *start_offset = FindBoundary( | 2435 *start_offset = FindBoundary( |
| 2191 text_str, boundary_type, offset, ui::BACKWARDS_DIRECTION); | 2436 text_str, boundary_type, offset, ui::BACKWARDS_DIRECTION); |
| 2192 *end_offset = offset; | 2437 *end_offset = offset; |
| 2193 return get_text(*start_offset, *end_offset, text); | 2438 return get_text(*start_offset, *end_offset, text); |
| 2194 } | 2439 } |
| 2195 | 2440 |
| 2196 STDMETHODIMP BrowserAccessibilityWin::get_textAfterOffset( | 2441 STDMETHODIMP BrowserAccessibilityWin::get_textAfterOffset( |
| 2197 LONG offset, | 2442 LONG offset, |
| 2198 IA2TextBoundaryType boundary_type, | 2443 IA2TextBoundaryType boundary_type, |
| 2199 LONG* start_offset, | 2444 LONG* start_offset, |
| 2200 LONG* end_offset, | 2445 LONG* end_offset, |
| 2201 BSTR* text) { | 2446 BSTR* text) { |
| 2447 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_TEXT_AFTER_OFFSET); | |
| 2202 if (!instance_active()) | 2448 if (!instance_active()) |
| 2203 return E_FAIL; | 2449 return E_FAIL; |
| 2204 | 2450 |
| 2205 if (!start_offset || !end_offset || !text) | 2451 if (!start_offset || !end_offset || !text) |
| 2206 return E_INVALIDARG; | 2452 return E_INVALIDARG; |
| 2207 | 2453 |
| 2208 // The IAccessible2 spec says we don't have to implement the "sentence" | 2454 // The IAccessible2 spec says we don't have to implement the "sentence" |
| 2209 // boundary type, we can just let the screenreader handle it. | 2455 // boundary type, we can just let the screenreader handle it. |
| 2210 if (boundary_type == IA2_TEXT_BOUNDARY_SENTENCE) { | 2456 if (boundary_type == IA2_TEXT_BOUNDARY_SENTENCE) { |
| 2211 *start_offset = 0; | 2457 *start_offset = 0; |
| 2212 *end_offset = 0; | 2458 *end_offset = 0; |
| 2213 *text = NULL; | 2459 *text = NULL; |
| 2214 return S_FALSE; | 2460 return S_FALSE; |
| 2215 } | 2461 } |
| 2216 | 2462 |
| 2217 const base::string16& text_str = GetText(); | 2463 const base::string16& text_str = GetText(); |
| 2218 | 2464 |
| 2219 *start_offset = offset; | 2465 *start_offset = offset; |
| 2220 *end_offset = FindBoundary( | 2466 *end_offset = FindBoundary( |
| 2221 text_str, boundary_type, offset, ui::FORWARDS_DIRECTION); | 2467 text_str, boundary_type, offset, ui::FORWARDS_DIRECTION); |
| 2222 return get_text(*start_offset, *end_offset, text); | 2468 return get_text(*start_offset, *end_offset, text); |
| 2223 } | 2469 } |
| 2224 | 2470 |
| 2225 STDMETHODIMP BrowserAccessibilityWin::get_newText(IA2TextSegment* new_text) { | 2471 STDMETHODIMP BrowserAccessibilityWin::get_newText(IA2TextSegment* new_text) { |
| 2472 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_NEW_TEXT); | |
| 2226 if (!instance_active()) | 2473 if (!instance_active()) |
| 2227 return E_FAIL; | 2474 return E_FAIL; |
| 2228 | 2475 |
| 2229 if (!new_text) | 2476 if (!new_text) |
| 2230 return E_INVALIDARG; | 2477 return E_INVALIDARG; |
| 2231 | 2478 |
| 2232 if (!old_win_attributes_) | 2479 if (!old_win_attributes_) |
| 2233 return E_FAIL; | 2480 return E_FAIL; |
| 2234 | 2481 |
| 2235 int start, old_len, new_len; | 2482 int start, old_len, new_len; |
| 2236 ComputeHypertextRemovedAndInserted(&start, &old_len, &new_len); | 2483 ComputeHypertextRemovedAndInserted(&start, &old_len, &new_len); |
| 2237 if (new_len == 0) | 2484 if (new_len == 0) |
| 2238 return E_FAIL; | 2485 return E_FAIL; |
| 2239 | 2486 |
| 2240 base::string16 substr = GetText().substr(start, new_len); | 2487 base::string16 substr = GetText().substr(start, new_len); |
| 2241 new_text->text = SysAllocString(substr.c_str()); | 2488 new_text->text = SysAllocString(substr.c_str()); |
| 2242 new_text->start = static_cast<long>(start); | 2489 new_text->start = static_cast<long>(start); |
| 2243 new_text->end = static_cast<long>(start + new_len); | 2490 new_text->end = static_cast<long>(start + new_len); |
| 2244 return S_OK; | 2491 return S_OK; |
| 2245 } | 2492 } |
| 2246 | 2493 |
| 2247 STDMETHODIMP BrowserAccessibilityWin::get_oldText(IA2TextSegment* old_text) { | 2494 STDMETHODIMP BrowserAccessibilityWin::get_oldText(IA2TextSegment* old_text) { |
| 2495 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_OLD_TEXT); | |
| 2248 if (!instance_active()) | 2496 if (!instance_active()) |
| 2249 return E_FAIL; | 2497 return E_FAIL; |
| 2250 | 2498 |
| 2251 if (!old_text) | 2499 if (!old_text) |
| 2252 return E_INVALIDARG; | 2500 return E_INVALIDARG; |
| 2253 | 2501 |
| 2254 if (!old_win_attributes_) | 2502 if (!old_win_attributes_) |
| 2255 return E_FAIL; | 2503 return E_FAIL; |
| 2256 | 2504 |
| 2257 int start, old_len, new_len; | 2505 int start, old_len, new_len; |
| 2258 ComputeHypertextRemovedAndInserted(&start, &old_len, &new_len); | 2506 ComputeHypertextRemovedAndInserted(&start, &old_len, &new_len); |
| 2259 if (old_len == 0) | 2507 if (old_len == 0) |
| 2260 return E_FAIL; | 2508 return E_FAIL; |
| 2261 | 2509 |
| 2262 base::string16 old_hypertext = old_win_attributes_->hypertext; | 2510 base::string16 old_hypertext = old_win_attributes_->hypertext; |
| 2263 base::string16 substr = old_hypertext.substr(start, old_len); | 2511 base::string16 substr = old_hypertext.substr(start, old_len); |
| 2264 old_text->text = SysAllocString(substr.c_str()); | 2512 old_text->text = SysAllocString(substr.c_str()); |
| 2265 old_text->start = static_cast<long>(start); | 2513 old_text->start = static_cast<long>(start); |
| 2266 old_text->end = static_cast<long>(start + old_len); | 2514 old_text->end = static_cast<long>(start + old_len); |
| 2267 return S_OK; | 2515 return S_OK; |
| 2268 } | 2516 } |
| 2269 | 2517 |
| 2270 STDMETHODIMP BrowserAccessibilityWin::get_offsetAtPoint( | 2518 STDMETHODIMP BrowserAccessibilityWin::get_offsetAtPoint( |
| 2271 LONG x, | 2519 LONG x, |
| 2272 LONG y, | 2520 LONG y, |
| 2273 IA2CoordinateType coord_type, | 2521 IA2CoordinateType coord_type, |
| 2274 LONG* offset) { | 2522 LONG* offset) { |
| 2523 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_OFFSET_AT_POINT); | |
| 2275 if (!instance_active()) | 2524 if (!instance_active()) |
| 2276 return E_FAIL; | 2525 return E_FAIL; |
| 2277 | 2526 |
| 2278 if (!offset) | 2527 if (!offset) |
| 2279 return E_INVALIDARG; | 2528 return E_INVALIDARG; |
| 2280 | 2529 |
| 2281 // TODO(dmazzoni): implement this. We're returning S_OK for now so that | 2530 // TODO(dmazzoni): implement this. We're returning S_OK for now so that |
| 2282 // screen readers still return partially accurate results rather than | 2531 // screen readers still return partially accurate results rather than |
| 2283 // completely failing. | 2532 // completely failing. |
| 2284 *offset = 0; | 2533 *offset = 0; |
| 2285 return S_OK; | 2534 return S_OK; |
| 2286 } | 2535 } |
| 2287 | 2536 |
| 2288 STDMETHODIMP BrowserAccessibilityWin::scrollSubstringTo( | 2537 STDMETHODIMP BrowserAccessibilityWin::scrollSubstringTo( |
| 2289 LONG start_index, | 2538 LONG start_index, |
| 2290 LONG end_index, | 2539 LONG end_index, |
| 2291 IA2ScrollType scroll_type) { | 2540 IA2ScrollType scroll_type) { |
| 2541 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_SCROLL_SUBSTRING_TO); | |
| 2292 // TODO(dmazzoni): adjust this for the start and end index, too. | 2542 // TODO(dmazzoni): adjust this for the start and end index, too. |
| 2293 return scrollTo(scroll_type); | 2543 return scrollTo(scroll_type); |
| 2294 } | 2544 } |
| 2295 | 2545 |
| 2296 STDMETHODIMP BrowserAccessibilityWin::scrollSubstringToPoint( | 2546 STDMETHODIMP BrowserAccessibilityWin::scrollSubstringToPoint( |
| 2297 LONG start_index, | 2547 LONG start_index, |
| 2298 LONG end_index, | 2548 LONG end_index, |
| 2299 IA2CoordinateType coordinate_type, | 2549 IA2CoordinateType coordinate_type, |
| 2300 LONG x, | 2550 LONG x, |
| 2301 LONG y) { | 2551 LONG y) { |
| 2552 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_SCROLL_SUBSTRING_TO_POINT); | |
| 2302 // TODO(dmazzoni): adjust this for the start and end index, too. | 2553 // TODO(dmazzoni): adjust this for the start and end index, too. |
| 2303 return scrollToPoint(coordinate_type, x, y); | 2554 return scrollToPoint(coordinate_type, x, y); |
| 2304 } | 2555 } |
| 2305 | 2556 |
| 2306 STDMETHODIMP BrowserAccessibilityWin::addSelection(LONG start_offset, | 2557 STDMETHODIMP BrowserAccessibilityWin::addSelection(LONG start_offset, |
| 2307 LONG end_offset) { | 2558 LONG end_offset) { |
| 2559 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_ADD_SELECTION); | |
| 2308 if (!instance_active()) | 2560 if (!instance_active()) |
| 2309 return E_FAIL; | 2561 return E_FAIL; |
| 2310 | 2562 |
| 2311 const base::string16& text_str = GetText(); | 2563 const base::string16& text_str = GetText(); |
| 2312 HandleSpecialTextOffset(text_str, &start_offset); | 2564 HandleSpecialTextOffset(text_str, &start_offset); |
| 2313 HandleSpecialTextOffset(text_str, &end_offset); | 2565 HandleSpecialTextOffset(text_str, &end_offset); |
| 2314 | 2566 |
| 2315 manager()->SetTextSelection(*this, start_offset, end_offset); | 2567 manager()->SetTextSelection(*this, start_offset, end_offset); |
| 2316 return S_OK; | 2568 return S_OK; |
| 2317 } | 2569 } |
| 2318 | 2570 |
| 2319 STDMETHODIMP BrowserAccessibilityWin::removeSelection(LONG selection_index) { | 2571 STDMETHODIMP BrowserAccessibilityWin::removeSelection(LONG selection_index) { |
| 2572 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_REMOVE_SELECTION); | |
| 2320 if (!instance_active()) | 2573 if (!instance_active()) |
| 2321 return E_FAIL; | 2574 return E_FAIL; |
| 2322 | 2575 |
| 2323 if (selection_index != 0) | 2576 if (selection_index != 0) |
| 2324 return E_INVALIDARG; | 2577 return E_INVALIDARG; |
| 2325 | 2578 |
| 2326 manager()->SetTextSelection(*this, 0, 0); | 2579 manager()->SetTextSelection(*this, 0, 0); |
| 2327 return S_OK; | 2580 return S_OK; |
| 2328 } | 2581 } |
| 2329 | 2582 |
| 2330 STDMETHODIMP BrowserAccessibilityWin::setCaretOffset(LONG offset) { | 2583 STDMETHODIMP BrowserAccessibilityWin::setCaretOffset(LONG offset) { |
| 2584 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_SET_CARET_OFFSET); | |
| 2331 if (!instance_active()) | 2585 if (!instance_active()) |
| 2332 return E_FAIL; | 2586 return E_FAIL; |
| 2333 | 2587 |
| 2334 const base::string16& text_str = GetText(); | 2588 const base::string16& text_str = GetText(); |
| 2335 HandleSpecialTextOffset(text_str, &offset); | 2589 HandleSpecialTextOffset(text_str, &offset); |
| 2336 manager()->SetTextSelection(*this, offset, offset); | 2590 manager()->SetTextSelection(*this, offset, offset); |
| 2337 return S_OK; | 2591 return S_OK; |
| 2338 } | 2592 } |
| 2339 | 2593 |
| 2340 STDMETHODIMP BrowserAccessibilityWin::setSelection(LONG selection_index, | 2594 STDMETHODIMP BrowserAccessibilityWin::setSelection(LONG selection_index, |
| 2341 LONG start_offset, | 2595 LONG start_offset, |
| 2342 LONG end_offset) { | 2596 LONG end_offset) { |
| 2597 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_SET_SELECTION); | |
| 2343 if (!instance_active()) | 2598 if (!instance_active()) |
| 2344 return E_FAIL; | 2599 return E_FAIL; |
| 2345 | 2600 |
| 2346 if (selection_index != 0) | 2601 if (selection_index != 0) |
| 2347 return E_INVALIDARG; | 2602 return E_INVALIDARG; |
| 2348 | 2603 |
| 2349 const base::string16& text_str = GetText(); | 2604 const base::string16& text_str = GetText(); |
| 2350 HandleSpecialTextOffset(text_str, &start_offset); | 2605 HandleSpecialTextOffset(text_str, &start_offset); |
| 2351 HandleSpecialTextOffset(text_str, &end_offset); | 2606 HandleSpecialTextOffset(text_str, &end_offset); |
| 2352 | 2607 |
| 2353 manager()->SetTextSelection(*this, start_offset, end_offset); | 2608 manager()->SetTextSelection(*this, start_offset, end_offset); |
| 2354 return S_OK; | 2609 return S_OK; |
| 2355 } | 2610 } |
| 2356 | 2611 |
| 2357 STDMETHODIMP BrowserAccessibilityWin::get_attributes(LONG offset, | 2612 STDMETHODIMP BrowserAccessibilityWin::get_attributes(LONG offset, |
| 2358 LONG* start_offset, | 2613 LONG* start_offset, |
| 2359 LONG* end_offset, | 2614 LONG* end_offset, |
| 2360 BSTR* text_attributes) { | 2615 BSTR* text_attributes) { |
| 2616 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_IATEXT_GET_ATTRIBUTES); | |
| 2361 if (!start_offset || !end_offset || !text_attributes) | 2617 if (!start_offset || !end_offset || !text_attributes) |
| 2362 return E_INVALIDARG; | 2618 return E_INVALIDARG; |
| 2363 | 2619 |
| 2364 *start_offset = *end_offset = 0; | 2620 *start_offset = *end_offset = 0; |
| 2365 *text_attributes = nullptr; | 2621 *text_attributes = nullptr; |
| 2366 if (!instance_active()) | 2622 if (!instance_active()) |
| 2367 return E_FAIL; | 2623 return E_FAIL; |
| 2368 | 2624 |
| 2369 const base::string16& text = GetText(); | 2625 const base::string16& text = GetText(); |
| 2370 HandleSpecialTextOffset(text, &offset); | 2626 HandleSpecialTextOffset(text, &offset); |
| (...skipping 17 matching lines...) Expand all Loading... | |
| 2388 *text_attributes = SysAllocString(attributes_str.c_str()); | 2644 *text_attributes = SysAllocString(attributes_str.c_str()); |
| 2389 DCHECK(*text_attributes); | 2645 DCHECK(*text_attributes); |
| 2390 return S_OK; | 2646 return S_OK; |
| 2391 } | 2647 } |
| 2392 | 2648 |
| 2393 // | 2649 // |
| 2394 // IAccessibleHypertext methods. | 2650 // IAccessibleHypertext methods. |
| 2395 // | 2651 // |
| 2396 | 2652 |
| 2397 STDMETHODIMP BrowserAccessibilityWin::get_nHyperlinks(long* hyperlink_count) { | 2653 STDMETHODIMP BrowserAccessibilityWin::get_nHyperlinks(long* hyperlink_count) { |
| 2654 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_N_HYPERLINKS); | |
| 2398 if (!instance_active()) | 2655 if (!instance_active()) |
| 2399 return E_FAIL; | 2656 return E_FAIL; |
| 2400 | 2657 |
| 2401 if (!hyperlink_count) | 2658 if (!hyperlink_count) |
| 2402 return E_INVALIDARG; | 2659 return E_INVALIDARG; |
| 2403 | 2660 |
| 2404 *hyperlink_count = hyperlink_offset_to_index().size(); | 2661 *hyperlink_count = hyperlink_offset_to_index().size(); |
| 2405 return S_OK; | 2662 return S_OK; |
| 2406 } | 2663 } |
| 2407 | 2664 |
| 2408 STDMETHODIMP BrowserAccessibilityWin::get_hyperlink( | 2665 STDMETHODIMP BrowserAccessibilityWin::get_hyperlink( |
| 2409 long index, | 2666 long index, |
| 2410 IAccessibleHyperlink** hyperlink) { | 2667 IAccessibleHyperlink** hyperlink) { |
| 2668 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_HYPERLINK); | |
| 2411 if (!instance_active()) | 2669 if (!instance_active()) |
| 2412 return E_FAIL; | 2670 return E_FAIL; |
| 2413 | 2671 |
| 2414 if (!hyperlink || | 2672 if (!hyperlink || |
| 2415 index < 0 || | 2673 index < 0 || |
| 2416 index >= static_cast<long>(hyperlinks().size())) { | 2674 index >= static_cast<long>(hyperlinks().size())) { |
| 2417 return E_INVALIDARG; | 2675 return E_INVALIDARG; |
| 2418 } | 2676 } |
| 2419 | 2677 |
| 2420 int32_t id = hyperlinks()[index]; | 2678 int32_t id = hyperlinks()[index]; |
| 2421 BrowserAccessibilityWin* link = | 2679 BrowserAccessibilityWin* link = |
| 2422 ToBrowserAccessibilityWin(GetFromUniqueID(id)); | 2680 ToBrowserAccessibilityWin(GetFromUniqueID(id)); |
| 2423 if (!link) | 2681 if (!link) |
| 2424 return E_FAIL; | 2682 return E_FAIL; |
| 2425 | 2683 |
| 2426 *hyperlink = static_cast<IAccessibleHyperlink*>(link->NewReference()); | 2684 *hyperlink = static_cast<IAccessibleHyperlink*>(link->NewReference()); |
| 2427 return S_OK; | 2685 return S_OK; |
| 2428 } | 2686 } |
| 2429 | 2687 |
| 2430 STDMETHODIMP BrowserAccessibilityWin::get_hyperlinkIndex( | 2688 STDMETHODIMP BrowserAccessibilityWin::get_hyperlinkIndex( |
| 2431 long char_index, | 2689 long char_index, |
| 2432 long* hyperlink_index) { | 2690 long* hyperlink_index) { |
| 2691 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_HYPERLINK_INDEX); | |
| 2433 if (!instance_active()) | 2692 if (!instance_active()) |
| 2434 return E_FAIL; | 2693 return E_FAIL; |
| 2435 | 2694 |
| 2436 if (!hyperlink_index) | 2695 if (!hyperlink_index) |
| 2437 return E_INVALIDARG; | 2696 return E_INVALIDARG; |
| 2438 | 2697 |
| 2439 if (char_index < 0 || char_index >= static_cast<long>(GetText().size())) { | 2698 if (char_index < 0 || char_index >= static_cast<long>(GetText().size())) { |
| 2440 return E_INVALIDARG; | 2699 return E_INVALIDARG; |
| 2441 } | 2700 } |
| 2442 | 2701 |
| 2443 std::map<int32_t, int32_t>::iterator it = | 2702 std::map<int32_t, int32_t>::iterator it = |
| 2444 hyperlink_offset_to_index().find(char_index); | 2703 hyperlink_offset_to_index().find(char_index); |
| 2445 if (it == hyperlink_offset_to_index().end()) { | 2704 if (it == hyperlink_offset_to_index().end()) { |
| 2446 *hyperlink_index = -1; | 2705 *hyperlink_index = -1; |
| 2447 return S_FALSE; | 2706 return S_FALSE; |
| 2448 } | 2707 } |
| 2449 | 2708 |
| 2450 *hyperlink_index = it->second; | 2709 *hyperlink_index = it->second; |
| 2451 return S_OK; | 2710 return S_OK; |
| 2452 } | 2711 } |
| 2453 | 2712 |
| 2454 // | 2713 // |
| 2455 // IAccessibleHyperlink methods. | 2714 // IAccessibleHyperlink methods. |
| 2456 // | 2715 // |
| 2457 | 2716 |
| 2458 // Currently, only text links are supported. | 2717 // Currently, only text links are supported. |
| 2459 STDMETHODIMP BrowserAccessibilityWin::get_anchor(long index, VARIANT* anchor) { | 2718 STDMETHODIMP BrowserAccessibilityWin::get_anchor(long index, VARIANT* anchor) { |
| 2719 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_ANCHOR); | |
| 2460 if (!instance_active() || !IsHyperlink()) | 2720 if (!instance_active() || !IsHyperlink()) |
| 2461 return E_FAIL; | 2721 return E_FAIL; |
| 2462 | 2722 |
| 2463 // IA2 text links can have only one anchor, that is the text inside them. | 2723 // IA2 text links can have only one anchor, that is the text inside them. |
| 2464 if (index != 0 || !anchor) | 2724 if (index != 0 || !anchor) |
| 2465 return E_INVALIDARG; | 2725 return E_INVALIDARG; |
| 2466 | 2726 |
| 2467 BSTR ia2_hypertext = SysAllocString(GetText().c_str()); | 2727 BSTR ia2_hypertext = SysAllocString(GetText().c_str()); |
| 2468 DCHECK(ia2_hypertext); | 2728 DCHECK(ia2_hypertext); |
| 2469 anchor->vt = VT_BSTR; | 2729 anchor->vt = VT_BSTR; |
| 2470 anchor->bstrVal = ia2_hypertext; | 2730 anchor->bstrVal = ia2_hypertext; |
| 2471 | 2731 |
| 2472 // Returning S_FALSE is not mentioned in the IA2 Spec, but it might have been | 2732 // Returning S_FALSE is not mentioned in the IA2 Spec, but it might have been |
| 2473 // an oversight. | 2733 // an oversight. |
| 2474 if (!SysStringLen(ia2_hypertext)) | 2734 if (!SysStringLen(ia2_hypertext)) |
| 2475 return S_FALSE; | 2735 return S_FALSE; |
| 2476 | 2736 |
| 2477 return S_OK; | 2737 return S_OK; |
| 2478 } | 2738 } |
| 2479 | 2739 |
| 2480 // Currently, only text links are supported. | 2740 // Currently, only text links are supported. |
| 2481 STDMETHODIMP BrowserAccessibilityWin::get_anchorTarget(long index, | 2741 STDMETHODIMP BrowserAccessibilityWin::get_anchorTarget(long index, |
| 2482 VARIANT* anchor_target) { | 2742 VARIANT* anchor_target) { |
| 2743 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_ANCHOR_TARGET); | |
| 2483 if (!instance_active() || !IsHyperlink()) | 2744 if (!instance_active() || !IsHyperlink()) |
| 2484 return E_FAIL; | 2745 return E_FAIL; |
| 2485 | 2746 |
| 2486 // IA2 text links can have at most one target, that is when they represent an | 2747 // IA2 text links can have at most one target, that is when they represent an |
| 2487 // HTML hyperlink, i.e. an <a> element with a "href" attribute. | 2748 // HTML hyperlink, i.e. an <a> element with a "href" attribute. |
| 2488 if (index != 0 || !anchor_target) | 2749 if (index != 0 || !anchor_target) |
| 2489 return E_INVALIDARG; | 2750 return E_INVALIDARG; |
| 2490 | 2751 |
| 2491 BSTR target; | 2752 BSTR target; |
| 2492 if (!(ia_state() & STATE_SYSTEM_LINKED) || | 2753 if (!(ia_state() & STATE_SYSTEM_LINKED) || |
| 2493 FAILED(GetStringAttributeAsBstr(ui::AX_ATTR_URL, &target))) { | 2754 FAILED(GetStringAttributeAsBstr(ui::AX_ATTR_URL, &target))) { |
| 2494 target = SysAllocString(L""); | 2755 target = SysAllocString(L""); |
| 2495 } | 2756 } |
| 2496 DCHECK(target); | 2757 DCHECK(target); |
| 2497 anchor_target->vt = VT_BSTR; | 2758 anchor_target->vt = VT_BSTR; |
| 2498 anchor_target->bstrVal = target; | 2759 anchor_target->bstrVal = target; |
| 2499 | 2760 |
| 2500 // Returning S_FALSE is not mentioned in the IA2 Spec, but it might have been | 2761 // Returning S_FALSE is not mentioned in the IA2 Spec, but it might have been |
| 2501 // an oversight. | 2762 // an oversight. |
| 2502 if (!SysStringLen(target)) | 2763 if (!SysStringLen(target)) |
| 2503 return S_FALSE; | 2764 return S_FALSE; |
| 2504 | 2765 |
| 2505 return S_OK; | 2766 return S_OK; |
| 2506 } | 2767 } |
| 2507 | 2768 |
| 2508 STDMETHODIMP BrowserAccessibilityWin::get_startIndex(long* index) { | 2769 STDMETHODIMP BrowserAccessibilityWin::get_startIndex(long* index) { |
| 2770 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_START_INDEX); | |
| 2509 if (!instance_active() || !IsHyperlink()) | 2771 if (!instance_active() || !IsHyperlink()) |
| 2510 return E_FAIL; | 2772 return E_FAIL; |
| 2511 | 2773 |
| 2512 if (!index) | 2774 if (!index) |
| 2513 return E_INVALIDARG; | 2775 return E_INVALIDARG; |
| 2514 | 2776 |
| 2515 int32_t hypertext_offset = 0; | 2777 int32_t hypertext_offset = 0; |
| 2516 auto* parent = GetParent(); | 2778 auto* parent = GetParent(); |
| 2517 if (parent) { | 2779 if (parent) { |
| 2518 hypertext_offset = | 2780 hypertext_offset = |
| 2519 ToBrowserAccessibilityWin(parent)->GetHypertextOffsetFromChild(*this); | 2781 ToBrowserAccessibilityWin(parent)->GetHypertextOffsetFromChild(*this); |
| 2520 } | 2782 } |
| 2521 *index = static_cast<LONG>(hypertext_offset); | 2783 *index = static_cast<LONG>(hypertext_offset); |
| 2522 return S_OK; | 2784 return S_OK; |
| 2523 } | 2785 } |
| 2524 | 2786 |
| 2525 STDMETHODIMP BrowserAccessibilityWin::get_endIndex(long* index) { | 2787 STDMETHODIMP BrowserAccessibilityWin::get_endIndex(long* index) { |
| 2788 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_END_INDEX); | |
| 2526 LONG start_index; | 2789 LONG start_index; |
| 2527 HRESULT hr = get_startIndex(&start_index); | 2790 HRESULT hr = get_startIndex(&start_index); |
| 2528 if (hr == S_OK) | 2791 if (hr == S_OK) |
| 2529 *index = start_index + 1; | 2792 *index = start_index + 1; |
| 2530 return hr; | 2793 return hr; |
| 2531 } | 2794 } |
| 2532 | 2795 |
| 2533 // This method is deprecated in the IA2 Spec. | 2796 // This method is deprecated in the IA2 Spec. |
| 2534 STDMETHODIMP BrowserAccessibilityWin::get_valid(boolean* valid) { | 2797 STDMETHODIMP BrowserAccessibilityWin::get_valid(boolean* valid) { |
| 2798 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_VALID); | |
| 2535 return E_NOTIMPL; | 2799 return E_NOTIMPL; |
| 2536 } | 2800 } |
| 2537 | 2801 |
| 2538 // | 2802 // |
| 2539 // IAccessibleAction partly implemented. | 2803 // IAccessibleAction partly implemented. |
| 2540 // | 2804 // |
| 2541 | 2805 |
| 2542 STDMETHODIMP BrowserAccessibilityWin::nActions(long* n_actions) { | 2806 STDMETHODIMP BrowserAccessibilityWin::nActions(long* n_actions) { |
| 2807 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_N_ACTIONS); | |
| 2543 if (!instance_active()) | 2808 if (!instance_active()) |
| 2544 return E_FAIL; | 2809 return E_FAIL; |
| 2545 | 2810 |
| 2546 if (!n_actions) | 2811 if (!n_actions) |
| 2547 return E_INVALIDARG; | 2812 return E_INVALIDARG; |
| 2548 | 2813 |
| 2549 // |IsHyperlink| is required for |IAccessibleHyperlink::anchor/anchorTarget| | 2814 // |IsHyperlink| is required for |IAccessibleHyperlink::anchor/anchorTarget| |
| 2550 // to work properly because the |IAccessibleHyperlink| interface inherits from | 2815 // to work properly because the |IAccessibleHyperlink| interface inherits from |
| 2551 // |IAccessibleAction|. | 2816 // |IAccessibleAction|. |
| 2552 if (IsHyperlink() || HasStringAttribute(ui::AX_ATTR_ACTION)) { | 2817 if (IsHyperlink() || HasStringAttribute(ui::AX_ATTR_ACTION)) { |
| 2553 *n_actions = 1; | 2818 *n_actions = 1; |
| 2554 } else { | 2819 } else { |
| 2555 *n_actions = 0; | 2820 *n_actions = 0; |
| 2556 } | 2821 } |
| 2557 | 2822 |
| 2558 return S_OK; | 2823 return S_OK; |
| 2559 } | 2824 } |
| 2560 | 2825 |
| 2561 STDMETHODIMP BrowserAccessibilityWin::doAction(long action_index) { | 2826 STDMETHODIMP BrowserAccessibilityWin::doAction(long action_index) { |
| 2827 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_DO_ACTION); | |
| 2562 if (!instance_active()) | 2828 if (!instance_active()) |
| 2563 return E_FAIL; | 2829 return E_FAIL; |
| 2564 | 2830 |
| 2565 if (!HasStringAttribute(ui::AX_ATTR_ACTION) || action_index != 0) | 2831 if (!HasStringAttribute(ui::AX_ATTR_ACTION) || action_index != 0) |
| 2566 return E_INVALIDARG; | 2832 return E_INVALIDARG; |
| 2567 | 2833 |
| 2568 manager()->DoDefaultAction(*this); | 2834 manager()->DoDefaultAction(*this); |
| 2569 return S_OK; | 2835 return S_OK; |
| 2570 } | 2836 } |
| 2571 | 2837 |
| 2572 STDMETHODIMP | 2838 STDMETHODIMP |
| 2573 BrowserAccessibilityWin::get_description(long action_index, BSTR* description) { | 2839 BrowserAccessibilityWin::get_description(long action_index, BSTR* description) { |
| 2574 return E_NOTIMPL; | 2840 return E_NOTIMPL; |
| 2575 } | 2841 } |
| 2576 STDMETHODIMP BrowserAccessibilityWin::get_keyBinding(long action_index, | 2842 STDMETHODIMP BrowserAccessibilityWin::get_keyBinding(long action_index, |
| 2577 long n_max_bindings, | 2843 long n_max_bindings, |
| 2578 BSTR** key_bindings, | 2844 BSTR** key_bindings, |
| 2579 long* n_bindings) { | 2845 long* n_bindings) { |
| 2846 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_KEY_BINDING); | |
| 2580 return E_NOTIMPL; | 2847 return E_NOTIMPL; |
| 2581 } | 2848 } |
| 2582 | 2849 |
| 2583 STDMETHODIMP BrowserAccessibilityWin::get_name(long action_index, BSTR* name) { | 2850 STDMETHODIMP BrowserAccessibilityWin::get_name(long action_index, BSTR* name) { |
| 2851 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_NAME); | |
| 2584 if (!instance_active()) | 2852 if (!instance_active()) |
| 2585 return E_FAIL; | 2853 return E_FAIL; |
| 2586 | 2854 |
| 2587 if (!name) | 2855 if (!name) |
| 2588 return E_INVALIDARG; | 2856 return E_INVALIDARG; |
| 2589 | 2857 |
| 2590 base::string16 action_verb; | 2858 base::string16 action_verb; |
| 2591 if (!GetString16Attribute(ui::AX_ATTR_ACTION, &action_verb) || | 2859 if (!GetString16Attribute(ui::AX_ATTR_ACTION, &action_verb) || |
| 2592 action_index != 0) { | 2860 action_index != 0) { |
| 2593 *name = nullptr; | 2861 *name = nullptr; |
| 2594 return E_INVALIDARG; | 2862 return E_INVALIDARG; |
| 2595 } | 2863 } |
| 2596 | 2864 |
| 2597 *name = SysAllocString(action_verb.c_str()); | 2865 *name = SysAllocString(action_verb.c_str()); |
| 2598 DCHECK(name); | 2866 DCHECK(name); |
| 2599 return S_OK; | 2867 return S_OK; |
| 2600 } | 2868 } |
| 2601 | 2869 |
| 2602 STDMETHODIMP | 2870 STDMETHODIMP |
| 2603 BrowserAccessibilityWin::get_localizedName(long action_index, | 2871 BrowserAccessibilityWin::get_localizedName(long action_index, |
| 2604 BSTR* localized_name) { | 2872 BSTR* localized_name) { |
| 2605 return E_NOTIMPL; | 2873 return E_NOTIMPL; |
|
Mark P
2016/09/15 23:36:56
Not logged?
| |
| 2606 } | 2874 } |
| 2607 | 2875 |
| 2608 // | 2876 // |
| 2609 // IAccessibleValue methods. | 2877 // IAccessibleValue methods. |
| 2610 // | 2878 // |
| 2611 | 2879 |
| 2612 STDMETHODIMP BrowserAccessibilityWin::get_currentValue(VARIANT* value) { | 2880 STDMETHODIMP BrowserAccessibilityWin::get_currentValue(VARIANT* value) { |
| 2881 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_CURRENT_VALUE); | |
| 2613 if (!instance_active()) | 2882 if (!instance_active()) |
| 2614 return E_FAIL; | 2883 return E_FAIL; |
| 2615 | 2884 |
| 2616 if (!value) | 2885 if (!value) |
| 2617 return E_INVALIDARG; | 2886 return E_INVALIDARG; |
| 2618 | 2887 |
| 2619 float float_val; | 2888 float float_val; |
| 2620 if (GetFloatAttribute( | 2889 if (GetFloatAttribute( |
| 2621 ui::AX_ATTR_VALUE_FOR_RANGE, &float_val)) { | 2890 ui::AX_ATTR_VALUE_FOR_RANGE, &float_val)) { |
| 2622 value->vt = VT_R8; | 2891 value->vt = VT_R8; |
| 2623 value->dblVal = float_val; | 2892 value->dblVal = float_val; |
| 2624 return S_OK; | 2893 return S_OK; |
| 2625 } | 2894 } |
| 2626 | 2895 |
| 2627 value->vt = VT_EMPTY; | 2896 value->vt = VT_EMPTY; |
| 2628 return S_FALSE; | 2897 return S_FALSE; |
| 2629 } | 2898 } |
| 2630 | 2899 |
| 2631 STDMETHODIMP BrowserAccessibilityWin::get_minimumValue(VARIANT* value) { | 2900 STDMETHODIMP BrowserAccessibilityWin::get_minimumValue(VARIANT* value) { |
| 2901 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_MINIMUM_VALUE); | |
| 2632 if (!instance_active()) | 2902 if (!instance_active()) |
| 2633 return E_FAIL; | 2903 return E_FAIL; |
| 2634 | 2904 |
| 2635 if (!value) | 2905 if (!value) |
| 2636 return E_INVALIDARG; | 2906 return E_INVALIDARG; |
| 2637 | 2907 |
| 2638 float float_val; | 2908 float float_val; |
| 2639 if (GetFloatAttribute(ui::AX_ATTR_MIN_VALUE_FOR_RANGE, | 2909 if (GetFloatAttribute(ui::AX_ATTR_MIN_VALUE_FOR_RANGE, |
| 2640 &float_val)) { | 2910 &float_val)) { |
| 2641 value->vt = VT_R8; | 2911 value->vt = VT_R8; |
| 2642 value->dblVal = float_val; | 2912 value->dblVal = float_val; |
| 2643 return S_OK; | 2913 return S_OK; |
| 2644 } | 2914 } |
| 2645 | 2915 |
| 2646 value->vt = VT_EMPTY; | 2916 value->vt = VT_EMPTY; |
| 2647 return S_FALSE; | 2917 return S_FALSE; |
| 2648 } | 2918 } |
| 2649 | 2919 |
| 2650 STDMETHODIMP BrowserAccessibilityWin::get_maximumValue(VARIANT* value) { | 2920 STDMETHODIMP BrowserAccessibilityWin::get_maximumValue(VARIANT* value) { |
| 2921 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_MAXIMUM_VALUE); | |
| 2651 if (!instance_active()) | 2922 if (!instance_active()) |
| 2652 return E_FAIL; | 2923 return E_FAIL; |
| 2653 | 2924 |
| 2654 if (!value) | 2925 if (!value) |
| 2655 return E_INVALIDARG; | 2926 return E_INVALIDARG; |
| 2656 | 2927 |
| 2657 float float_val; | 2928 float float_val; |
| 2658 if (GetFloatAttribute(ui::AX_ATTR_MAX_VALUE_FOR_RANGE, | 2929 if (GetFloatAttribute(ui::AX_ATTR_MAX_VALUE_FOR_RANGE, |
| 2659 &float_val)) { | 2930 &float_val)) { |
| 2660 value->vt = VT_R8; | 2931 value->vt = VT_R8; |
| 2661 value->dblVal = float_val; | 2932 value->dblVal = float_val; |
| 2662 return S_OK; | 2933 return S_OK; |
| 2663 } | 2934 } |
| 2664 | 2935 |
| 2665 value->vt = VT_EMPTY; | 2936 value->vt = VT_EMPTY; |
| 2666 return S_FALSE; | 2937 return S_FALSE; |
| 2667 } | 2938 } |
| 2668 | 2939 |
| 2669 STDMETHODIMP BrowserAccessibilityWin::setCurrentValue(VARIANT new_value) { | 2940 STDMETHODIMP BrowserAccessibilityWin::setCurrentValue(VARIANT new_value) { |
| 2941 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_SET_CURRENT_VALUE); | |
| 2670 // TODO(dmazzoni): Implement this. | 2942 // TODO(dmazzoni): Implement this. |
| 2671 return E_NOTIMPL; | 2943 return E_NOTIMPL; |
| 2672 } | 2944 } |
| 2673 | 2945 |
| 2674 // | 2946 // |
| 2675 // ISimpleDOMDocument methods. | 2947 // ISimpleDOMDocument methods. |
| 2676 // | 2948 // |
| 2677 | 2949 |
| 2678 STDMETHODIMP BrowserAccessibilityWin::get_URL(BSTR* url) { | 2950 STDMETHODIMP BrowserAccessibilityWin::get_URL(BSTR* url) { |
| 2951 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_URL); | |
| 2679 if (!instance_active()) | 2952 if (!instance_active()) |
| 2680 return E_FAIL; | 2953 return E_FAIL; |
| 2681 | 2954 |
| 2682 if (!url) | 2955 if (!url) |
| 2683 return E_INVALIDARG; | 2956 return E_INVALIDARG; |
| 2684 | 2957 |
| 2685 if (this != manager()->GetRoot()) | 2958 if (this != manager()->GetRoot()) |
| 2686 return E_FAIL; | 2959 return E_FAIL; |
| 2687 | 2960 |
| 2688 std::string str = manager()->GetTreeData().url; | 2961 std::string str = manager()->GetTreeData().url; |
| 2689 if (str.empty()) | 2962 if (str.empty()) |
| 2690 return S_FALSE; | 2963 return S_FALSE; |
| 2691 | 2964 |
| 2692 *url = SysAllocString(base::UTF8ToUTF16(str).c_str()); | 2965 *url = SysAllocString(base::UTF8ToUTF16(str).c_str()); |
| 2693 DCHECK(*url); | 2966 DCHECK(*url); |
| 2694 | 2967 |
| 2695 return S_OK; | 2968 return S_OK; |
| 2696 } | 2969 } |
| 2697 | 2970 |
| 2698 STDMETHODIMP BrowserAccessibilityWin::get_title(BSTR* title) { | 2971 STDMETHODIMP BrowserAccessibilityWin::get_title(BSTR* title) { |
| 2972 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_TITLE); | |
| 2699 if (!instance_active()) | 2973 if (!instance_active()) |
| 2700 return E_FAIL; | 2974 return E_FAIL; |
| 2701 | 2975 |
| 2702 if (!title) | 2976 if (!title) |
| 2703 return E_INVALIDARG; | 2977 return E_INVALIDARG; |
| 2704 | 2978 |
| 2705 std::string str = manager()->GetTreeData().title; | 2979 std::string str = manager()->GetTreeData().title; |
| 2706 if (str.empty()) | 2980 if (str.empty()) |
| 2707 return S_FALSE; | 2981 return S_FALSE; |
| 2708 | 2982 |
| 2709 *title = SysAllocString(base::UTF8ToUTF16(str).c_str()); | 2983 *title = SysAllocString(base::UTF8ToUTF16(str).c_str()); |
| 2710 DCHECK(*title); | 2984 DCHECK(*title); |
| 2711 | 2985 |
| 2712 return S_OK; | 2986 return S_OK; |
| 2713 } | 2987 } |
| 2714 | 2988 |
| 2715 STDMETHODIMP BrowserAccessibilityWin::get_mimeType(BSTR* mime_type) { | 2989 STDMETHODIMP BrowserAccessibilityWin::get_mimeType(BSTR* mime_type) { |
| 2990 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_MIME_TYPE); | |
| 2716 if (!instance_active()) | 2991 if (!instance_active()) |
| 2717 return E_FAIL; | 2992 return E_FAIL; |
| 2718 | 2993 |
| 2719 if (!mime_type) | 2994 if (!mime_type) |
| 2720 return E_INVALIDARG; | 2995 return E_INVALIDARG; |
| 2721 | 2996 |
| 2722 std::string str = manager()->GetTreeData().mimetype; | 2997 std::string str = manager()->GetTreeData().mimetype; |
| 2723 if (str.empty()) | 2998 if (str.empty()) |
| 2724 return S_FALSE; | 2999 return S_FALSE; |
| 2725 | 3000 |
| 2726 *mime_type = SysAllocString(base::UTF8ToUTF16(str).c_str()); | 3001 *mime_type = SysAllocString(base::UTF8ToUTF16(str).c_str()); |
| 2727 DCHECK(*mime_type); | 3002 DCHECK(*mime_type); |
| 2728 | 3003 |
| 2729 return S_OK; | 3004 return S_OK; |
| 2730 } | 3005 } |
| 2731 | 3006 |
| 2732 STDMETHODIMP BrowserAccessibilityWin::get_docType(BSTR* doc_type) { | 3007 STDMETHODIMP BrowserAccessibilityWin::get_docType(BSTR* doc_type) { |
| 3008 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_DOC_TYPE); | |
| 2733 if (!instance_active()) | 3009 if (!instance_active()) |
| 2734 return E_FAIL; | 3010 return E_FAIL; |
| 2735 | 3011 |
| 2736 if (!doc_type) | 3012 if (!doc_type) |
| 2737 return E_INVALIDARG; | 3013 return E_INVALIDARG; |
| 2738 | 3014 |
| 2739 std::string str = manager()->GetTreeData().doctype; | 3015 std::string str = manager()->GetTreeData().doctype; |
| 2740 if (str.empty()) | 3016 if (str.empty()) |
| 2741 return S_FALSE; | 3017 return S_FALSE; |
| 2742 | 3018 |
| 2743 *doc_type = SysAllocString(base::UTF8ToUTF16(str).c_str()); | 3019 *doc_type = SysAllocString(base::UTF8ToUTF16(str).c_str()); |
| 2744 DCHECK(*doc_type); | 3020 DCHECK(*doc_type); |
| 2745 | 3021 |
| 2746 return S_OK; | 3022 return S_OK; |
| 2747 } | 3023 } |
| 2748 | 3024 |
| 2749 STDMETHODIMP | 3025 STDMETHODIMP |
| 2750 BrowserAccessibilityWin::get_nameSpaceURIForID(short name_space_id, | 3026 BrowserAccessibilityWin::get_nameSpaceURIForID(short name_space_id, |
| 2751 BSTR* name_space_uri) { | 3027 BSTR* name_space_uri) { |
| 2752 return E_NOTIMPL; | 3028 return E_NOTIMPL; |
|
Mark P
2016/09/15 23:36:56
Here and below?
| |
| 2753 } | 3029 } |
| 2754 STDMETHODIMP | 3030 STDMETHODIMP |
| 2755 BrowserAccessibilityWin::put_alternateViewMediaTypes( | 3031 BrowserAccessibilityWin::put_alternateViewMediaTypes( |
| 2756 BSTR* comma_separated_media_types) { | 3032 BSTR* comma_separated_media_types) { |
| 2757 return E_NOTIMPL; | 3033 return E_NOTIMPL; |
| 2758 } | 3034 } |
| 2759 | 3035 |
| 2760 // | 3036 // |
| 2761 // ISimpleDOMNode methods. | 3037 // ISimpleDOMNode methods. |
| 2762 // | 3038 // |
| 2763 | 3039 |
| 2764 STDMETHODIMP BrowserAccessibilityWin::get_nodeInfo( | 3040 STDMETHODIMP BrowserAccessibilityWin::get_nodeInfo( |
| 2765 BSTR* node_name, | 3041 BSTR* node_name, |
| 2766 short* name_space_id, | 3042 short* name_space_id, |
| 2767 BSTR* node_value, | 3043 BSTR* node_value, |
| 2768 unsigned int* num_children, | 3044 unsigned int* num_children, |
| 2769 unsigned int* unique_id, | 3045 unsigned int* unique_id, |
| 2770 unsigned short* node_type) { | 3046 unsigned short* node_type) { |
| 3047 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_NODE_INFO); | |
| 2771 if (!instance_active()) | 3048 if (!instance_active()) |
| 2772 return E_FAIL; | 3049 return E_FAIL; |
| 2773 | 3050 |
| 2774 if (!node_name || !name_space_id || !node_value || !num_children || | 3051 if (!node_name || !name_space_id || !node_value || !num_children || |
| 2775 !unique_id || !node_type) { | 3052 !unique_id || !node_type) { |
| 2776 return E_INVALIDARG; | 3053 return E_INVALIDARG; |
| 2777 } | 3054 } |
| 2778 | 3055 |
| 2779 base::string16 tag; | 3056 base::string16 tag; |
| 2780 if (GetString16Attribute(ui::AX_ATTR_HTML_TAG, &tag)) | 3057 if (GetString16Attribute(ui::AX_ATTR_HTML_TAG, &tag)) |
| (...skipping 17 matching lines...) Expand all Loading... | |
| 2798 | 3075 |
| 2799 return S_OK; | 3076 return S_OK; |
| 2800 } | 3077 } |
| 2801 | 3078 |
| 2802 STDMETHODIMP BrowserAccessibilityWin::get_attributes( | 3079 STDMETHODIMP BrowserAccessibilityWin::get_attributes( |
| 2803 unsigned short max_attribs, | 3080 unsigned short max_attribs, |
| 2804 BSTR* attrib_names, | 3081 BSTR* attrib_names, |
| 2805 short* name_space_id, | 3082 short* name_space_id, |
| 2806 BSTR* attrib_values, | 3083 BSTR* attrib_values, |
| 2807 unsigned short* num_attribs) { | 3084 unsigned short* num_attribs) { |
| 3085 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_ISIMPLEDOMNODE_GET_ATTRIBUTES); | |
| 2808 if (!instance_active()) | 3086 if (!instance_active()) |
| 2809 return E_FAIL; | 3087 return E_FAIL; |
| 2810 | 3088 |
| 2811 if (!attrib_names || !name_space_id || !attrib_values || !num_attribs) | 3089 if (!attrib_names || !name_space_id || !attrib_values || !num_attribs) |
| 2812 return E_INVALIDARG; | 3090 return E_INVALIDARG; |
| 2813 | 3091 |
| 2814 *num_attribs = max_attribs; | 3092 *num_attribs = max_attribs; |
| 2815 if (*num_attribs > GetHtmlAttributes().size()) | 3093 if (*num_attribs > GetHtmlAttributes().size()) |
| 2816 *num_attribs = GetHtmlAttributes().size(); | 3094 *num_attribs = GetHtmlAttributes().size(); |
| 2817 | 3095 |
| 2818 for (unsigned short i = 0; i < *num_attribs; ++i) { | 3096 for (unsigned short i = 0; i < *num_attribs; ++i) { |
| 2819 attrib_names[i] = SysAllocString( | 3097 attrib_names[i] = SysAllocString( |
| 2820 base::UTF8ToUTF16(GetHtmlAttributes()[i].first).c_str()); | 3098 base::UTF8ToUTF16(GetHtmlAttributes()[i].first).c_str()); |
| 2821 name_space_id[i] = 0; | 3099 name_space_id[i] = 0; |
| 2822 attrib_values[i] = SysAllocString( | 3100 attrib_values[i] = SysAllocString( |
| 2823 base::UTF8ToUTF16(GetHtmlAttributes()[i].second).c_str()); | 3101 base::UTF8ToUTF16(GetHtmlAttributes()[i].second).c_str()); |
| 2824 } | 3102 } |
| 2825 return S_OK; | 3103 return S_OK; |
| 2826 } | 3104 } |
| 2827 | 3105 |
| 2828 STDMETHODIMP BrowserAccessibilityWin::get_attributesForNames( | 3106 STDMETHODIMP BrowserAccessibilityWin::get_attributesForNames( |
| 2829 unsigned short num_attribs, | 3107 unsigned short num_attribs, |
| 2830 BSTR* attrib_names, | 3108 BSTR* attrib_names, |
| 2831 short* name_space_id, | 3109 short* name_space_id, |
| 2832 BSTR* attrib_values) { | 3110 BSTR* attrib_values) { |
| 3111 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_ATTRIBUTES_FOR_NAMES); | |
| 2833 if (!instance_active()) | 3112 if (!instance_active()) |
| 2834 return E_FAIL; | 3113 return E_FAIL; |
| 2835 | 3114 |
| 2836 if (!attrib_names || !name_space_id || !attrib_values) | 3115 if (!attrib_names || !name_space_id || !attrib_values) |
| 2837 return E_INVALIDARG; | 3116 return E_INVALIDARG; |
| 2838 | 3117 |
| 2839 for (unsigned short i = 0; i < num_attribs; ++i) { | 3118 for (unsigned short i = 0; i < num_attribs; ++i) { |
| 2840 name_space_id[i] = 0; | 3119 name_space_id[i] = 0; |
| 2841 bool found = false; | 3120 bool found = false; |
| 2842 std::string name = base::UTF16ToUTF8((LPCWSTR)attrib_names[i]); | 3121 std::string name = base::UTF16ToUTF8((LPCWSTR)attrib_names[i]); |
| (...skipping 11 matching lines...) Expand all Loading... | |
| 2854 } | 3133 } |
| 2855 return S_OK; | 3134 return S_OK; |
| 2856 } | 3135 } |
| 2857 | 3136 |
| 2858 STDMETHODIMP BrowserAccessibilityWin::get_computedStyle( | 3137 STDMETHODIMP BrowserAccessibilityWin::get_computedStyle( |
| 2859 unsigned short max_style_properties, | 3138 unsigned short max_style_properties, |
| 2860 boolean use_alternate_view, | 3139 boolean use_alternate_view, |
| 2861 BSTR* style_properties, | 3140 BSTR* style_properties, |
| 2862 BSTR* style_values, | 3141 BSTR* style_values, |
| 2863 unsigned short *num_style_properties) { | 3142 unsigned short *num_style_properties) { |
| 3143 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_COMPUTED_STYLE); | |
| 2864 if (!instance_active()) | 3144 if (!instance_active()) |
| 2865 return E_FAIL; | 3145 return E_FAIL; |
| 2866 | 3146 |
| 2867 if (!style_properties || !style_values) | 3147 if (!style_properties || !style_values) |
| 2868 return E_INVALIDARG; | 3148 return E_INVALIDARG; |
| 2869 | 3149 |
| 2870 // We only cache a single style property for now: DISPLAY | 3150 // We only cache a single style property for now: DISPLAY |
| 2871 | 3151 |
| 2872 base::string16 display; | 3152 base::string16 display; |
| 2873 if (max_style_properties == 0 || | 3153 if (max_style_properties == 0 || |
| 2874 !GetString16Attribute(ui::AX_ATTR_DISPLAY, &display)) { | 3154 !GetString16Attribute(ui::AX_ATTR_DISPLAY, &display)) { |
| 2875 *num_style_properties = 0; | 3155 *num_style_properties = 0; |
| 2876 return S_OK; | 3156 return S_OK; |
| 2877 } | 3157 } |
| 2878 | 3158 |
| 2879 *num_style_properties = 1; | 3159 *num_style_properties = 1; |
| 2880 style_properties[0] = SysAllocString(L"display"); | 3160 style_properties[0] = SysAllocString(L"display"); |
| 2881 style_values[0] = SysAllocString(display.c_str()); | 3161 style_values[0] = SysAllocString(display.c_str()); |
| 2882 | 3162 |
| 2883 return S_OK; | 3163 return S_OK; |
| 2884 } | 3164 } |
| 2885 | 3165 |
| 2886 STDMETHODIMP BrowserAccessibilityWin::get_computedStyleForProperties( | 3166 STDMETHODIMP BrowserAccessibilityWin::get_computedStyleForProperties( |
| 2887 unsigned short num_style_properties, | 3167 unsigned short num_style_properties, |
| 2888 boolean use_alternate_view, | 3168 boolean use_alternate_view, |
| 2889 BSTR* style_properties, | 3169 BSTR* style_properties, |
| 2890 BSTR* style_values) { | 3170 BSTR* style_values) { |
| 3171 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_COMPUTED_STYLE_FOR_PROPERTIES); | |
| 2891 if (!instance_active()) | 3172 if (!instance_active()) |
| 2892 return E_FAIL; | 3173 return E_FAIL; |
| 2893 | 3174 |
| 2894 if (!style_properties || !style_values) | 3175 if (!style_properties || !style_values) |
| 2895 return E_INVALIDARG; | 3176 return E_INVALIDARG; |
| 2896 | 3177 |
| 2897 // We only cache a single style property for now: DISPLAY | 3178 // We only cache a single style property for now: DISPLAY |
| 2898 | 3179 |
| 2899 for (unsigned short i = 0; i < num_style_properties; ++i) { | 3180 for (unsigned short i = 0; i < num_style_properties; ++i) { |
| 2900 base::string16 name = base::ToLowerASCII( | 3181 base::string16 name = base::ToLowerASCII( |
| 2901 reinterpret_cast<const base::char16*>(style_properties[i])); | 3182 reinterpret_cast<const base::char16*>(style_properties[i])); |
| 2902 if (name == L"display") { | 3183 if (name == L"display") { |
| 2903 base::string16 display = GetString16Attribute( | 3184 base::string16 display = GetString16Attribute( |
| 2904 ui::AX_ATTR_DISPLAY); | 3185 ui::AX_ATTR_DISPLAY); |
| 2905 style_values[i] = SysAllocString(display.c_str()); | 3186 style_values[i] = SysAllocString(display.c_str()); |
| 2906 } else { | 3187 } else { |
| 2907 style_values[i] = NULL; | 3188 style_values[i] = NULL; |
| 2908 } | 3189 } |
| 2909 } | 3190 } |
| 2910 | 3191 |
| 2911 return S_OK; | 3192 return S_OK; |
| 2912 } | 3193 } |
| 2913 | 3194 |
| 2914 STDMETHODIMP BrowserAccessibilityWin::scrollTo(boolean placeTopLeft) { | 3195 STDMETHODIMP BrowserAccessibilityWin::scrollTo(boolean placeTopLeft) { |
| 3196 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_ISIMPLEDOMNODE_SCROLL_TO); | |
| 2915 return scrollTo(placeTopLeft ? | 3197 return scrollTo(placeTopLeft ? |
| 2916 IA2_SCROLL_TYPE_TOP_LEFT : IA2_SCROLL_TYPE_ANYWHERE); | 3198 IA2_SCROLL_TYPE_TOP_LEFT : IA2_SCROLL_TYPE_ANYWHERE); |
| 2917 } | 3199 } |
| 2918 | 3200 |
| 2919 STDMETHODIMP BrowserAccessibilityWin::get_parentNode(ISimpleDOMNode** node) { | 3201 STDMETHODIMP BrowserAccessibilityWin::get_parentNode(ISimpleDOMNode** node) { |
| 3202 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_PARENT_NODE); | |
| 2920 if (!instance_active()) | 3203 if (!instance_active()) |
| 2921 return E_FAIL; | 3204 return E_FAIL; |
| 2922 | 3205 |
| 2923 if (!node) | 3206 if (!node) |
| 2924 return E_INVALIDARG; | 3207 return E_INVALIDARG; |
| 2925 | 3208 |
| 2926 *node = ToBrowserAccessibilityWin(GetParent())->NewReference(); | 3209 *node = ToBrowserAccessibilityWin(GetParent())->NewReference(); |
| 2927 return S_OK; | 3210 return S_OK; |
| 2928 } | 3211 } |
| 2929 | 3212 |
| 2930 STDMETHODIMP BrowserAccessibilityWin::get_firstChild(ISimpleDOMNode** node) { | 3213 STDMETHODIMP BrowserAccessibilityWin::get_firstChild(ISimpleDOMNode** node) { |
| 3214 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_FIRST_CHILD); | |
| 2931 if (!instance_active()) | 3215 if (!instance_active()) |
| 2932 return E_FAIL; | 3216 return E_FAIL; |
| 2933 | 3217 |
| 2934 if (!node) | 3218 if (!node) |
| 2935 return E_INVALIDARG; | 3219 return E_INVALIDARG; |
| 2936 | 3220 |
| 2937 if (PlatformChildCount() == 0) { | 3221 if (PlatformChildCount() == 0) { |
| 2938 *node = NULL; | 3222 *node = NULL; |
| 2939 return S_FALSE; | 3223 return S_FALSE; |
| 2940 } | 3224 } |
| 2941 | 3225 |
| 2942 *node = ToBrowserAccessibilityWin(PlatformGetChild(0))->NewReference(); | 3226 *node = ToBrowserAccessibilityWin(PlatformGetChild(0))->NewReference(); |
| 2943 return S_OK; | 3227 return S_OK; |
| 2944 } | 3228 } |
| 2945 | 3229 |
| 2946 STDMETHODIMP BrowserAccessibilityWin::get_lastChild(ISimpleDOMNode** node) { | 3230 STDMETHODIMP BrowserAccessibilityWin::get_lastChild(ISimpleDOMNode** node) { |
| 3231 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_LAST_CHILD); | |
| 2947 if (!instance_active()) | 3232 if (!instance_active()) |
| 2948 return E_FAIL; | 3233 return E_FAIL; |
| 2949 | 3234 |
| 2950 if (!node) | 3235 if (!node) |
| 2951 return E_INVALIDARG; | 3236 return E_INVALIDARG; |
| 2952 | 3237 |
| 2953 if (PlatformChildCount() == 0) { | 3238 if (PlatformChildCount() == 0) { |
| 2954 *node = NULL; | 3239 *node = NULL; |
| 2955 return S_FALSE; | 3240 return S_FALSE; |
| 2956 } | 3241 } |
| 2957 | 3242 |
| 2958 *node = ToBrowserAccessibilityWin( | 3243 *node = ToBrowserAccessibilityWin( |
| 2959 PlatformGetChild(PlatformChildCount() - 1))->NewReference(); | 3244 PlatformGetChild(PlatformChildCount() - 1))->NewReference(); |
| 2960 return S_OK; | 3245 return S_OK; |
| 2961 } | 3246 } |
| 2962 | 3247 |
| 2963 STDMETHODIMP BrowserAccessibilityWin::get_previousSibling( | 3248 STDMETHODIMP BrowserAccessibilityWin::get_previousSibling( |
| 2964 ISimpleDOMNode** node) { | 3249 ISimpleDOMNode** node) { |
| 3250 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_PREVIOUS_SIBLING); | |
| 2965 if (!instance_active()) | 3251 if (!instance_active()) |
| 2966 return E_FAIL; | 3252 return E_FAIL; |
| 2967 | 3253 |
| 2968 if (!node) | 3254 if (!node) |
| 2969 return E_INVALIDARG; | 3255 return E_INVALIDARG; |
| 2970 | 3256 |
| 2971 if (!GetParent() || GetIndexInParent() <= 0) { | 3257 if (!GetParent() || GetIndexInParent() <= 0) { |
| 2972 *node = NULL; | 3258 *node = NULL; |
| 2973 return S_FALSE; | 3259 return S_FALSE; |
| 2974 } | 3260 } |
| 2975 | 3261 |
| 2976 *node = ToBrowserAccessibilityWin( | 3262 *node = ToBrowserAccessibilityWin( |
| 2977 GetParent()->InternalGetChild(GetIndexInParent() - 1))->NewReference(); | 3263 GetParent()->InternalGetChild(GetIndexInParent() - 1))->NewReference(); |
| 2978 return S_OK; | 3264 return S_OK; |
| 2979 } | 3265 } |
| 2980 | 3266 |
| 2981 STDMETHODIMP BrowserAccessibilityWin::get_nextSibling(ISimpleDOMNode** node) { | 3267 STDMETHODIMP BrowserAccessibilityWin::get_nextSibling(ISimpleDOMNode** node) { |
| 3268 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_NEXT_SIBLING); | |
| 2982 if (!instance_active()) | 3269 if (!instance_active()) |
| 2983 return E_FAIL; | 3270 return E_FAIL; |
| 2984 | 3271 |
| 2985 if (!node) | 3272 if (!node) |
| 2986 return E_INVALIDARG; | 3273 return E_INVALIDARG; |
| 2987 | 3274 |
| 2988 if (!GetParent() || | 3275 if (!GetParent() || |
| 2989 GetIndexInParent() < 0 || | 3276 GetIndexInParent() < 0 || |
| 2990 GetIndexInParent() >= static_cast<int>( | 3277 GetIndexInParent() >= static_cast<int>( |
| 2991 GetParent()->InternalChildCount()) - 1) { | 3278 GetParent()->InternalChildCount()) - 1) { |
| 2992 *node = NULL; | 3279 *node = NULL; |
| 2993 return S_FALSE; | 3280 return S_FALSE; |
| 2994 } | 3281 } |
| 2995 | 3282 |
| 2996 *node = ToBrowserAccessibilityWin( | 3283 *node = ToBrowserAccessibilityWin( |
| 2997 GetParent()->InternalGetChild(GetIndexInParent() + 1))->NewReference(); | 3284 GetParent()->InternalGetChild(GetIndexInParent() + 1))->NewReference(); |
| 2998 return S_OK; | 3285 return S_OK; |
| 2999 } | 3286 } |
| 3000 | 3287 |
| 3001 STDMETHODIMP BrowserAccessibilityWin::get_childAt( | 3288 STDMETHODIMP BrowserAccessibilityWin::get_childAt( |
| 3002 unsigned int child_index, | 3289 unsigned int child_index, |
| 3003 ISimpleDOMNode** node) { | 3290 ISimpleDOMNode** node) { |
| 3291 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_CHILD_AT); | |
| 3004 if (!instance_active()) | 3292 if (!instance_active()) |
| 3005 return E_FAIL; | 3293 return E_FAIL; |
| 3006 | 3294 |
| 3007 if (!node) | 3295 if (!node) |
| 3008 return E_INVALIDARG; | 3296 return E_INVALIDARG; |
| 3009 | 3297 |
| 3010 if (child_index >= PlatformChildCount()) | 3298 if (child_index >= PlatformChildCount()) |
| 3011 return E_INVALIDARG; | 3299 return E_INVALIDARG; |
| 3012 | 3300 |
| 3013 BrowserAccessibility* child = PlatformGetChild(child_index); | 3301 BrowserAccessibility* child = PlatformGetChild(child_index); |
| 3014 if (!child) { | 3302 if (!child) { |
| 3015 *node = NULL; | 3303 *node = NULL; |
| 3016 return S_FALSE; | 3304 return S_FALSE; |
| 3017 } | 3305 } |
| 3018 | 3306 |
| 3019 *node = ToBrowserAccessibilityWin(child)->NewReference(); | 3307 *node = ToBrowserAccessibilityWin(child)->NewReference(); |
| 3020 return S_OK; | 3308 return S_OK; |
| 3021 } | 3309 } |
| 3022 | 3310 |
| 3023 STDMETHODIMP BrowserAccessibilityWin::get_innerHTML(BSTR* innerHTML) { | 3311 STDMETHODIMP BrowserAccessibilityWin::get_innerHTML(BSTR* innerHTML) { |
| 3312 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_INNER_HTML); | |
| 3024 return E_NOTIMPL; | 3313 return E_NOTIMPL; |
| 3025 } | 3314 } |
| 3026 | 3315 |
| 3027 STDMETHODIMP | 3316 STDMETHODIMP |
| 3028 BrowserAccessibilityWin::get_localInterface(void** local_interface) { | 3317 BrowserAccessibilityWin::get_localInterface(void** local_interface) { |
| 3029 return E_NOTIMPL; | 3318 return E_NOTIMPL; |
| 3030 } | 3319 } |
| 3031 | 3320 |
| 3032 STDMETHODIMP BrowserAccessibilityWin::get_language(BSTR* language) { | 3321 STDMETHODIMP BrowserAccessibilityWin::get_language(BSTR* language) { |
| 3322 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_LANGUAGE); | |
| 3033 if (!language) | 3323 if (!language) |
| 3034 return E_INVALIDARG; | 3324 return E_INVALIDARG; |
| 3035 *language = nullptr; | 3325 *language = nullptr; |
| 3036 | 3326 |
| 3037 if (!instance_active()) | 3327 if (!instance_active()) |
| 3038 return E_FAIL; | 3328 return E_FAIL; |
| 3039 | 3329 |
| 3040 base::string16 lang = GetInheritedString16Attribute(ui::AX_ATTR_LANGUAGE); | 3330 base::string16 lang = GetInheritedString16Attribute(ui::AX_ATTR_LANGUAGE); |
| 3041 if (lang.empty()) | 3331 if (lang.empty()) |
| 3042 lang = L"en-US"; | 3332 lang = L"en-US"; |
| 3043 | 3333 |
| 3044 *language = SysAllocString(lang.c_str()); | 3334 *language = SysAllocString(lang.c_str()); |
| 3045 DCHECK(*language); | 3335 DCHECK(*language); |
| 3046 return S_OK; | 3336 return S_OK; |
| 3047 } | 3337 } |
| 3048 | 3338 |
| 3049 // | 3339 // |
| 3050 // ISimpleDOMText methods. | 3340 // ISimpleDOMText methods. |
| 3051 // | 3341 // |
| 3052 | 3342 |
| 3053 STDMETHODIMP BrowserAccessibilityWin::get_domText(BSTR* dom_text) { | 3343 STDMETHODIMP BrowserAccessibilityWin::get_domText(BSTR* dom_text) { |
| 3344 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_DOM_TEXT); | |
| 3054 if (!instance_active()) | 3345 if (!instance_active()) |
| 3055 return E_FAIL; | 3346 return E_FAIL; |
| 3056 | 3347 |
| 3057 if (!dom_text) | 3348 if (!dom_text) |
| 3058 return E_INVALIDARG; | 3349 return E_INVALIDARG; |
| 3059 | 3350 |
| 3060 return GetStringAttributeAsBstr( | 3351 return GetStringAttributeAsBstr( |
| 3061 ui::AX_ATTR_NAME, dom_text); | 3352 ui::AX_ATTR_NAME, dom_text); |
| 3062 } | 3353 } |
| 3063 | 3354 |
| 3064 STDMETHODIMP BrowserAccessibilityWin::get_clippedSubstringBounds( | 3355 STDMETHODIMP BrowserAccessibilityWin::get_clippedSubstringBounds( |
| 3065 unsigned int start_index, | 3356 unsigned int start_index, |
| 3066 unsigned int end_index, | 3357 unsigned int end_index, |
| 3067 int* out_x, | 3358 int* out_x, |
| 3068 int* out_y, | 3359 int* out_y, |
| 3069 int* out_width, | 3360 int* out_width, |
| 3070 int* out_height) { | 3361 int* out_height) { |
| 3362 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_CLIPPED_SUBSTRING_BOUNDS); | |
| 3071 // TODO(dmazzoni): fully support this API by intersecting the | 3363 // TODO(dmazzoni): fully support this API by intersecting the |
| 3072 // rect with the container's rect. | 3364 // rect with the container's rect. |
| 3073 return get_unclippedSubstringBounds( | 3365 return get_unclippedSubstringBounds( |
| 3074 start_index, end_index, out_x, out_y, out_width, out_height); | 3366 start_index, end_index, out_x, out_y, out_width, out_height); |
| 3075 } | 3367 } |
| 3076 | 3368 |
| 3077 STDMETHODIMP BrowserAccessibilityWin::get_unclippedSubstringBounds( | 3369 STDMETHODIMP BrowserAccessibilityWin::get_unclippedSubstringBounds( |
| 3078 unsigned int start_index, | 3370 unsigned int start_index, |
| 3079 unsigned int end_index, | 3371 unsigned int end_index, |
| 3080 int* out_x, | 3372 int* out_x, |
| 3081 int* out_y, | 3373 int* out_y, |
| 3082 int* out_width, | 3374 int* out_width, |
| 3083 int* out_height) { | 3375 int* out_height) { |
| 3376 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_UNCLIPPED_SUBSTRING_BOUNDS); | |
| 3084 if (!instance_active()) | 3377 if (!instance_active()) |
| 3085 return E_FAIL; | 3378 return E_FAIL; |
| 3086 | 3379 |
| 3087 if (!out_x || !out_y || !out_width || !out_height) | 3380 if (!out_x || !out_y || !out_width || !out_height) |
| 3088 return E_INVALIDARG; | 3381 return E_INVALIDARG; |
| 3089 | 3382 |
| 3090 unsigned int text_length = static_cast<unsigned int>(GetText().size()); | 3383 unsigned int text_length = static_cast<unsigned int>(GetText().size()); |
| 3091 if (start_index > text_length || end_index > text_length || | 3384 if (start_index > text_length || end_index > text_length || |
| 3092 start_index > end_index) { | 3385 start_index > end_index) { |
| 3093 return E_INVALIDARG; | 3386 return E_INVALIDARG; |
| 3094 } | 3387 } |
| 3095 | 3388 |
| 3096 gfx::Rect bounds = GetScreenBoundsForRange( | 3389 gfx::Rect bounds = GetScreenBoundsForRange( |
| 3097 start_index, end_index - start_index); | 3390 start_index, end_index - start_index); |
| 3098 *out_x = bounds.x(); | 3391 *out_x = bounds.x(); |
| 3099 *out_y = bounds.y(); | 3392 *out_y = bounds.y(); |
| 3100 *out_width = bounds.width(); | 3393 *out_width = bounds.width(); |
| 3101 *out_height = bounds.height(); | 3394 *out_height = bounds.height(); |
| 3102 return S_OK; | 3395 return S_OK; |
| 3103 } | 3396 } |
| 3104 | 3397 |
| 3105 STDMETHODIMP BrowserAccessibilityWin::scrollToSubstring( | 3398 STDMETHODIMP BrowserAccessibilityWin::scrollToSubstring( |
| 3106 unsigned int start_index, | 3399 unsigned int start_index, |
| 3107 unsigned int end_index) { | 3400 unsigned int end_index) { |
| 3401 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_SCROLL_TO_SUBSTRING); | |
| 3108 if (!instance_active()) | 3402 if (!instance_active()) |
| 3109 return E_FAIL; | 3403 return E_FAIL; |
| 3110 | 3404 |
| 3111 unsigned int text_length = static_cast<unsigned int>(GetText().size()); | 3405 unsigned int text_length = static_cast<unsigned int>(GetText().size()); |
| 3112 if (start_index > text_length || end_index > text_length || | 3406 if (start_index > text_length || end_index > text_length || |
| 3113 start_index > end_index) { | 3407 start_index > end_index) { |
| 3114 return E_INVALIDARG; | 3408 return E_INVALIDARG; |
| 3115 } | 3409 } |
| 3116 | 3410 |
| 3117 manager()->ScrollToMakeVisible(*this, GetPageBoundsForRange( | 3411 manager()->ScrollToMakeVisible(*this, GetPageBoundsForRange( |
| 3118 start_index, end_index - start_index)); | 3412 start_index, end_index - start_index)); |
| 3119 manager()->ToBrowserAccessibilityManagerWin()->TrackScrollingObject(this); | 3413 manager()->ToBrowserAccessibilityManagerWin()->TrackScrollingObject(this); |
| 3120 | 3414 |
| 3121 return S_OK; | 3415 return S_OK; |
| 3122 } | 3416 } |
| 3123 | 3417 |
| 3124 STDMETHODIMP BrowserAccessibilityWin::get_fontFamily(BSTR* font_family) { | 3418 STDMETHODIMP BrowserAccessibilityWin::get_fontFamily(BSTR* font_family) { |
| 3419 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_FONT_FAMILY); | |
| 3125 if (!font_family) | 3420 if (!font_family) |
| 3126 return E_INVALIDARG; | 3421 return E_INVALIDARG; |
| 3127 *font_family = nullptr; | 3422 *font_family = nullptr; |
| 3128 | 3423 |
| 3129 if (!instance_active()) | 3424 if (!instance_active()) |
| 3130 return E_FAIL; | 3425 return E_FAIL; |
| 3131 | 3426 |
| 3132 base::string16 family = | 3427 base::string16 family = |
| 3133 GetInheritedString16Attribute(ui::AX_ATTR_FONT_FAMILY); | 3428 GetInheritedString16Attribute(ui::AX_ATTR_FONT_FAMILY); |
| 3134 if (family.empty()) | 3429 if (family.empty()) |
| 3135 return S_FALSE; | 3430 return S_FALSE; |
| 3136 | 3431 |
| 3137 *font_family = SysAllocString(family.c_str()); | 3432 *font_family = SysAllocString(family.c_str()); |
| 3138 DCHECK(*font_family); | 3433 DCHECK(*font_family); |
| 3139 return S_OK; | 3434 return S_OK; |
| 3140 } | 3435 } |
| 3141 | 3436 |
| 3142 // | 3437 // |
| 3143 // IServiceProvider methods. | 3438 // IServiceProvider methods. |
| 3144 // | 3439 // |
| 3145 | 3440 |
| 3146 STDMETHODIMP BrowserAccessibilityWin::QueryService(REFGUID guid_service, | 3441 STDMETHODIMP BrowserAccessibilityWin::QueryService(REFGUID guid_service, |
| 3147 REFIID riid, | 3442 REFIID riid, |
| 3148 void** object) { | 3443 void** object) { |
| 3444 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_QUERY_SERVICE); | |
| 3149 if (!instance_active()) | 3445 if (!instance_active()) |
| 3150 return E_FAIL; | 3446 return E_FAIL; |
| 3151 | 3447 |
| 3152 // The system uses IAccessible APIs for many purposes, but only | 3448 // The system uses IAccessible APIs for many purposes, but only |
| 3153 // assistive technology like screen readers uses IAccessible2. | 3449 // assistive technology like screen readers uses IAccessible2. |
| 3154 // Enable full accessibility support when IAccessible2 APIs are queried. | 3450 // Enable full accessibility support when IAccessible2 APIs are queried. |
| 3155 if (riid == IID_IAccessible2) | 3451 if (riid == IID_IAccessible2) |
| 3156 BrowserAccessibilityStateImpl::GetInstance()->EnableAccessibility(); | 3452 BrowserAccessibilityStateImpl::GetInstance()->EnableAccessibility(); |
| 3157 | 3453 |
| 3158 if (guid_service == GUID_IAccessibleContentDocument) { | 3454 if (guid_service == GUID_IAccessibleContentDocument) { |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3192 if (riid == IID_IAccessibleEx && | 3488 if (riid == IID_IAccessibleEx && |
| 3193 base::win::GetVersion() >= base::win::VERSION_WIN8) { | 3489 base::win::GetVersion() >= base::win::VERSION_WIN8) { |
| 3194 return QueryInterface(riid, object); | 3490 return QueryInterface(riid, object); |
| 3195 } | 3491 } |
| 3196 | 3492 |
| 3197 *object = NULL; | 3493 *object = NULL; |
| 3198 return E_FAIL; | 3494 return E_FAIL; |
| 3199 } | 3495 } |
| 3200 | 3496 |
| 3201 STDMETHODIMP | 3497 STDMETHODIMP |
| 3202 BrowserAccessibilityWin::GetObjectForChild(long child_id, IAccessibleEx** ret) { | 3498 BrowserAccessibilityWin::GetObjectForChild(long child_id, IAccessibleEx** ret) { |
|
Mark P
2016/09/15 23:36:56
ditto
| |
| 3203 return E_NOTIMPL; | 3499 return E_NOTIMPL; |
| 3204 } | 3500 } |
| 3205 | 3501 |
| 3206 STDMETHODIMP | 3502 STDMETHODIMP |
| 3207 BrowserAccessibilityWin::GetIAccessiblePair(IAccessible** acc, long* child_id) { | 3503 BrowserAccessibilityWin::GetIAccessiblePair(IAccessible** acc, long* child_id) { |
| 3208 return E_NOTIMPL; | 3504 return E_NOTIMPL; |
| 3209 } | 3505 } |
| 3210 | 3506 |
| 3211 STDMETHODIMP BrowserAccessibilityWin::GetRuntimeId(SAFEARRAY** runtime_id) { | 3507 STDMETHODIMP BrowserAccessibilityWin::GetRuntimeId(SAFEARRAY** runtime_id) { |
| 3508 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_RUNTIME_ID); | |
| 3212 return E_NOTIMPL; | 3509 return E_NOTIMPL; |
| 3213 } | 3510 } |
| 3214 | 3511 |
| 3215 STDMETHODIMP | 3512 STDMETHODIMP |
| 3216 BrowserAccessibilityWin::ConvertReturnedElement( | 3513 BrowserAccessibilityWin::ConvertReturnedElement( |
| 3217 IRawElementProviderSimple* element, | 3514 IRawElementProviderSimple* element, |
| 3218 IAccessibleEx** acc) { | 3515 IAccessibleEx** acc) { |
| 3219 return E_NOTIMPL; | 3516 return E_NOTIMPL; |
|
Mark P
2016/09/15 23:36:56
ditto
| |
| 3220 } | 3517 } |
| 3221 | 3518 |
| 3222 STDMETHODIMP BrowserAccessibilityWin::GetPatternProvider(PATTERNID id, | 3519 STDMETHODIMP BrowserAccessibilityWin::GetPatternProvider(PATTERNID id, |
| 3223 IUnknown** provider) { | 3520 IUnknown** provider) { |
| 3521 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_PATTERN_PROVIDER); | |
| 3224 DVLOG(1) << "In Function: " << __func__ << " for pattern id: " << id; | 3522 DVLOG(1) << "In Function: " << __func__ << " for pattern id: " << id; |
| 3225 if (id == UIA_ValuePatternId || id == UIA_TextPatternId) { | 3523 if (id == UIA_ValuePatternId || id == UIA_TextPatternId) { |
| 3226 if (HasState(ui::AX_STATE_EDITABLE)) { | 3524 if (HasState(ui::AX_STATE_EDITABLE)) { |
| 3227 DVLOG(1) << "Returning UIA text provider"; | 3525 DVLOG(1) << "Returning UIA text provider"; |
| 3228 base::win::UIATextProvider::CreateTextProvider( | 3526 base::win::UIATextProvider::CreateTextProvider( |
| 3229 GetValueText(), true, provider); | 3527 GetValueText(), true, provider); |
| 3230 return S_OK; | 3528 return S_OK; |
| 3231 } | 3529 } |
| 3232 } | 3530 } |
| 3233 return E_NOTIMPL; | 3531 return E_NOTIMPL; |
| 3234 } | 3532 } |
| 3235 | 3533 |
| 3236 STDMETHODIMP BrowserAccessibilityWin::GetPropertyValue(PROPERTYID id, | 3534 STDMETHODIMP BrowserAccessibilityWin::GetPropertyValue(PROPERTYID id, |
| 3237 VARIANT* ret) { | 3535 VARIANT* ret) { |
| 3536 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_PROPERTY_VALUE); | |
| 3238 DVLOG(1) << "In Function: " << __func__ << " for property id: " << id; | 3537 DVLOG(1) << "In Function: " << __func__ << " for property id: " << id; |
| 3239 V_VT(ret) = VT_EMPTY; | 3538 V_VT(ret) = VT_EMPTY; |
| 3240 if (id == UIA_ControlTypePropertyId) { | 3539 if (id == UIA_ControlTypePropertyId) { |
| 3241 if (HasState(ui::AX_STATE_EDITABLE)) { | 3540 if (HasState(ui::AX_STATE_EDITABLE)) { |
| 3242 V_VT(ret) = VT_I4; | 3541 V_VT(ret) = VT_I4; |
| 3243 ret->lVal = UIA_EditControlTypeId; | 3542 ret->lVal = UIA_EditControlTypeId; |
| 3244 DVLOG(1) << "Returning Edit control type"; | 3543 DVLOG(1) << "Returning Edit control type"; |
| 3245 } else { | 3544 } else { |
| 3246 DVLOG(1) << "Returning empty control type"; | 3545 DVLOG(1) << "Returning empty control type"; |
| 3247 } | 3546 } |
| 3248 } | 3547 } |
| 3249 return S_OK; | 3548 return S_OK; |
| 3250 } | 3549 } |
| 3251 | 3550 |
| 3252 STDMETHODIMP BrowserAccessibilityWin::get_ProviderOptions( | 3551 STDMETHODIMP BrowserAccessibilityWin::get_ProviderOptions( |
| 3253 ProviderOptions* ret) { | 3552 ProviderOptions* ret) { |
| 3553 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_PROVIDER_OPTIONS); | |
| 3254 return E_NOTIMPL; | 3554 return E_NOTIMPL; |
| 3255 } | 3555 } |
| 3256 | 3556 |
| 3257 STDMETHODIMP BrowserAccessibilityWin::get_HostRawElementProvider( | 3557 STDMETHODIMP BrowserAccessibilityWin::get_HostRawElementProvider( |
| 3258 IRawElementProviderSimple** provider) { | 3558 IRawElementProviderSimple** provider) { |
| 3559 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_HOST_RAW_ELEMENT_PROVIDER); | |
| 3259 return E_NOTIMPL; | 3560 return E_NOTIMPL; |
| 3260 } | 3561 } |
| 3261 | 3562 |
| 3262 // | 3563 // |
| 3263 // CComObjectRootEx methods. | 3564 // CComObjectRootEx methods. |
| 3264 // | 3565 // |
|
Mark P
2016/09/15 23:36:56
Nothing at all in this section?
| |
| 3265 | 3566 |
| 3266 // static | 3567 // static |
| 3267 HRESULT WINAPI BrowserAccessibilityWin::InternalQueryInterface( | 3568 HRESULT WINAPI BrowserAccessibilityWin::InternalQueryInterface( |
| 3268 void* this_ptr, | 3569 void* this_ptr, |
| 3269 const _ATL_INTMAP_ENTRY* entries, | 3570 const _ATL_INTMAP_ENTRY* entries, |
| 3270 REFIID iid, | 3571 REFIID iid, |
| 3271 void** object) { | 3572 void** object) { |
| 3272 BrowserAccessibilityWin* accessibility = | 3573 BrowserAccessibilityWin* accessibility = |
| 3273 reinterpret_cast<BrowserAccessibilityWin*>(this_ptr); | 3574 reinterpret_cast<BrowserAccessibilityWin*>(this_ptr); |
| 3274 int32_t ia_role = accessibility->ia_role(); | 3575 int32_t ia_role = accessibility->ia_role(); |
| (...skipping 665 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3940 BrowserAccessibility::GetFromUniqueID(-child_id)); | 4241 BrowserAccessibility::GetFromUniqueID(-child_id)); |
| 3941 if (child && child->IsDescendantOf(this)) | 4242 if (child && child->IsDescendantOf(this)) |
| 3942 return child; | 4243 return child; |
| 3943 | 4244 |
| 3944 return nullptr; | 4245 return nullptr; |
| 3945 } | 4246 } |
| 3946 | 4247 |
| 3947 HRESULT BrowserAccessibilityWin::GetStringAttributeAsBstr( | 4248 HRESULT BrowserAccessibilityWin::GetStringAttributeAsBstr( |
| 3948 ui::AXStringAttribute attribute, | 4249 ui::AXStringAttribute attribute, |
| 3949 BSTR* value_bstr) { | 4250 BSTR* value_bstr) { |
| 4251 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_STRING_ATTRIBUTE_AS_BSTR); | |
|
Mark P
2016/09/15 23:36:56
I thought this was the private method section. Wh
dmazzoni
2016/09/16 16:27:15
Oops, good catch. This one was a mistake.
| |
| 3950 base::string16 str; | 4252 base::string16 str; |
| 3951 | 4253 |
| 3952 if (!GetString16Attribute(attribute, &str)) | 4254 if (!GetString16Attribute(attribute, &str)) |
| 3953 return S_FALSE; | 4255 return S_FALSE; |
| 3954 | 4256 |
| 3955 if (str.empty()) | 4257 if (str.empty()) |
| 3956 return S_FALSE; | 4258 return S_FALSE; |
| 3957 | 4259 |
| 3958 *value_bstr = SysAllocString(str.c_str()); | 4260 *value_bstr = SysAllocString(str.c_str()); |
| 3959 DCHECK(*value_bstr); | 4261 DCHECK(*value_bstr); |
| (...skipping 1243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 5203 return static_cast<BrowserAccessibilityWin*>(obj); | 5505 return static_cast<BrowserAccessibilityWin*>(obj); |
| 5204 } | 5506 } |
| 5205 | 5507 |
| 5206 const BrowserAccessibilityWin* | 5508 const BrowserAccessibilityWin* |
| 5207 ToBrowserAccessibilityWin(const BrowserAccessibility* obj) { | 5509 ToBrowserAccessibilityWin(const BrowserAccessibility* obj) { |
| 5208 DCHECK(!obj || obj->IsNative()); | 5510 DCHECK(!obj || obj->IsNative()); |
| 5209 return static_cast<const BrowserAccessibilityWin*>(obj); | 5511 return static_cast<const BrowserAccessibilityWin*>(obj); |
| 5210 } | 5512 } |
| 5211 | 5513 |
| 5212 } // namespace content | 5514 } // namespace content |
| OLD | NEW |