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

Side by Side Diff: content/browser/accessibility/browser_accessibility_win.cc

Issue 1589623002: Keep track of accessibility focus across windows. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: git cl format Created 4 years, 10 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 "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 417 matching lines...) Expand 10 before | Expand all | Expand 10 after
428 } 428 }
429 429
430 STDMETHODIMP BrowserAccessibilityWin::get_accFocus(VARIANT* focus_child) { 430 STDMETHODIMP BrowserAccessibilityWin::get_accFocus(VARIANT* focus_child) {
431 if (!instance_active()) 431 if (!instance_active())
432 return E_FAIL; 432 return E_FAIL;
433 433
434 if (!focus_child) 434 if (!focus_child)
435 return E_INVALIDARG; 435 return E_INVALIDARG;
436 436
437 BrowserAccessibilityWin* focus = static_cast<BrowserAccessibilityWin*>( 437 BrowserAccessibilityWin* focus = static_cast<BrowserAccessibilityWin*>(
438 manager()->GetFocus(this)); 438 manager()->GetFocus());
439 if (focus == this) { 439 if (focus == this) {
440 focus_child->vt = VT_I4; 440 focus_child->vt = VT_I4;
441 focus_child->lVal = CHILDID_SELF; 441 focus_child->lVal = CHILDID_SELF;
442 } else if (focus == NULL) { 442 } else if (focus == NULL) {
443 focus_child->vt = VT_EMPTY; 443 focus_child->vt = VT_EMPTY;
444 } else { 444 } else {
445 focus_child->vt = VT_DISPATCH; 445 focus_child->vt = VT_DISPATCH;
446 focus_child->pdispVal = focus->NewReference(); 446 focus_child->pdispVal = focus->NewReference();
447 } 447 }
448 448
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
555 555
556 if (!state) 556 if (!state)
557 return E_INVALIDARG; 557 return E_INVALIDARG;
558 558
559 BrowserAccessibilityWin* target = GetTargetFromChildID(var_id); 559 BrowserAccessibilityWin* target = GetTargetFromChildID(var_id);
560 if (!target) 560 if (!target)
561 return E_INVALIDARG; 561 return E_INVALIDARG;
562 562
563 state->vt = VT_I4; 563 state->vt = VT_I4;
564 state->lVal = target->ia_state(); 564 state->lVal = target->ia_state();
565 if (manager()->GetFocus(NULL) == this) 565 if (manager()->GetFocus() == this)
566 state->lVal |= STATE_SYSTEM_FOCUSED; 566 state->lVal |= STATE_SYSTEM_FOCUSED;
567 567
568 return S_OK; 568 return S_OK;
569 } 569 }
570 570
571 STDMETHODIMP BrowserAccessibilityWin::get_accValue(VARIANT var_id, 571 STDMETHODIMP BrowserAccessibilityWin::get_accValue(VARIANT var_id,
572 BSTR* value) { 572 BSTR* value) {
573 if (!instance_active()) 573 if (!instance_active())
574 return E_FAIL; 574 return E_FAIL;
575 575
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
662 static_cast<base::win::IUnknownImpl*>(enum_variant)); 662 static_cast<base::win::IUnknownImpl*>(enum_variant));
663 return S_OK; 663 return S_OK;
664 } 664 }
665 665
666 STDMETHODIMP BrowserAccessibilityWin::accSelect( 666 STDMETHODIMP BrowserAccessibilityWin::accSelect(
667 LONG flags_sel, VARIANT var_id) { 667 LONG flags_sel, VARIANT var_id) {
668 if (!instance_active()) 668 if (!instance_active())
669 return E_FAIL; 669 return E_FAIL;
670 670
671 if (flags_sel & SELFLAG_TAKEFOCUS) { 671 if (flags_sel & SELFLAG_TAKEFOCUS) {
672 manager()->SetFocus(this, true); 672 manager()->SetFocus(*this);
673 return S_OK; 673 return S_OK;
674 } 674 }
675 675
676 return S_FALSE; 676 return S_FALSE;
677 } 677 }
678 678
679 STDMETHODIMP 679 STDMETHODIMP
680 BrowserAccessibilityWin::put_accName(VARIANT var_id, BSTR put_name) { 680 BrowserAccessibilityWin::put_accName(VARIANT var_id, BSTR put_name) {
681 return E_NOTIMPL; 681 return E_NOTIMPL;
682 } 682 }
(...skipping 4003 matching lines...) Expand 10 before | Expand all | Expand 10 after
4686 ia2_role = ia_role; 4686 ia2_role = ia_role;
4687 4687
4688 win_attributes_->ia_role = ia_role; 4688 win_attributes_->ia_role = ia_role;
4689 win_attributes_->ia_state = ia_state; 4689 win_attributes_->ia_state = ia_state;
4690 win_attributes_->role_name = role_name; 4690 win_attributes_->role_name = role_name;
4691 win_attributes_->ia2_role = ia2_role; 4691 win_attributes_->ia2_role = ia2_role;
4692 win_attributes_->ia2_state = ia2_state; 4692 win_attributes_->ia2_state = ia2_state;
4693 } 4693 }
4694 4694
4695 } // namespace content 4695 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698