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

Side by Side Diff: ui/views/accessibility/native_view_accessibility_win.cc

Issue 23441024: Implement put_accvalue for textfields and location bar. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Address feedback Created 7 years, 3 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
OLDNEW
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 "ui/views/accessibility/native_view_accessibility_win.h" 5 #include "ui/views/accessibility/native_view_accessibility_win.h"
6 6
7 #include <UIAutomationClient.h> 7 #include <UIAutomationClient.h>
8 #include <oleacc.h> 8 #include <oleacc.h>
9 9
10 #include <set> 10 #include <set>
(...skipping 564 matching lines...) Expand 10 before | Expand all | Expand 10 after
575 // Retrieve all currently applicable states of the parent. 575 // Retrieve all currently applicable states of the parent.
576 SetState(state, view_); 576 SetState(state, view_);
577 577
578 // Make sure that state is not empty, and has the proper type. 578 // Make sure that state is not empty, and has the proper type.
579 if (state->vt == VT_EMPTY) 579 if (state->vt == VT_EMPTY)
580 return E_FAIL; 580 return E_FAIL;
581 581
582 return S_OK; 582 return S_OK;
583 } 583 }
584 584
585 STDMETHODIMP NativeViewAccessibilityWin::get_accValue( 585 STDMETHODIMP NativeViewAccessibilityWin::get_accValue(VARIANT var_id,
586 VARIANT var_id, BSTR* value) { 586 BSTR* value) {
587 if (!IsValidId(var_id) || !value) 587 if (!IsValidId(var_id) || !value)
588 return E_INVALIDARG; 588 return E_INVALIDARG;
589 589
590 if (!view_) 590 if (!view_)
591 return E_FAIL; 591 return E_FAIL;
592 592
593 // Retrieve the current view's value. 593 // Retrieve the current view's value.
594 ui::AccessibleViewState state; 594 ui::AccessibleViewState state;
595 view_->GetAccessibleState(&state); 595 view_->GetAccessibleState(&state);
596 string16 temp_value = state.value; 596 string16 temp_value = state.value;
597 597
598 if (!temp_value.empty()) { 598 if (!temp_value.empty()) {
599 // Return value retrieved. 599 // Return value retrieved.
600 *value = SysAllocString(temp_value.c_str()); 600 *value = SysAllocString(temp_value.c_str());
601 } else { 601 } else {
602 // If view has no value, fall back into the default implementation. 602 // If view has no value, fall back into the default implementation.
603 *value = NULL; 603 *value = NULL;
604 return E_NOTIMPL; 604 return E_NOTIMPL;
605 } 605 }
606 606
607 return S_OK; 607 return S_OK;
608 } 608 }
609 609
610 STDMETHODIMP NativeViewAccessibilityWin::put_accValue(VARIANT var_id,
611 BSTR new_value) {
612 if (!IsValidId(var_id) || !new_value)
613 return E_INVALIDARG;
614
615 if (!view_)
616 return E_FAIL;
617
618 // Return an error if the view can't set the value.
619 ui::AccessibleViewState state;
620 view_->GetAccessibleState(&state);
621 if (state.set_value_callback.is_null())
622 return E_FAIL;
623
624 state.set_value_callback.Run(new_value);
625 return S_OK;
626 }
627
610 // IAccessible functions not supported. 628 // IAccessible functions not supported.
611 629
612 STDMETHODIMP NativeViewAccessibilityWin::get_accSelection(VARIANT* selected) { 630 STDMETHODIMP NativeViewAccessibilityWin::get_accSelection(VARIANT* selected) {
613 if (selected) 631 if (selected)
614 selected->vt = VT_EMPTY; 632 selected->vt = VT_EMPTY;
615 return E_NOTIMPL; 633 return E_NOTIMPL;
616 } 634 }
617 635
618 STDMETHODIMP NativeViewAccessibilityWin::accSelect( 636 STDMETHODIMP NativeViewAccessibilityWin::accSelect(
619 LONG flagsSelect, VARIANT var_id) { 637 LONG flagsSelect, VARIANT var_id) {
(...skipping 17 matching lines...) Expand all
637 } 655 }
638 return E_NOTIMPL; 656 return E_NOTIMPL;
639 } 657 }
640 658
641 STDMETHODIMP NativeViewAccessibilityWin::put_accName( 659 STDMETHODIMP NativeViewAccessibilityWin::put_accName(
642 VARIANT var_id, BSTR put_name) { 660 VARIANT var_id, BSTR put_name) {
643 // Deprecated. 661 // Deprecated.
644 return E_NOTIMPL; 662 return E_NOTIMPL;
645 } 663 }
646 664
647 STDMETHODIMP NativeViewAccessibilityWin::put_accValue(
648 VARIANT var_id, BSTR put_val) {
649 // Deprecated.
650 return E_NOTIMPL;
651 }
652
653 // 665 //
654 // IAccessible2 666 // IAccessible2
655 // 667 //
656 668
657 STDMETHODIMP NativeViewAccessibilityWin::role(LONG* role) { 669 STDMETHODIMP NativeViewAccessibilityWin::role(LONG* role) {
658 if (!view_) 670 if (!view_)
659 return E_FAIL; 671 return E_FAIL;
660 672
661 if (!role) 673 if (!role)
662 return E_INVALIDARG; 674 return E_INVALIDARG;
(...skipping 563 matching lines...) Expand 10 before | Expand all | Expand 10 after
1226 LONG start_offset, 1238 LONG start_offset,
1227 ui::TextBoundaryDirection direction) { 1239 ui::TextBoundaryDirection direction) {
1228 HandleSpecialTextOffset(text, &start_offset); 1240 HandleSpecialTextOffset(text, &start_offset);
1229 ui::TextBoundaryType boundary = IA2TextBoundaryToTextBoundary(ia2_boundary); 1241 ui::TextBoundaryType boundary = IA2TextBoundaryToTextBoundary(ia2_boundary);
1230 std::vector<int32> line_breaks; 1242 std::vector<int32> line_breaks;
1231 return ui::FindAccessibleTextBoundary( 1243 return ui::FindAccessibleTextBoundary(
1232 text, line_breaks, boundary, start_offset, direction); 1244 text, line_breaks, boundary, start_offset, direction);
1233 } 1245 }
1234 1246
1235 } // namespace views 1247 } // namespace views
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698