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 <stddef.h> | 7 #include <stddef.h> |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <vector> | 10 #include <vector> |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
97 void BrowserAccessibilityManagerWin::UserIsReloading() { | 97 void BrowserAccessibilityManagerWin::UserIsReloading() { |
98 if (GetRoot()) { | 98 if (GetRoot()) { |
99 (new BrowserAccessibilityEventWin( | 99 (new BrowserAccessibilityEventWin( |
100 BrowserAccessibilityEvent::FromRenderFrameHost, | 100 BrowserAccessibilityEvent::FromRenderFrameHost, |
101 ui::AX_EVENT_NONE, | 101 ui::AX_EVENT_NONE, |
102 IA2_EVENT_DOCUMENT_RELOAD, | 102 IA2_EVENT_DOCUMENT_RELOAD, |
103 GetRoot()))->Fire(); | 103 GetRoot()))->Fire(); |
104 } | 104 } |
105 } | 105 } |
106 | 106 |
107 BrowserAccessibility* BrowserAccessibilityManagerWin::GetFocus() { | |
108 BrowserAccessibility* focus = BrowserAccessibilityManager::GetFocus(); | |
109 return GetActiveDescendant(focus); | |
110 } | |
111 | |
112 void BrowserAccessibilityManagerWin::NotifyAccessibilityEvent( | 107 void BrowserAccessibilityManagerWin::NotifyAccessibilityEvent( |
113 BrowserAccessibilityEvent::Source source, | 108 BrowserAccessibilityEvent::Source source, |
114 ui::AXEvent event_type, | 109 ui::AXEvent event_type, |
115 BrowserAccessibility* node) { | 110 BrowserAccessibility* node) { |
116 bool can_fire_events = CanFireEvents(); | 111 bool can_fire_events = CanFireEvents(); |
117 | 112 |
118 // TODO(dmazzoni): A better fix would be to always have a HWND. | 113 // TODO(dmazzoni): A better fix would be to always have a HWND. |
119 // http://crbug.com/521877 | 114 // http://crbug.com/521877 |
120 if (event_type == ui::AX_EVENT_LOAD_COMPLETE && can_fire_events) | 115 if (event_type == ui::AX_EVENT_LOAD_COMPLETE && can_fire_events) |
121 load_complete_pending_ = false; | 116 load_complete_pending_ = false; |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
229 BrowserAccessibilityDelegate* root_delegate = GetDelegateFromRootManager(); | 224 BrowserAccessibilityDelegate* root_delegate = GetDelegateFromRootManager(); |
230 if (!root_delegate) | 225 if (!root_delegate) |
231 return false; | 226 return false; |
232 HWND hwnd = root_delegate->AccessibilityGetAcceleratedWidget(); | 227 HWND hwnd = root_delegate->AccessibilityGetAcceleratedWidget(); |
233 return hwnd != nullptr; | 228 return hwnd != nullptr; |
234 } | 229 } |
235 | 230 |
236 void BrowserAccessibilityManagerWin::FireFocusEvent( | 231 void BrowserAccessibilityManagerWin::FireFocusEvent( |
237 BrowserAccessibilityEvent::Source source, | 232 BrowserAccessibilityEvent::Source source, |
238 BrowserAccessibility* node) { | 233 BrowserAccessibility* node) { |
239 DCHECK(node); | |
240 // On Windows, we always fire a FOCUS event on the root of a frame before | 234 // On Windows, we always fire a FOCUS event on the root of a frame before |
241 // firing a focus event within that frame. | 235 // firing a focus event within that frame. |
242 if (node->manager() != last_focused_manager_ && | 236 if (node->manager() != last_focused_manager_ && |
243 node != node->manager()->GetRoot()) { | 237 node != node->manager()->GetRoot()) { |
244 BrowserAccessibilityEvent::Create(source, | 238 BrowserAccessibilityEvent::Create(source, |
245 ui::AX_EVENT_FOCUS, | 239 ui::AX_EVENT_FOCUS, |
246 node->manager()->GetRoot())->Fire(); | 240 node->manager()->GetRoot())->Fire(); |
247 } | 241 } |
248 | 242 |
249 BrowserAccessibilityManager::FireFocusEvent(source, node); | 243 BrowserAccessibilityManager::FireFocusEvent(source, node); |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
327 | 321 |
328 void BrowserAccessibilityManagerWin::TrackScrollingObject( | 322 void BrowserAccessibilityManagerWin::TrackScrollingObject( |
329 BrowserAccessibilityWin* node) { | 323 BrowserAccessibilityWin* node) { |
330 if (tracked_scroll_object_) | 324 if (tracked_scroll_object_) |
331 tracked_scroll_object_->Release(); | 325 tracked_scroll_object_->Release(); |
332 tracked_scroll_object_ = node; | 326 tracked_scroll_object_ = node; |
333 tracked_scroll_object_->AddRef(); | 327 tracked_scroll_object_->AddRef(); |
334 } | 328 } |
335 | 329 |
336 } // namespace content | 330 } // namespace content |
OLD | NEW |