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

Side by Side Diff: ui/accessibility/ax_tree.cc

Issue 1155183006: Reimplement automation API on top of C++-backed AXTree. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@automation_faster_2
Patch Set: Copy observers Created 5 years, 6 months 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
« no previous file with comments | « extensions/renderer/script_context.cc ('k') | ui/accessibility/ax_tree_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "ui/accessibility/ax_tree.h" 5 #include "ui/accessibility/ax_tree.h"
6 6
7 #include <set> 7 #include <set>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/strings/stringprintf.h" 10 #include "base/strings/stringprintf.h"
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after
214 214
215 void AXTree::DestroySubtree(AXNode* node, 215 void AXTree::DestroySubtree(AXNode* node,
216 AXTreeUpdateState* update_state) { 216 AXTreeUpdateState* update_state) {
217 if (delegate_) 217 if (delegate_)
218 delegate_->OnSubtreeWillBeDeleted(this, node); 218 delegate_->OnSubtreeWillBeDeleted(this, node);
219 DestroyNodeAndSubtree(node, update_state); 219 DestroyNodeAndSubtree(node, update_state);
220 } 220 }
221 221
222 void AXTree::DestroyNodeAndSubtree(AXNode* node, 222 void AXTree::DestroyNodeAndSubtree(AXNode* node,
223 AXTreeUpdateState* update_state) { 223 AXTreeUpdateState* update_state) {
224 if (delegate_)
225 delegate_->OnNodeWillBeDeleted(this, node);
224 id_map_.erase(node->id()); 226 id_map_.erase(node->id());
225 for (int i = 0; i < node->child_count(); ++i) 227 for (int i = 0; i < node->child_count(); ++i)
226 DestroyNodeAndSubtree(node->ChildAtIndex(i), update_state); 228 DestroyNodeAndSubtree(node->ChildAtIndex(i), update_state);
227 if (delegate_)
228 delegate_->OnNodeWillBeDeleted(this, node);
229 if (update_state) { 229 if (update_state) {
230 update_state->pending_nodes.erase(node); 230 update_state->pending_nodes.erase(node);
231 } 231 }
232 node->Destroy(); 232 node->Destroy();
233 } 233 }
234 234
235 bool AXTree::DeleteOldChildren(AXNode* node, 235 bool AXTree::DeleteOldChildren(AXNode* node,
236 const std::vector<int32>& new_child_ids, 236 const std::vector<int32>& new_child_ids,
237 AXTreeUpdateState* update_state) { 237 AXTreeUpdateState* update_state) {
238 // Create a set of child ids in |src| for fast lookup, and return false 238 // Create a set of child ids in |src| for fast lookup, and return false
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
286 update_state->pending_nodes.insert(child); 286 update_state->pending_nodes.insert(child);
287 update_state->new_nodes.insert(child); 287 update_state->new_nodes.insert(child);
288 } 288 }
289 new_children->push_back(child); 289 new_children->push_back(child);
290 } 290 }
291 291
292 return success; 292 return success;
293 } 293 }
294 294
295 } // namespace ui 295 } // namespace ui
OLDNEW
« no previous file with comments | « extensions/renderer/script_context.cc ('k') | ui/accessibility/ax_tree_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698