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 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
172 if (!delegate_ || !delegate_->AccessibilityViewHasFocus()) | 172 if (!delegate_ || !delegate_->AccessibilityViewHasFocus()) |
173 return; | 173 return; |
174 | 174 |
175 // Try to fire a focus event on the root first and then the focused node. | 175 // Try to fire a focus event on the root first and then the focused node. |
176 // This will clear focus_event_on_root_needed_ if successful. | 176 // This will clear focus_event_on_root_needed_ if successful. |
177 if (focus_ != tree_->GetRoot()) | 177 if (focus_ != tree_->GetRoot()) |
178 NotifyAccessibilityEvent(ui::AX_EVENT_FOCUS, GetRoot()); | 178 NotifyAccessibilityEvent(ui::AX_EVENT_FOCUS, GetRoot()); |
179 BrowserAccessibilityManager::OnWindowFocused(); | 179 BrowserAccessibilityManager::OnWindowFocused(); |
180 } | 180 } |
181 | 181 |
| 182 void BrowserAccessibilityManagerWin::UserIsReloading() { |
| 183 MaybeCallNotifyWinEvent(IA2_EVENT_DOCUMENT_RELOAD, GetRoot()); |
| 184 } |
| 185 |
182 void BrowserAccessibilityManagerWin::NotifyAccessibilityEvent( | 186 void BrowserAccessibilityManagerWin::NotifyAccessibilityEvent( |
183 ui::AXEvent event_type, | 187 ui::AXEvent event_type, |
184 BrowserAccessibility* node) { | 188 BrowserAccessibility* node) { |
185 BrowserAccessibilityDelegate* root_delegate = GetDelegateFromRootManager(); | 189 BrowserAccessibilityDelegate* root_delegate = GetDelegateFromRootManager(); |
186 if (!root_delegate || !root_delegate->AccessibilityGetAcceleratedWidget()) { | 190 if (!root_delegate || !root_delegate->AccessibilityGetAcceleratedWidget()) { |
187 LOG(WARNING) << "Not firing AX event because of no root_delegate or hwnd"; | 191 LOG(WARNING) << "Not firing AX event because of no root_delegate or hwnd"; |
188 return; | 192 return; |
189 } | 193 } |
190 | 194 |
| 195 // Don't fire events when this document might be stale as the user has |
| 196 // started navigating to a new document. |
| 197 if (user_is_navigating_away_) |
| 198 return; |
| 199 |
191 // Inline text boxes are an internal implementation detail, we don't | 200 // Inline text boxes are an internal implementation detail, we don't |
192 // expose them to Windows. | 201 // expose them to Windows. |
193 if (node->GetRole() == ui::AX_ROLE_INLINE_TEXT_BOX) | 202 if (node->GetRole() == ui::AX_ROLE_INLINE_TEXT_BOX) |
194 return; | 203 return; |
195 | 204 |
196 // Don't fire focus, blur, or load complete notifications if the | 205 // Don't fire focus, blur, or load complete notifications if the |
197 // window isn't focused, because that can confuse screen readers into | 206 // window isn't focused, because that can confuse screen readers into |
198 // entering their "browse" mode. | 207 // entering their "browse" mode. |
199 if ((event_type == ui::AX_EVENT_FOCUS || | 208 if ((event_type == ui::AX_EVENT_FOCUS || |
200 event_type == ui::AX_EVENT_BLUR || | 209 event_type == ui::AX_EVENT_BLUR || |
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
372 child_manager->GetFromUniqueIdWin(unique_id_win); | 381 child_manager->GetFromUniqueIdWin(unique_id_win); |
373 if (result) | 382 if (result) |
374 return result; | 383 return result; |
375 } | 384 } |
376 } | 385 } |
377 | 386 |
378 return NULL; | 387 return NULL; |
379 } | 388 } |
380 | 389 |
381 } // namespace content | 390 } // namespace content |
OLD | NEW |