Chromium Code Reviews| 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 "content/browser/accessibility/browser_accessibility_win.h" | 7 #include "content/browser/accessibility/browser_accessibility_win.h" |
| 8 #include "content/common/accessibility_messages.h" | 8 #include "content/common/accessibility_messages.h" |
| 9 | 9 |
| 10 namespace content { | 10 namespace content { |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 46 AccessibilityNodeData BrowserAccessibilityManagerWin::GetEmptyDocument() { | 46 AccessibilityNodeData BrowserAccessibilityManagerWin::GetEmptyDocument() { |
| 47 AccessibilityNodeData empty_document; | 47 AccessibilityNodeData empty_document; |
| 48 empty_document.id = 0; | 48 empty_document.id = 0; |
| 49 empty_document.role = AccessibilityNodeData::ROLE_ROOT_WEB_AREA; | 49 empty_document.role = AccessibilityNodeData::ROLE_ROOT_WEB_AREA; |
| 50 empty_document.state = | 50 empty_document.state = |
| 51 (1 << AccessibilityNodeData::STATE_READONLY) | | 51 (1 << AccessibilityNodeData::STATE_READONLY) | |
| 52 (1 << AccessibilityNodeData::STATE_BUSY); | 52 (1 << AccessibilityNodeData::STATE_BUSY); |
| 53 return empty_document; | 53 return empty_document; |
| 54 } | 54 } |
| 55 | 55 |
| 56 void BrowserAccessibilityManagerWin::InitializeNode( | |
| 57 BrowserAccessibility* node) { | |
| 58 BrowserAccessibilityManager::InitializeNode(node); | |
| 59 LONG unique_id_win = node->ToBrowserAccessibilityWin()->unique_id_win(); | |
| 60 unique_id_to_renderer_id_map_[unique_id_win] = node->renderer_id(); | |
| 61 } | |
| 62 | |
| 63 void BrowserAccessibilityManagerWin::RemoveNode(BrowserAccessibility* node) { | |
| 64 unique_id_to_renderer_id_map_.erase( | |
| 65 node->ToBrowserAccessibilityWin()->unique_id_win()); | |
| 66 BrowserAccessibilityManager::RemoveNode(node); | |
| 67 } | |
| 68 | |
| 56 void BrowserAccessibilityManagerWin::NotifyAccessibilityEvent( | 69 void BrowserAccessibilityManagerWin::NotifyAccessibilityEvent( |
| 57 int type, | 70 int type, |
| 58 BrowserAccessibility* node) { | 71 BrowserAccessibility* node) { |
| 59 LONG event_id = EVENT_MIN; | 72 LONG event_id = EVENT_MIN; |
| 60 switch (type) { | 73 switch (type) { |
| 61 case AccessibilityNotificationActiveDescendantChanged: | 74 case AccessibilityNotificationActiveDescendantChanged: |
| 62 event_id = IA2_EVENT_ACTIVE_DESCENDANT_CHANGED; | 75 event_id = IA2_EVENT_ACTIVE_DESCENDANT_CHANGED; |
| 63 break; | 76 break; |
| 64 case AccessibilityNotificationAlert: | 77 case AccessibilityNotificationAlert: |
| 65 event_id = EVENT_SYSTEM_ALERT; | 78 event_id = EVENT_SYSTEM_ALERT; |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 128 break; | 141 break; |
| 129 case AccessibilityNotificationValueChanged: | 142 case AccessibilityNotificationValueChanged: |
| 130 event_id = EVENT_OBJECT_VALUECHANGE; | 143 event_id = EVENT_OBJECT_VALUECHANGE; |
| 131 break; | 144 break; |
| 132 default: | 145 default: |
| 133 // Not all WebKit accessibility events result in a Windows | 146 // Not all WebKit accessibility events result in a Windows |
| 134 // accessibility notification. | 147 // accessibility notification. |
| 135 break; | 148 break; |
| 136 } | 149 } |
| 137 | 150 |
| 151 LONG child_id = node->ToBrowserAccessibilityWin()->unique_id_win(); | |
|
aboxhall
2013/04/09 09:28:29
Should this be renamed unique_id_win as well?
dmazzoni
2013/04/09 19:44:04
The argument to NotifyWinEvent is called "child id
| |
| 152 | |
| 138 if (event_id != EVENT_MIN) | 153 if (event_id != EVENT_MIN) |
| 139 NotifyWinEvent(event_id, parent_hwnd(), OBJID_CLIENT, node->child_id()); | 154 NotifyWinEvent(event_id, parent_hwnd(), OBJID_CLIENT, child_id); |
| 140 | 155 |
| 141 // If this is a layout complete notification (sent when a container scrolls) | 156 // If this is a layout complete notification (sent when a container scrolls) |
| 142 // and there is a descendant tracked object, send a notification on it. | 157 // and there is a descendant tracked object, send a notification on it. |
| 143 // TODO(dmazzoni): remove once http://crbug.com/113483 is fixed. | 158 // TODO(dmazzoni): remove once http://crbug.com/113483 is fixed. |
| 144 if (type == AccessibilityNotificationLayoutComplete && | 159 if (type == AccessibilityNotificationLayoutComplete && |
| 145 tracked_scroll_object_ && | 160 tracked_scroll_object_ && |
| 146 tracked_scroll_object_->IsDescendantOf(node)) { | 161 tracked_scroll_object_->IsDescendantOf(node)) { |
| 147 NotifyWinEvent(IA2_EVENT_VISIBLE_DATA_CHANGED, | 162 NotifyWinEvent( |
| 148 parent_hwnd(), | 163 IA2_EVENT_VISIBLE_DATA_CHANGED, |
| 149 OBJID_CLIENT, | 164 parent_hwnd(), |
| 150 tracked_scroll_object_->child_id()); | 165 OBJID_CLIENT, |
| 166 tracked_scroll_object_->ToBrowserAccessibilityWin()->unique_id_win()); | |
| 151 tracked_scroll_object_->Release(); | 167 tracked_scroll_object_->Release(); |
| 152 tracked_scroll_object_ = NULL; | 168 tracked_scroll_object_ = NULL; |
| 153 } | 169 } |
| 154 } | 170 } |
| 155 | 171 |
| 156 void BrowserAccessibilityManagerWin::TrackScrollingObject( | 172 void BrowserAccessibilityManagerWin::TrackScrollingObject( |
| 157 BrowserAccessibilityWin* node) { | 173 BrowserAccessibilityWin* node) { |
| 158 if (tracked_scroll_object_) | 174 if (tracked_scroll_object_) |
| 159 tracked_scroll_object_->Release(); | 175 tracked_scroll_object_->Release(); |
| 160 tracked_scroll_object_ = node; | 176 tracked_scroll_object_ = node; |
| 161 tracked_scroll_object_->AddRef(); | 177 tracked_scroll_object_->AddRef(); |
| 162 } | 178 } |
| 163 | 179 |
| 180 BrowserAccessibilityWin* BrowserAccessibilityManagerWin::GetFromUniqueIdWin( | |
| 181 LONG unique_id_win) { | |
| 182 base::hash_map<LONG, int32>::iterator iter = | |
| 183 unique_id_to_renderer_id_map_.find(unique_id_win); | |
| 184 if (iter != unique_id_to_renderer_id_map_.end()) { | |
| 185 BrowserAccessibility* result = GetFromRendererID(iter->second); | |
| 186 if (result) | |
| 187 return result->ToBrowserAccessibilityWin(); | |
| 188 } | |
| 189 return NULL; | |
| 190 } | |
| 191 | |
| 164 } // namespace content | 192 } // namespace content |
| OLD | NEW |