Chromium Code Reviews| 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.h" | 5 #include "content/browser/accessibility/browser_accessibility.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/string_number_conversions.h" | 8 #include "base/string_number_conversions.h" |
| 9 #include "base/string_util.h" | 9 #include "base/string_util.h" |
| 10 #include "content/browser/accessibility/browser_accessibility_manager.h" | 10 #include "content/browser/accessibility/browser_accessibility_manager.h" |
| (...skipping 30 matching lines...) Expand all Loading... | |
| 41 | 41 |
| 42 void BrowserAccessibility::DetachTree( | 42 void BrowserAccessibility::DetachTree( |
| 43 std::vector<BrowserAccessibility*>* nodes) { | 43 std::vector<BrowserAccessibility*>* nodes) { |
| 44 nodes->push_back(this); | 44 nodes->push_back(this); |
| 45 for (size_t i = 0; i < children_.size(); i++) | 45 for (size_t i = 0; i < children_.size(); i++) |
| 46 children_[i]->DetachTree(nodes); | 46 children_[i]->DetachTree(nodes); |
| 47 children_.clear(); | 47 children_.clear(); |
| 48 parent_ = NULL; | 48 parent_ = NULL; |
| 49 } | 49 } |
| 50 | 50 |
| 51 void BrowserAccessibility::Initialize( | 51 void BrowserAccessibility::PreInitialize( |
| 52 BrowserAccessibilityManager* manager, | 52 BrowserAccessibilityManager* manager, |
| 53 BrowserAccessibility* parent, | 53 BrowserAccessibility* parent, |
| 54 int32 child_id, | 54 int32 child_id, |
| 55 int32 index_in_parent, | 55 int32 index_in_parent, |
| 56 const webkit_glue::WebAccessibility& src) { | 56 const webkit_glue::WebAccessibility& src) { |
| 57 manager_ = manager; | 57 manager_ = manager; |
| 58 parent_ = parent; | 58 parent_ = parent; |
| 59 child_id_ = child_id; | 59 child_id_ = child_id; |
| 60 index_in_parent_ = index_in_parent; | 60 index_in_parent_ = index_in_parent; |
| 61 | 61 |
| 62 // Update all of the rest of the attributes. | 62 // Update all of the rest of the attributes. |
| 63 name_ = src.name; | 63 name_ = src.name; |
| 64 value_ = src.value; | 64 value_ = src.value; |
| 65 role_ = src.role; | 65 role_ = src.role; |
| 66 state_ = src.state; | 66 state_ = src.state; |
| 67 renderer_id_ = src.id; | 67 renderer_id_ = src.id; |
| 68 string_attributes_ = src.string_attributes; | 68 string_attributes_ = src.string_attributes; |
| 69 int_attributes_ = src.int_attributes; | 69 int_attributes_ = src.int_attributes; |
| 70 float_attributes_ = src.float_attributes; | 70 float_attributes_ = src.float_attributes; |
| 71 bool_attributes_ = src.bool_attributes; | 71 bool_attributes_ = src.bool_attributes; |
| 72 html_attributes_ = src.html_attributes; | 72 html_attributes_ = src.html_attributes; |
| 73 location_ = src.location; | 73 location_ = src.location; |
| 74 indirect_child_ids_ = src.indirect_child_ids; | 74 indirect_child_ids_ = src.indirect_child_ids; |
| 75 line_breaks_ = src.line_breaks; | 75 line_breaks_ = src.line_breaks; |
| 76 cell_ids_ = src.cell_ids; | 76 cell_ids_ = src.cell_ids; |
| 77 unique_cell_ids_ = src.unique_cell_ids; | 77 unique_cell_ids_ = src.unique_cell_ids; |
| 78 | 78 |
| 79 Initialize(); | 79 PreInitialize(); |
| 80 } | 80 } |
| 81 | 81 |
| 82 void BrowserAccessibility::Initialize() { | 82 void BrowserAccessibility::PostInitialize( |
| 83 BrowserAccessibilityManager* manager, | |
| 84 BrowserAccessibility* parent, | |
| 85 int32 child_id, | |
| 86 int32 index_in_parent, | |
| 87 const webkit_glue::WebAccessibility& src) { | |
| 88 PostInitialize(); | |
| 89 } | |
| 90 | |
| 91 void BrowserAccessibility::PreInitialize() { | |
| 83 instance_active_ = true; | 92 instance_active_ = true; |
| 84 } | 93 } |
| 85 | 94 |
| 95 void BrowserAccessibility::PostInitialize() { | |
| 96 instance_active_ = true; | |
|
dmazzoni
2011/12/02 23:33:42
You shouldn't need to do this in PostInitialize.
David Tseng
2011/12/03 00:17:13
Done.
| |
| 97 } | |
| 98 | |
| 86 void BrowserAccessibility::AddChild(BrowserAccessibility* child) { | 99 void BrowserAccessibility::AddChild(BrowserAccessibility* child) { |
| 87 children_.push_back(child); | 100 children_.push_back(child); |
| 88 } | 101 } |
| 89 | 102 |
| 90 void BrowserAccessibility::UpdateParent(BrowserAccessibility* parent, | 103 void BrowserAccessibility::UpdateParent(BrowserAccessibility* parent, |
| 91 int index_in_parent) { | 104 int index_in_parent) { |
| 92 parent_ = parent; | 105 parent_ = parent; |
| 93 index_in_parent_ = index_in_parent; | 106 index_in_parent_ = index_in_parent; |
| 94 } | 107 } |
| 95 | 108 |
| (...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 260 if (!name_.empty()) { | 273 if (!name_.empty()) { |
| 261 return name_; | 274 return name_; |
| 262 } | 275 } |
| 263 | 276 |
| 264 string16 result; | 277 string16 result; |
| 265 for (size_t i = 0; i < children_.size(); ++i) | 278 for (size_t i = 0; i < children_.size(); ++i) |
| 266 result += children_[i]->GetTextRecursive(); | 279 result += children_[i]->GetTextRecursive(); |
| 267 return result; | 280 return result; |
| 268 } | 281 } |
| 269 | 282 |
| OLD | NEW |