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 303 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
314 instance->UpdateParent(parent, index_in_parent); | 314 instance->UpdateParent(parent, index_in_parent); |
315 instance->InternalAddReference(); | 315 instance->InternalAddReference(); |
316 send_show_events = false; | 316 send_show_events = false; |
317 } else { | 317 } else { |
318 // Otherwise, create a new instance. | 318 // Otherwise, create a new instance. |
319 instance = factory_->Create(); | 319 instance = factory_->Create(); |
320 child_id = GetNextChildID(); | 320 child_id = GetNextChildID(); |
321 children_can_send_show_events = false; | 321 children_can_send_show_events = false; |
322 } | 322 } |
323 | 323 |
| 324 for (int i = 0; i < static_cast<int>(src.children.size()); ++i) { |
| 325 BrowserAccessibility* child = CreateAccessibilityTree( |
| 326 instance, src.children[i], i, children_can_send_show_events); |
| 327 instance->AddChild(child); |
| 328 } |
| 329 |
324 instance->Initialize(this, parent, child_id, index_in_parent, src); | 330 instance->Initialize(this, parent, child_id, index_in_parent, src); |
325 child_id_map_[child_id] = instance; | 331 child_id_map_[child_id] = instance; |
326 renderer_id_to_child_id_map_[src.id] = child_id; | 332 renderer_id_to_child_id_map_[src.id] = child_id; |
327 | 333 |
328 if (src.role == WebAccessibility::ROLE_ROOT_WEB_AREA) | 334 if (src.role == WebAccessibility::ROLE_ROOT_WEB_AREA) |
329 root_ = instance; | 335 root_ = instance; |
330 | 336 |
331 if ((src.state >> WebAccessibility::STATE_FOCUSED) & 1) | 337 if ((src.state >> WebAccessibility::STATE_FOCUSED) & 1) |
332 SetFocus(instance, false); | 338 SetFocus(instance, false); |
333 for (int i = 0; i < static_cast<int>(src.children.size()); ++i) { | |
334 BrowserAccessibility* child = CreateAccessibilityTree( | |
335 instance, src.children[i], i, children_can_send_show_events); | |
336 instance->AddChild(child); | |
337 } | |
338 | 339 |
339 // Note: the purpose of send_show_events and children_can_send_show_events | 340 // Note: the purpose of send_show_events and children_can_send_show_events |
340 // is so that we send a single OBJECT_SHOW event for the root of a subtree | 341 // is so that we send a single OBJECT_SHOW event for the root of a subtree |
341 // that just appeared for the first time, but not on any descendant of | 342 // that just appeared for the first time, but not on any descendant of |
342 // that subtree. | 343 // that subtree. |
343 if (send_show_events) | 344 if (send_show_events) |
344 NotifyAccessibilityEvent(ViewHostMsg_AccEvent::OBJECT_SHOW, instance); | 345 NotifyAccessibilityEvent(ViewHostMsg_AccEvent::OBJECT_SHOW, instance); |
345 | 346 |
346 instance->SendNodeUpdateEvents(); | 347 instance->SendNodeUpdateEvents(); |
347 | 348 |
348 return instance; | 349 return instance; |
349 } | 350 } |
OLD | NEW |