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 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 DCHECK(accessible_hwnd_); | 77 DCHECK(accessible_hwnd_); |
78 parent_hwnd_ = accessible_hwnd_->hwnd(); | 78 parent_hwnd_ = accessible_hwnd_->hwnd(); |
79 parent_iaccessible_ = accessible_hwnd_->window_accessible(); | 79 parent_iaccessible_ = accessible_hwnd_->window_accessible(); |
80 } | 80 } |
81 ::NotifyWinEvent(event, parent_hwnd(), OBJID_CLIENT, child_id); | 81 ::NotifyWinEvent(event, parent_hwnd(), OBJID_CLIENT, child_id); |
82 } | 82 } |
83 | 83 |
84 void BrowserAccessibilityManagerWin::AddNodeToMap(BrowserAccessibility* node) { | 84 void BrowserAccessibilityManagerWin::AddNodeToMap(BrowserAccessibility* node) { |
85 BrowserAccessibilityManager::AddNodeToMap(node); | 85 BrowserAccessibilityManager::AddNodeToMap(node); |
86 LONG unique_id_win = node->ToBrowserAccessibilityWin()->unique_id_win(); | 86 LONG unique_id_win = node->ToBrowserAccessibilityWin()->unique_id_win(); |
87 unique_id_to_renderer_id_map_[unique_id_win] = node->renderer_id(); | 87 unique_id_to_renderer_id_map_[unique_id_win] = node->GetId(); |
88 } | 88 } |
89 | 89 |
90 void BrowserAccessibilityManagerWin::RemoveNode(BrowserAccessibility* node) { | 90 void BrowserAccessibilityManagerWin::RemoveNode(BrowserAccessibility* node) { |
91 unique_id_to_renderer_id_map_.erase( | 91 unique_id_to_renderer_id_map_.erase( |
92 node->ToBrowserAccessibilityWin()->unique_id_win()); | 92 node->ToBrowserAccessibilityWin()->unique_id_win()); |
93 BrowserAccessibilityManager::RemoveNode(node); | 93 BrowserAccessibilityManager::RemoveNode(node); |
94 if (node == tracked_scroll_object_) { | 94 if (node == tracked_scroll_object_) { |
95 tracked_scroll_object_->Release(); | 95 tracked_scroll_object_->Release(); |
96 tracked_scroll_object_ = NULL; | 96 tracked_scroll_object_ = NULL; |
97 } | 97 } |
98 } | 98 } |
99 | 99 |
100 void BrowserAccessibilityManagerWin::OnWindowFocused() { | 100 void BrowserAccessibilityManagerWin::OnWindowFocused() { |
101 // Fire a focus event on the root first and then the focused node. | 101 // Fire a focus event on the root first and then the focused node. |
102 if (focus_ != root_) | 102 if (focus_ != root_) |
103 NotifyAccessibilityEvent(ui::AX_EVENT_FOCUS, root_); | 103 NotifyAccessibilityEvent(ui::AX_EVENT_FOCUS, root_); |
104 BrowserAccessibilityManager::OnWindowFocused(); | 104 BrowserAccessibilityManager::OnWindowFocused(); |
105 } | 105 } |
106 | 106 |
107 void BrowserAccessibilityManagerWin::OnWindowBlurred() { | 107 void BrowserAccessibilityManagerWin::OnWindowBlurred() { |
108 // Fire a blur event on the focused node first and then the root. | 108 // Fire a blur event on the focused node first and then the root. |
109 BrowserAccessibilityManager::OnWindowBlurred(); | 109 BrowserAccessibilityManager::OnWindowBlurred(); |
110 if (focus_ != root_) | 110 if (focus_ != root_) |
111 NotifyAccessibilityEvent(ui::AX_EVENT_BLUR, root_); | 111 NotifyAccessibilityEvent(ui::AX_EVENT_BLUR, root_); |
112 } | 112 } |
113 | 113 |
114 void BrowserAccessibilityManagerWin::NotifyAccessibilityEvent( | 114 void BrowserAccessibilityManagerWin::NotifyAccessibilityEvent( |
115 ui::AXEvent event_type, | 115 ui::AXEvent event_type, |
116 BrowserAccessibility* node) { | 116 BrowserAccessibility* node) { |
117 if (node->role() == ui::AX_ROLE_INLINE_TEXT_BOX) | 117 if (node->GetRole() == ui::AX_ROLE_INLINE_TEXT_BOX) |
118 return; | 118 return; |
119 | 119 |
120 LONG event_id = EVENT_MIN; | 120 LONG event_id = EVENT_MIN; |
121 switch (event_type) { | 121 switch (event_type) { |
122 case ui::AX_EVENT_ACTIVEDESCENDANTCHANGED: | 122 case ui::AX_EVENT_ACTIVEDESCENDANTCHANGED: |
123 event_id = IA2_EVENT_ACTIVE_DESCENDANT_CHANGED; | 123 event_id = IA2_EVENT_ACTIVE_DESCENDANT_CHANGED; |
124 break; | 124 break; |
125 case ui::AX_EVENT_ALERT: | 125 case ui::AX_EVENT_ALERT: |
126 event_id = EVENT_SYSTEM_ALERT; | 126 event_id = EVENT_SYSTEM_ALERT; |
127 break; | 127 break; |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
252 // |parent_iaccessible_| are no longer valid either, since they were | 252 // |parent_iaccessible_| are no longer valid either, since they were |
253 // derived from AccessibleHWND. We don't have to restore them to | 253 // derived from AccessibleHWND. We don't have to restore them to |
254 // previous values, though, because this should only happen | 254 // previous values, though, because this should only happen |
255 // during the destruct sequence for this window. | 255 // during the destruct sequence for this window. |
256 accessible_hwnd_ = NULL; | 256 accessible_hwnd_ = NULL; |
257 parent_hwnd_ = NULL; | 257 parent_hwnd_ = NULL; |
258 parent_iaccessible_ = NULL; | 258 parent_iaccessible_ = NULL; |
259 } | 259 } |
260 | 260 |
261 } // namespace content | 261 } // namespace content |
OLD | NEW |