| 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 | |
| 186 void BrowserAccessibilityManagerWin::NotifyAccessibilityEvent( | 182 void BrowserAccessibilityManagerWin::NotifyAccessibilityEvent( |
| 187 ui::AXEvent event_type, | 183 ui::AXEvent event_type, |
| 188 BrowserAccessibility* node) { | 184 BrowserAccessibility* node) { |
| 189 BrowserAccessibilityDelegate* root_delegate = GetDelegateFromRootManager(); | 185 BrowserAccessibilityDelegate* root_delegate = GetDelegateFromRootManager(); |
| 190 if (!root_delegate || !root_delegate->AccessibilityGetAcceleratedWidget()) { | 186 if (!root_delegate || !root_delegate->AccessibilityGetAcceleratedWidget()) { |
| 191 LOG(WARNING) << "Not firing AX event because of no root_delegate or hwnd"; | 187 LOG(WARNING) << "Not firing AX event because of no root_delegate or hwnd"; |
| 192 return; | 188 return; |
| 193 } | 189 } |
| 194 | 190 |
| 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 | |
| 200 // Inline text boxes are an internal implementation detail, we don't | 191 // Inline text boxes are an internal implementation detail, we don't |
| 201 // expose them to Windows. | 192 // expose them to Windows. |
| 202 if (node->GetRole() == ui::AX_ROLE_INLINE_TEXT_BOX) | 193 if (node->GetRole() == ui::AX_ROLE_INLINE_TEXT_BOX) |
| 203 return; | 194 return; |
| 204 | 195 |
| 205 // Don't fire focus, blur, or load complete notifications if the | 196 // Don't fire focus, blur, or load complete notifications if the |
| 206 // window isn't focused, because that can confuse screen readers into | 197 // window isn't focused, because that can confuse screen readers into |
| 207 // entering their "browse" mode. | 198 // entering their "browse" mode. |
| 208 if ((event_type == ui::AX_EVENT_FOCUS || | 199 if ((event_type == ui::AX_EVENT_FOCUS || |
| 209 event_type == ui::AX_EVENT_BLUR || | 200 event_type == ui::AX_EVENT_BLUR || |
| (...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 381 child_manager->GetFromUniqueIdWin(unique_id_win); | 372 child_manager->GetFromUniqueIdWin(unique_id_win); |
| 382 if (result) | 373 if (result) |
| 383 return result; | 374 return result; |
| 384 } | 375 } |
| 385 } | 376 } |
| 386 | 377 |
| 387 return NULL; | 378 return NULL; |
| 388 } | 379 } |
| 389 | 380 |
| 390 } // namespace content | 381 } // namespace content |
| OLD | NEW |