OLD | NEW |
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 Loading... |
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 Loading... |
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 |
OLD | NEW |