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

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

Issue 329053004: Fix race in BrowserAccessibilityManagerWin creation. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Simpler fix Created 6 years, 6 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 "base/strings/string_number_conversions.h" 10 #include "base/strings/string_number_conversions.h"
(...skipping 721 matching lines...) Expand 10 before | Expand all | Expand 10 after
732 } 732 }
733 733
734 STDMETHODIMP BrowserAccessibilityWin::get_windowHandle(HWND* window_handle) { 734 STDMETHODIMP BrowserAccessibilityWin::get_windowHandle(HWND* window_handle) {
735 if (!instance_active()) 735 if (!instance_active())
736 return E_FAIL; 736 return E_FAIL;
737 737
738 if (!window_handle) 738 if (!window_handle)
739 return E_INVALIDARG; 739 return E_INVALIDARG;
740 740
741 *window_handle = manager()->ToBrowserAccessibilityManagerWin()->parent_hwnd(); 741 *window_handle = manager()->ToBrowserAccessibilityManagerWin()->parent_hwnd();
742 if (!*window_handle)
743 return E_FAIL;
744
742 return S_OK; 745 return S_OK;
743 } 746 }
744 747
745 STDMETHODIMP BrowserAccessibilityWin::get_indexInParent(LONG* index_in_parent) { 748 STDMETHODIMP BrowserAccessibilityWin::get_indexInParent(LONG* index_in_parent) {
746 if (!instance_active()) 749 if (!instance_active())
747 return E_FAIL; 750 return E_FAIL;
748 751
749 if (!index_in_parent) 752 if (!index_in_parent)
750 return E_INVALIDARG; 753 return E_INVALIDARG;
751 754
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after
985 LONG* y) { 988 LONG* y) {
986 if (!instance_active()) 989 if (!instance_active())
987 return E_FAIL; 990 return E_FAIL;
988 991
989 if (!x || !y) 992 if (!x || !y)
990 return E_INVALIDARG; 993 return E_INVALIDARG;
991 994
992 if (coordinate_type == IA2_COORDTYPE_SCREEN_RELATIVE) { 995 if (coordinate_type == IA2_COORDTYPE_SCREEN_RELATIVE) {
993 HWND parent_hwnd = 996 HWND parent_hwnd =
994 manager()->ToBrowserAccessibilityManagerWin()->parent_hwnd(); 997 manager()->ToBrowserAccessibilityManagerWin()->parent_hwnd();
998 if (!parent_hwnd)
999 return E_FAIL;
995 POINT top_left = {0, 0}; 1000 POINT top_left = {0, 0};
996 ::ClientToScreen(parent_hwnd, &top_left); 1001 ::ClientToScreen(parent_hwnd, &top_left);
997 *x = GetLocation().x() + top_left.x; 1002 *x = GetLocation().x() + top_left.x;
998 *y = GetLocation().y() + top_left.y; 1003 *y = GetLocation().y() + top_left.y;
999 } else if (coordinate_type == IA2_COORDTYPE_PARENT_RELATIVE) { 1004 } else if (coordinate_type == IA2_COORDTYPE_PARENT_RELATIVE) {
1000 *x = GetLocation().x(); 1005 *x = GetLocation().x();
1001 *y = GetLocation().y(); 1006 *y = GetLocation().y();
1002 if (GetParent()) { 1007 if (GetParent()) {
1003 *x -= GetParent()->GetLocation().x(); 1008 *x -= GetParent()->GetLocation().x();
1004 *y -= GetParent()->GetLocation().y(); 1009 *y -= GetParent()->GetLocation().y();
(...skipping 2779 matching lines...) Expand 10 before | Expand all | Expand 10 after
3784 // The role should always be set. 3789 // The role should always be set.
3785 DCHECK(!role_name_.empty() || ia_role_); 3790 DCHECK(!role_name_.empty() || ia_role_);
3786 3791
3787 // If we didn't explicitly set the IAccessible2 role, make it the same 3792 // If we didn't explicitly set the IAccessible2 role, make it the same
3788 // as the MSAA role. 3793 // as the MSAA role.
3789 if (!ia2_role_) 3794 if (!ia2_role_)
3790 ia2_role_ = ia_role_; 3795 ia2_role_ = ia_role_;
3791 } 3796 }
3792 3797
3793 } // namespace content 3798 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698