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_manager_win.h" | 5 #include "content/browser/accessibility/browser_accessibility_manager_win.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/win/scoped_comptr.h" | 8 #include "base/win/scoped_comptr.h" |
9 #include "base/win/windows_version.h" | 9 #include "base/win/windows_version.h" |
10 #include "content/browser/accessibility/browser_accessibility_state_impl.h" | 10 #include "content/browser/accessibility/browser_accessibility_state_impl.h" |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
69 | 69 |
70 IAccessible* BrowserAccessibilityManagerWin::GetParentIAccessible() { | 70 IAccessible* BrowserAccessibilityManagerWin::GetParentIAccessible() { |
71 if (!delegate_) | 71 if (!delegate_) |
72 return NULL; | 72 return NULL; |
73 return delegate_->AccessibilityGetNativeViewAccessible(); | 73 return delegate_->AccessibilityGetNativeViewAccessible(); |
74 } | 74 } |
75 | 75 |
76 void BrowserAccessibilityManagerWin::MaybeCallNotifyWinEvent(DWORD event, | 76 void BrowserAccessibilityManagerWin::MaybeCallNotifyWinEvent(DWORD event, |
77 LONG child_id) { | 77 LONG child_id) { |
78 BrowserAccessibilityDelegate* delegate = GetDelegateFromRootManager(); | 78 BrowserAccessibilityDelegate* delegate = GetDelegateFromRootManager(); |
79 if (!delegate) | 79 if (!delegate) { |
| 80 // This line and other LOG(WARNING) lines are temporary, to debug |
| 81 // flaky failures in DumpAccessibilityEvent* tests. |
| 82 // http://crbug.com/440579 |
| 83 LOG(WARNING) << "Not firing AX event because of no delegate"; |
80 return; | 84 return; |
| 85 } |
81 | 86 |
82 HWND hwnd = delegate->AccessibilityGetAcceleratedWidget(); | 87 HWND hwnd = delegate->AccessibilityGetAcceleratedWidget(); |
83 if (!hwnd) | 88 if (!hwnd) { |
| 89 LOG(WARNING) << "Not firing AX event because of no hwnd"; |
84 return; | 90 return; |
| 91 } |
85 | 92 |
86 ::NotifyWinEvent(event, hwnd, OBJID_CLIENT, child_id); | 93 ::NotifyWinEvent(event, hwnd, OBJID_CLIENT, child_id); |
87 } | 94 } |
88 | 95 |
89 void BrowserAccessibilityManagerWin::OnNodeCreated(ui::AXNode* node) { | 96 void BrowserAccessibilityManagerWin::OnNodeCreated(ui::AXNode* node) { |
90 BrowserAccessibilityManager::OnNodeCreated(node); | 97 BrowserAccessibilityManager::OnNodeCreated(node); |
91 BrowserAccessibility* obj = GetFromAXNode(node); | 98 BrowserAccessibility* obj = GetFromAXNode(node); |
92 LONG unique_id_win = obj->ToBrowserAccessibilityWin()->unique_id_win(); | 99 LONG unique_id_win = obj->ToBrowserAccessibilityWin()->unique_id_win(); |
93 unique_id_to_ax_id_map_[unique_id_win] = obj->GetId(); | 100 unique_id_to_ax_id_map_[unique_id_win] = obj->GetId(); |
94 } | 101 } |
(...skipping 28 matching lines...) Expand all Loading... |
123 // This will clear focus_event_on_root_needed_ if successful. | 130 // This will clear focus_event_on_root_needed_ if successful. |
124 if (focus_ != tree_->GetRoot()) | 131 if (focus_ != tree_->GetRoot()) |
125 NotifyAccessibilityEvent(ui::AX_EVENT_FOCUS, GetRoot()); | 132 NotifyAccessibilityEvent(ui::AX_EVENT_FOCUS, GetRoot()); |
126 BrowserAccessibilityManager::OnWindowFocused(); | 133 BrowserAccessibilityManager::OnWindowFocused(); |
127 } | 134 } |
128 | 135 |
129 void BrowserAccessibilityManagerWin::NotifyAccessibilityEvent( | 136 void BrowserAccessibilityManagerWin::NotifyAccessibilityEvent( |
130 ui::AXEvent event_type, | 137 ui::AXEvent event_type, |
131 BrowserAccessibility* node) { | 138 BrowserAccessibility* node) { |
132 BrowserAccessibilityDelegate* root_delegate = GetDelegateFromRootManager(); | 139 BrowserAccessibilityDelegate* root_delegate = GetDelegateFromRootManager(); |
133 if (!root_delegate || !root_delegate->AccessibilityGetAcceleratedWidget()) | 140 if (!root_delegate || !root_delegate->AccessibilityGetAcceleratedWidget()) { |
| 141 LOG(WARNING) << "Not firing AX event because of no root_delegate or hwnd"; |
134 return; | 142 return; |
| 143 } |
135 | 144 |
136 // Inline text boxes are an internal implementation detail, we don't | 145 // Inline text boxes are an internal implementation detail, we don't |
137 // expose them to Windows. | 146 // expose them to Windows. |
138 if (node->GetRole() == ui::AX_ROLE_INLINE_TEXT_BOX) | 147 if (node->GetRole() == ui::AX_ROLE_INLINE_TEXT_BOX) |
139 return; | 148 return; |
140 | 149 |
141 // Don't fire focus, blur, or load complete notifications if the | 150 // Don't fire focus, blur, or load complete notifications if the |
142 // window isn't focused, because that can confuse screen readers into | 151 // window isn't focused, because that can confuse screen readers into |
143 // entering their "browse" mode. | 152 // entering their "browse" mode. |
144 if ((event_type == ui::AX_EVENT_FOCUS || | 153 if ((event_type == ui::AX_EVENT_FOCUS || |
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
305 child_manager->GetFromUniqueIdWin(unique_id_win); | 314 child_manager->GetFromUniqueIdWin(unique_id_win); |
306 if (result) | 315 if (result) |
307 return result; | 316 return result; |
308 } | 317 } |
309 } | 318 } |
310 | 319 |
311 return NULL; | 320 return NULL; |
312 } | 321 } |
313 | 322 |
314 } // namespace content | 323 } // namespace content |
OLD | NEW |