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

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

Issue 8914009: Reland 8775059 Support IAccessibleHypertext. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years 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 | Annotate | Revision Log
OLDNEW
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
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 }
81
82 void BrowserAccessibility::Initialize() {
83 instance_active_ = true;
84 } 80 }
85 81
86 void BrowserAccessibility::AddChild(BrowserAccessibility* child) { 82 void BrowserAccessibility::AddChild(BrowserAccessibility* child) {
87 children_.push_back(child); 83 children_.push_back(child);
88 } 84 }
89 85
90 void BrowserAccessibility::UpdateParent(BrowserAccessibility* parent, 86 void BrowserAccessibility::UpdateParent(BrowserAccessibility* parent,
91 int index_in_parent) { 87 int index_in_parent) {
92 parent_ = parent; 88 parent_ = parent;
93 index_in_parent_ = index_in_parent; 89 index_in_parent_ = index_in_parent;
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after
262 ++iter) { 258 ++iter) {
263 (*iter)->InternalReleaseReference(true); 259 (*iter)->InternalReleaseReference(true);
264 } 260 }
265 } 261 }
266 262
267 ref_count_--; 263 ref_count_--;
268 if (ref_count_ == 0) { 264 if (ref_count_ == 0) {
269 // Allow the object to fire a TEXT_REMOVED notification. 265 // Allow the object to fire a TEXT_REMOVED notification.
270 name_.clear(); 266 name_.clear();
271 value_.clear(); 267 value_.clear();
272 SendNodeUpdateEvents(); 268 PostInitialize();
273 269
274 manager_->NotifyAccessibilityEvent( 270 manager_->NotifyAccessibilityEvent(
275 ViewHostMsg_AccEvent::OBJECT_HIDE, this); 271 ViewHostMsg_AccEvent::OBJECT_HIDE, this);
276 272
277 instance_active_ = false; 273 instance_active_ = false;
278 children_.clear(); 274 children_.clear();
279 manager_->Remove(child_id_, renderer_id_); 275 manager_->Remove(child_id_, renderer_id_);
280 NativeReleaseReference(); 276 NativeReleaseReference();
281 } 277 }
282 } 278 }
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
355 string16 BrowserAccessibility::GetTextRecursive() const { 351 string16 BrowserAccessibility::GetTextRecursive() const {
356 if (!name_.empty()) { 352 if (!name_.empty()) {
357 return name_; 353 return name_;
358 } 354 }
359 355
360 string16 result; 356 string16 result;
361 for (size_t i = 0; i < children_.size(); ++i) 357 for (size_t i = 0; i < children_.size(); ++i)
362 result += children_[i]->GetTextRecursive(); 358 result += children_[i]->GetTextRecursive();
363 return result; 359 return result;
364 } 360 }
361
362 void BrowserAccessibility::PreInitialize() {
363 instance_active_ = true;
364 }
OLDNEW
« no previous file with comments | « content/browser/accessibility/browser_accessibility.h ('k') | content/browser/accessibility/browser_accessibility_mac.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698