OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/views/controls/tree/tree_view_views.h" | 5 #include "ui/views/controls/tree/tree_view_views.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/i18n/rtl.h" | 9 #include "base/i18n/rtl.h" |
10 #include "base/message_loop.h" | 10 #include "base/message_loop.h" |
(...skipping 373 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
384 return; | 384 return; |
385 bool reset_selection = false; | 385 bool reset_selection = false; |
386 for (int i = 0; i < count; ++i) { | 386 for (int i = 0; i < count; ++i) { |
387 InternalNode* child_removing = parent_node->GetChild(start); | 387 InternalNode* child_removing = parent_node->GetChild(start); |
388 if (selected_node_ && selected_node_->HasAncestor(child_removing)) | 388 if (selected_node_ && selected_node_->HasAncestor(child_removing)) |
389 reset_selection = true; | 389 reset_selection = true; |
390 delete parent_node->Remove(child_removing); | 390 delete parent_node->Remove(child_removing); |
391 } | 391 } |
392 if (reset_selection) { | 392 if (reset_selection) { |
393 // selected_node_ is no longer valid (at the time we enter this function | 393 // selected_node_ is no longer valid (at the time we enter this function |
394 // it's model_node() is likely deleted). Explicitly NULL out the field | 394 // its model_node() is likely deleted). Explicitly NULL out the field |
395 // rather than invoking SetSelectedNode() otherwise, we'll try and use a | 395 // rather than invoking SetSelectedNode() otherwise, we'll try and use a |
396 // deleted value. | 396 // deleted value. |
397 selected_node_ = NULL; | 397 selected_node_ = NULL; |
398 TreeModelNode* to_select = parent; | 398 TreeModelNode* to_select = parent; |
399 if (parent == root_.model_node() && !root_shown_) { | 399 if (parent == root_.model_node() && !root_shown_) { |
400 to_select = model_->GetChildCount(parent) > 0 ? | 400 to_select = model_->GetChildCount(parent) > 0 ? |
401 model_->GetChild(parent, 0) : NULL; | 401 model_->GetChild(parent, 0) : NULL; |
402 } | 402 } |
403 SetSelectedNode(to_select); | 403 SetSelectedNode(to_select); |
404 } | 404 } |
(...skipping 496 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
901 if (!is_expanded_) | 901 if (!is_expanded_) |
902 return max_width; | 902 return max_width; |
903 for (int i = 0; i < child_count(); ++i) { | 903 for (int i = 0; i < child_count(); ++i) { |
904 max_width = std::max(max_width, | 904 max_width = std::max(max_width, |
905 GetChild(i)->GetMaxWidth(indent, depth + 1)); | 905 GetChild(i)->GetMaxWidth(indent, depth + 1)); |
906 } | 906 } |
907 return max_width; | 907 return max_width; |
908 } | 908 } |
909 | 909 |
910 } // namespace views | 910 } // namespace views |
OLD | NEW |