Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(192)

Side by Side Diff: views/accessibility/view_accessibility.cc

Issue 6310002: Support accDoDefaultAction for NativeButton in ViewAccessibility.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 9 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « views/accessibility/view_accessibility.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 "views/accessibility/view_accessibility.h" 5 #include "views/accessibility/view_accessibility.h"
6 6
7 #include "app/view_prop.h" 7 #include "app/view_prop.h"
8 #include "views/controls/button/native_button.h"
8 #include "views/widget/widget.h" 9 #include "views/widget/widget.h"
9 #include "views/widget/widget_win.h" 10 #include "views/widget/widget_win.h"
10 11
11 const char kViewsNativeHostPropForAccessibility[] = 12 const char kViewsNativeHostPropForAccessibility[] =
12 "Views_NativeViewHostHWNDForAccessibility"; 13 "Views_NativeViewHostHWNDForAccessibility";
13 14
14 // static 15 // static
15 scoped_refptr<ViewAccessibility> ViewAccessibility::Create(views::View* view) { 16 scoped_refptr<ViewAccessibility> ViewAccessibility::Create(views::View* view) {
16 CComObject<ViewAccessibility>* instance = NULL; 17 CComObject<ViewAccessibility>* instance = NULL;
17 HRESULT hr = CComObject<ViewAccessibility>::CreateInstance(&instance); 18 HRESULT hr = CComObject<ViewAccessibility>::CreateInstance(&instance);
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 child->vt = VT_I4; 77 child->vt = VT_I4;
77 child->lVal = CHILDID_SELF; 78 child->lVal = CHILDID_SELF;
78 } else { 79 } else {
79 child->vt = VT_DISPATCH; 80 child->vt = VT_DISPATCH;
80 child->pdispVal = GetAccessibleForView(view); 81 child->pdispVal = GetAccessibleForView(view);
81 child->pdispVal->AddRef(); 82 child->pdispVal->AddRef();
82 } 83 }
83 return S_OK; 84 return S_OK;
84 } 85 }
85 86
87 HRESULT ViewAccessibility::accDoDefaultAction(VARIANT var_id) {
88 if (!IsValidId(var_id))
89 return E_INVALIDARG;
90
91 if (view_->GetClassName() == views::NativeButton::kViewClassName) {
92 views::NativeButton* native_button =
93 static_cast<views::NativeButton*>(view_);
94 native_button->ButtonPressed();
95 return S_OK;
96 }
97
98 // The object does not support the method. This value is returned for
99 // controls that do not perform actions, such as edit fields.
100 return DISP_E_MEMBERNOTFOUND;
101 }
102
86 STDMETHODIMP ViewAccessibility::accLocation( 103 STDMETHODIMP ViewAccessibility::accLocation(
87 LONG* x_left, LONG* y_top, LONG* width, LONG* height, VARIANT var_id) { 104 LONG* x_left, LONG* y_top, LONG* width, LONG* height, VARIANT var_id) {
88 if (!IsValidId(var_id) || !x_left || !y_top || !width || !height) 105 if (!IsValidId(var_id) || !x_left || !y_top || !width || !height)
89 return E_INVALIDARG; 106 return E_INVALIDARG;
90 107
91 if (!view_) 108 if (!view_)
92 return E_FAIL; 109 return E_FAIL;
93 110
94 gfx::Rect view_bounds; 111 gfx::Rect view_bounds;
95 // Retrieving the parent View to be used for converting from view-to-screen 112 // Retrieving the parent View to be used for converting from view-to-screen
(...skipping 432 matching lines...) Expand 10 before | Expand all | Expand 10 after
528 545
529 if (view->HasFocus()) 546 if (view->HasFocus())
530 msaa_state->lVal |= STATE_SYSTEM_FOCUSED; 547 msaa_state->lVal |= STATE_SYSTEM_FOCUSED;
531 548
532 // Add on any view-specific states. 549 // Add on any view-specific states.
533 msaa_state->lVal |= MSAAState(view->GetAccessibleState()); 550 msaa_state->lVal |= MSAAState(view->GetAccessibleState());
534 } 551 }
535 552
536 // IAccessible functions not supported. 553 // IAccessible functions not supported.
537 554
538 HRESULT ViewAccessibility::accDoDefaultAction(VARIANT var_id) {
539 return E_NOTIMPL;
540 }
541
542 STDMETHODIMP ViewAccessibility::get_accSelection(VARIANT* selected) { 555 STDMETHODIMP ViewAccessibility::get_accSelection(VARIANT* selected) {
543 if (selected) 556 if (selected)
544 selected->vt = VT_EMPTY; 557 selected->vt = VT_EMPTY;
545 return E_NOTIMPL; 558 return E_NOTIMPL;
546 } 559 }
547 560
548 STDMETHODIMP ViewAccessibility::accSelect(LONG flagsSelect, VARIANT var_id) { 561 STDMETHODIMP ViewAccessibility::accSelect(LONG flagsSelect, VARIANT var_id) {
549 return E_NOTIMPL; 562 return E_NOTIMPL;
550 } 563 }
551 564
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
726 HWND native_view_window , IAccessible** accessible) { 739 HWND native_view_window , IAccessible** accessible) {
727 if (IsWindow(native_view_window)) { 740 if (IsWindow(native_view_window)) {
728 LRESULT ret = SendMessage(native_view_window, WM_GETOBJECT, 0, 741 LRESULT ret = SendMessage(native_view_window, WM_GETOBJECT, 0,
729 OBJID_CLIENT); 742 OBJID_CLIENT);
730 return ObjectFromLresult(ret, IID_IDispatch, 0, 743 return ObjectFromLresult(ret, IID_IDispatch, 0,
731 reinterpret_cast<void**>(accessible)); 744 reinterpret_cast<void**>(accessible));
732 } 745 }
733 746
734 return E_FAIL; 747 return E_FAIL;
735 } 748 }
OLDNEW
« no previous file with comments | « views/accessibility/view_accessibility.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698