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); | |
122 // Make sure we don't overwrite a newer entry (see UpdateNode for a possible | 119 // Make sure we don't overwrite a newer entry (see UpdateNode for a possible |
123 // corner case). | 120 // corner case). |
124 if (renderer_id_to_child_id_map_[renderer_id] == child_id) | 121 if (renderer_id_to_child_id_map_[renderer_id] == child_id) |
125 renderer_id_to_child_id_map_.erase(renderer_id); | 122 renderer_id_to_child_id_map_.erase(renderer_id); |
126 } | 123 } |
127 | 124 |
128 void BrowserAccessibilityManager::OnAccessibilityNotifications( | 125 void BrowserAccessibilityManager::OnAccessibilityNotifications( |
129 const std::vector<ViewHostMsg_AccessibilityNotification_Params>& params) { | 126 const std::vector<ViewHostMsg_AccessibilityNotification_Params>& params) { |
130 for (uint32 index = 0; index < params.size(); index++) { | 127 for (uint32 index = 0; index < params.size(); index++) { |
131 const ViewHostMsg_AccessibilityNotification_Params& param = params[index]; | 128 const ViewHostMsg_AccessibilityNotification_Params& param = params[index]; |
(...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
387 if ((src.state >> WebAccessibility::STATE_FOCUSED) & 1) | 384 if ((src.state >> WebAccessibility::STATE_FOCUSED) & 1) |
388 SetFocus(instance, false); | 385 SetFocus(instance, false); |
389 for (int i = 0; i < static_cast<int>(src.children.size()); ++i) { | 386 for (int i = 0; i < static_cast<int>(src.children.size()); ++i) { |
390 BrowserAccessibility* child = CreateAccessibilityTree( | 387 BrowserAccessibility* child = CreateAccessibilityTree( |
391 instance, src.children[i], i); | 388 instance, src.children[i], i); |
392 instance->AddChild(child); | 389 instance->AddChild(child); |
393 } | 390 } |
394 | 391 |
395 return instance; | 392 return instance; |
396 } | 393 } |
OLD | NEW |