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> |
(...skipping 498 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
509 // This happens if we're the root of the tree; | 509 // This happens if we're the root of the tree; |
510 // return the IAccessible for the window. | 510 // return the IAccessible for the window. |
511 parent_obj = | 511 parent_obj = |
512 manager()->ToBrowserAccessibilityManagerWin()->GetParentIAccessible(); | 512 manager()->ToBrowserAccessibilityManagerWin()->GetParentIAccessible(); |
513 // |parent| can only be NULL if the manager was created before the parent | 513 // |parent| can only be NULL if the manager was created before the parent |
514 // IAccessible was known and it wasn't subsequently set before a client | 514 // IAccessible was known and it wasn't subsequently set before a client |
515 // requested it. This has been fixed. |parent| may also be NULL during | 515 // requested it. This has been fixed. |parent| may also be NULL during |
516 // destruction. Possible cases where this could occur include tabs being | 516 // destruction. Possible cases where this could occur include tabs being |
517 // dragged to a new window, etc. | 517 // dragged to a new window, etc. |
518 if (!parent_obj) { | 518 if (!parent_obj) { |
519 DVLOG(1) << "In Function: " | 519 DVLOG(1) << "In Function: " << __func__ |
520 << __FUNCTION__ | |
521 << ". Parent IAccessible interface is NULL. Returning failure"; | 520 << ". Parent IAccessible interface is NULL. Returning failure"; |
522 return E_FAIL; | 521 return E_FAIL; |
523 } | 522 } |
524 } | 523 } |
525 parent_obj->AddRef(); | 524 parent_obj->AddRef(); |
526 *disp_parent = parent_obj; | 525 *disp_parent = parent_obj; |
527 return S_OK; | 526 return S_OK; |
528 } | 527 } |
529 | 528 |
530 STDMETHODIMP BrowserAccessibilityWin::get_accRole(VARIANT var_id, | 529 STDMETHODIMP BrowserAccessibilityWin::get_accRole(VARIANT var_id, |
(...skipping 2686 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3217 | 3216 |
3218 STDMETHODIMP | 3217 STDMETHODIMP |
3219 BrowserAccessibilityWin::ConvertReturnedElement( | 3218 BrowserAccessibilityWin::ConvertReturnedElement( |
3220 IRawElementProviderSimple* element, | 3219 IRawElementProviderSimple* element, |
3221 IAccessibleEx** acc) { | 3220 IAccessibleEx** acc) { |
3222 return E_NOTIMPL; | 3221 return E_NOTIMPL; |
3223 } | 3222 } |
3224 | 3223 |
3225 STDMETHODIMP BrowserAccessibilityWin::GetPatternProvider(PATTERNID id, | 3224 STDMETHODIMP BrowserAccessibilityWin::GetPatternProvider(PATTERNID id, |
3226 IUnknown** provider) { | 3225 IUnknown** provider) { |
3227 DVLOG(1) << "In Function: " | 3226 DVLOG(1) << "In Function: " << __func__ << " for pattern id: " << id; |
3228 << __FUNCTION__ | |
3229 << " for pattern id: " | |
3230 << id; | |
3231 if (id == UIA_ValuePatternId || id == UIA_TextPatternId) { | 3227 if (id == UIA_ValuePatternId || id == UIA_TextPatternId) { |
3232 if (HasState(ui::AX_STATE_EDITABLE)) { | 3228 if (HasState(ui::AX_STATE_EDITABLE)) { |
3233 DVLOG(1) << "Returning UIA text provider"; | 3229 DVLOG(1) << "Returning UIA text provider"; |
3234 base::win::UIATextProvider::CreateTextProvider( | 3230 base::win::UIATextProvider::CreateTextProvider( |
3235 GetValueText(), true, provider); | 3231 GetValueText(), true, provider); |
3236 return S_OK; | 3232 return S_OK; |
3237 } | 3233 } |
3238 } | 3234 } |
3239 return E_NOTIMPL; | 3235 return E_NOTIMPL; |
3240 } | 3236 } |
3241 | 3237 |
3242 STDMETHODIMP BrowserAccessibilityWin::GetPropertyValue(PROPERTYID id, | 3238 STDMETHODIMP BrowserAccessibilityWin::GetPropertyValue(PROPERTYID id, |
3243 VARIANT* ret) { | 3239 VARIANT* ret) { |
3244 DVLOG(1) << "In Function: " | 3240 DVLOG(1) << "In Function: " << __func__ << " for property id: " << id; |
3245 << __FUNCTION__ | |
3246 << " for property id: " | |
3247 << id; | |
3248 V_VT(ret) = VT_EMPTY; | 3241 V_VT(ret) = VT_EMPTY; |
3249 if (id == UIA_ControlTypePropertyId) { | 3242 if (id == UIA_ControlTypePropertyId) { |
3250 if (HasState(ui::AX_STATE_EDITABLE)) { | 3243 if (HasState(ui::AX_STATE_EDITABLE)) { |
3251 V_VT(ret) = VT_I4; | 3244 V_VT(ret) = VT_I4; |
3252 ret->lVal = UIA_EditControlTypeId; | 3245 ret->lVal = UIA_EditControlTypeId; |
3253 DVLOG(1) << "Returning Edit control type"; | 3246 DVLOG(1) << "Returning Edit control type"; |
3254 } else { | 3247 } else { |
3255 DVLOG(1) << "Returning empty control type"; | 3248 DVLOG(1) << "Returning empty control type"; |
3256 } | 3249 } |
3257 } | 3250 } |
(...skipping 1942 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5200 return static_cast<BrowserAccessibilityWin*>(obj); | 5193 return static_cast<BrowserAccessibilityWin*>(obj); |
5201 } | 5194 } |
5202 | 5195 |
5203 const BrowserAccessibilityWin* | 5196 const BrowserAccessibilityWin* |
5204 ToBrowserAccessibilityWin(const BrowserAccessibility* obj) { | 5197 ToBrowserAccessibilityWin(const BrowserAccessibility* obj) { |
5205 DCHECK(!obj || obj->IsNative()); | 5198 DCHECK(!obj || obj->IsNative()); |
5206 return static_cast<const BrowserAccessibilityWin*>(obj); | 5199 return static_cast<const BrowserAccessibilityWin*>(obj); |
5207 } | 5200 } |
5208 | 5201 |
5209 } // namespace content | 5202 } // namespace content |
OLD | NEW |