OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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.h" | 5 #include "content/browser/accessibility/browser_accessibility_manager.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "content/browser/accessibility/browser_accessibility.h" | 8 #include "content/browser/accessibility/browser_accessibility.h" |
9 #include "content/common/view_messages.h" | 9 #include "content/common/view_messages.h" |
10 | 10 |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
109 renderer_id_to_child_id_map_.find(renderer_id); | 109 renderer_id_to_child_id_map_.find(renderer_id); |
110 if (iter == renderer_id_to_child_id_map_.end()) | 110 if (iter == renderer_id_to_child_id_map_.end()) |
111 return NULL; | 111 return NULL; |
112 | 112 |
113 int32 child_id = iter->second; | 113 int32 child_id = iter->second; |
114 return GetFromChildID(child_id); | 114 return GetFromChildID(child_id); |
115 } | 115 } |
116 | 116 |
117 void BrowserAccessibilityManager::Remove(int32 child_id, int32 renderer_id) { | 117 void BrowserAccessibilityManager::Remove(int32 child_id, int32 renderer_id) { |
118 child_id_map_.erase(child_id); | 118 child_id_map_.erase(child_id); |
| 119 |
| 120 // TODO(ctguil): Investigate if hit. We should never have a newer entry. |
| 121 DCHECK(renderer_id_to_child_id_map_[renderer_id] == child_id); |
119 // Make sure we don't overwrite a newer entry (see UpdateNode for a possible | 122 // Make sure we don't overwrite a newer entry (see UpdateNode for a possible |
120 // corner case). | 123 // corner case). |
121 if (renderer_id_to_child_id_map_[renderer_id] == child_id) | 124 if (renderer_id_to_child_id_map_[renderer_id] == child_id) |
122 renderer_id_to_child_id_map_.erase(renderer_id); | 125 renderer_id_to_child_id_map_.erase(renderer_id); |
123 } | 126 } |
124 | 127 |
125 void BrowserAccessibilityManager::OnAccessibilityNotifications( | 128 void BrowserAccessibilityManager::OnAccessibilityNotifications( |
126 const std::vector<ViewHostMsg_AccessibilityNotification_Params>& params) { | 129 const std::vector<ViewHostMsg_AccessibilityNotification_Params>& params) { |
127 for (uint32 index = 0; index < params.size(); index++) { | 130 for (uint32 index = 0; index < params.size(); index++) { |
128 const ViewHostMsg_AccessibilityNotification_Params& param = params[index]; | 131 const ViewHostMsg_AccessibilityNotification_Params& param = params[index]; |
(...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
384 if ((src.state >> WebAccessibility::STATE_FOCUSED) & 1) | 387 if ((src.state >> WebAccessibility::STATE_FOCUSED) & 1) |
385 SetFocus(instance, false); | 388 SetFocus(instance, false); |
386 for (int i = 0; i < static_cast<int>(src.children.size()); ++i) { | 389 for (int i = 0; i < static_cast<int>(src.children.size()); ++i) { |
387 BrowserAccessibility* child = CreateAccessibilityTree( | 390 BrowserAccessibility* child = CreateAccessibilityTree( |
388 instance, src.children[i], i); | 391 instance, src.children[i], i); |
389 instance->AddChild(child); | 392 instance->AddChild(child); |
390 } | 393 } |
391 | 394 |
392 return instance; | 395 return instance; |
393 } | 396 } |
OLD | NEW |