Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(314)

Side by Side Diff: content/browser/accessibility/browser_accessibility_manager_win.cc

Issue 13770015: Rename confusing child_id to unique_id_win (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Addressed feedback Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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::AddNodeToMap(BrowserAccessibility* node) {
57 BrowserAccessibilityManager::AddNodeToMap(node);
58 LONG unique_id_win = node->ToBrowserAccessibilityWin()->unique_id_win();
59 unique_id_to_renderer_id_map_[unique_id_win] = node->renderer_id();
60 }
61
62 void BrowserAccessibilityManagerWin::RemoveNode(BrowserAccessibility* node) {
63 unique_id_to_renderer_id_map_.erase(
64 node->ToBrowserAccessibilityWin()->unique_id_win());
65 BrowserAccessibilityManager::RemoveNode(node);
66 }
67
56 void BrowserAccessibilityManagerWin::NotifyAccessibilityEvent( 68 void BrowserAccessibilityManagerWin::NotifyAccessibilityEvent(
57 int type, 69 int type,
58 BrowserAccessibility* node) { 70 BrowserAccessibility* node) {
59 LONG event_id = EVENT_MIN; 71 LONG event_id = EVENT_MIN;
60 switch (type) { 72 switch (type) {
61 case AccessibilityNotificationActiveDescendantChanged: 73 case AccessibilityNotificationActiveDescendantChanged:
62 event_id = IA2_EVENT_ACTIVE_DESCENDANT_CHANGED; 74 event_id = IA2_EVENT_ACTIVE_DESCENDANT_CHANGED;
63 break; 75 break;
64 case AccessibilityNotificationAlert: 76 case AccessibilityNotificationAlert:
65 event_id = EVENT_SYSTEM_ALERT; 77 event_id = EVENT_SYSTEM_ALERT;
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
128 break; 140 break;
129 case AccessibilityNotificationValueChanged: 141 case AccessibilityNotificationValueChanged:
130 event_id = EVENT_OBJECT_VALUECHANGE; 142 event_id = EVENT_OBJECT_VALUECHANGE;
131 break; 143 break;
132 default: 144 default:
133 // Not all WebKit accessibility events result in a Windows 145 // Not all WebKit accessibility events result in a Windows
134 // accessibility notification. 146 // accessibility notification.
135 break; 147 break;
136 } 148 }
137 149
150 // Pass the node's unique id in the |child_id| argument to NotifyWinEvent;
151 // the AT client will then call get_accChild on the HWND's accessibility
152 // object and pass it that same id, which we can use to retrieve the
153 // IAccessible for this node.
154 LONG child_id = node->ToBrowserAccessibilityWin()->unique_id_win();
155
138 if (event_id != EVENT_MIN) 156 if (event_id != EVENT_MIN)
139 NotifyWinEvent(event_id, parent_hwnd(), OBJID_CLIENT, node->child_id()); 157 NotifyWinEvent(event_id, parent_hwnd(), OBJID_CLIENT, child_id);
140 158
141 // If this is a layout complete notification (sent when a container scrolls) 159 // 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. 160 // and there is a descendant tracked object, send a notification on it.
143 // TODO(dmazzoni): remove once http://crbug.com/113483 is fixed. 161 // TODO(dmazzoni): remove once http://crbug.com/113483 is fixed.
144 if (type == AccessibilityNotificationLayoutComplete && 162 if (type == AccessibilityNotificationLayoutComplete &&
145 tracked_scroll_object_ && 163 tracked_scroll_object_ &&
146 tracked_scroll_object_->IsDescendantOf(node)) { 164 tracked_scroll_object_->IsDescendantOf(node)) {
147 NotifyWinEvent(IA2_EVENT_VISIBLE_DATA_CHANGED, 165 NotifyWinEvent(
148 parent_hwnd(), 166 IA2_EVENT_VISIBLE_DATA_CHANGED,
149 OBJID_CLIENT, 167 parent_hwnd(),
150 tracked_scroll_object_->child_id()); 168 OBJID_CLIENT,
169 tracked_scroll_object_->ToBrowserAccessibilityWin()->unique_id_win());
151 tracked_scroll_object_->Release(); 170 tracked_scroll_object_->Release();
152 tracked_scroll_object_ = NULL; 171 tracked_scroll_object_ = NULL;
153 } 172 }
154 } 173 }
155 174
156 void BrowserAccessibilityManagerWin::TrackScrollingObject( 175 void BrowserAccessibilityManagerWin::TrackScrollingObject(
157 BrowserAccessibilityWin* node) { 176 BrowserAccessibilityWin* node) {
158 if (tracked_scroll_object_) 177 if (tracked_scroll_object_)
159 tracked_scroll_object_->Release(); 178 tracked_scroll_object_->Release();
160 tracked_scroll_object_ = node; 179 tracked_scroll_object_ = node;
161 tracked_scroll_object_->AddRef(); 180 tracked_scroll_object_->AddRef();
162 } 181 }
163 182
183 BrowserAccessibilityWin* BrowserAccessibilityManagerWin::GetFromUniqueIdWin(
184 LONG unique_id_win) {
185 base::hash_map<LONG, int32>::iterator iter =
186 unique_id_to_renderer_id_map_.find(unique_id_win);
187 if (iter != unique_id_to_renderer_id_map_.end()) {
188 BrowserAccessibility* result = GetFromRendererID(iter->second);
189 if (result)
190 return result->ToBrowserAccessibilityWin();
191 }
192 return NULL;
193 }
194
164 } // namespace content 195 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698