| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 "chrome/browser/views/bookmark_editor_view.h" | 5 #include "chrome/browser/views/bookmark_editor_view.h" |
| 6 | 6 |
| 7 #include "app/l10n_util.h" | 7 #include "app/l10n_util.h" |
| 8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/string_util.h" | 10 #include "base/string_util.h" |
| (...skipping 423 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 434 new_node->value = 0; | 434 new_node->value = 0; |
| 435 // new_node is now owned by parent. | 435 // new_node is now owned by parent. |
| 436 tree_model_->Add(parent, parent->GetChildCount(), new_node); | 436 tree_model_->Add(parent, parent->GetChildCount(), new_node); |
| 437 return new_node; | 437 return new_node; |
| 438 } | 438 } |
| 439 | 439 |
| 440 void BookmarkEditorView::ExpandAndSelect() { | 440 void BookmarkEditorView::ExpandAndSelect() { |
| 441 tree_view_->ExpandAll(); | 441 tree_view_->ExpandAll(); |
| 442 | 442 |
| 443 const BookmarkNode* to_select = node_ ? node_->GetParent() : parent_; | 443 const BookmarkNode* to_select = node_ ? node_->GetParent() : parent_; |
| 444 int group_id_to_select = to_select->id(); | 444 int64 group_id_to_select = to_select->id(); |
| 445 DCHECK(group_id_to_select); // GetMostRecentParent should never return NULL. | 445 DCHECK(group_id_to_select); // GetMostRecentParent should never return NULL. |
| 446 EditorNode* b_node = | 446 EditorNode* b_node = |
| 447 FindNodeWithID(tree_model_->GetRoot(), group_id_to_select); | 447 FindNodeWithID(tree_model_->GetRoot(), group_id_to_select); |
| 448 if (!b_node) | 448 if (!b_node) |
| 449 b_node = tree_model_->GetRoot()->GetChild(0); // Bookmark bar node. | 449 b_node = tree_model_->GetRoot()->GetChild(0); // Bookmark bar node. |
| 450 | 450 |
| 451 tree_view_->SetSelectedNode(b_node); | 451 tree_view_->SetSelectedNode(b_node); |
| 452 } | 452 } |
| 453 | 453 |
| 454 BookmarkEditorView::EditorNode* BookmarkEditorView::CreateRootNode() { | 454 BookmarkEditorView::EditorNode* BookmarkEditorView::CreateRootNode() { |
| (...skipping 15 matching lines...) Expand all Loading... |
| 470 EditorNode* new_b_node = new EditorNode(child_bb_node->GetTitle(), | 470 EditorNode* new_b_node = new EditorNode(child_bb_node->GetTitle(), |
| 471 child_bb_node->id()); | 471 child_bb_node->id()); |
| 472 b_node->Add(b_node->GetChildCount(), new_b_node); | 472 b_node->Add(b_node->GetChildCount(), new_b_node); |
| 473 CreateNodes(child_bb_node, new_b_node); | 473 CreateNodes(child_bb_node, new_b_node); |
| 474 } | 474 } |
| 475 } | 475 } |
| 476 } | 476 } |
| 477 | 477 |
| 478 BookmarkEditorView::EditorNode* BookmarkEditorView::FindNodeWithID( | 478 BookmarkEditorView::EditorNode* BookmarkEditorView::FindNodeWithID( |
| 479 BookmarkEditorView::EditorNode* node, | 479 BookmarkEditorView::EditorNode* node, |
| 480 int id) { | 480 int64 id) { |
| 481 if (node->value == id) | 481 if (node->value == id) |
| 482 return node; | 482 return node; |
| 483 for (int i = 0; i < node->GetChildCount(); ++i) { | 483 for (int i = 0; i < node->GetChildCount(); ++i) { |
| 484 EditorNode* result = FindNodeWithID(node->GetChild(i), id); | 484 EditorNode* result = FindNodeWithID(node->GetChild(i), id); |
| 485 if (result) | 485 if (result) |
| 486 return result; | 486 return result; |
| 487 } | 487 } |
| 488 return NULL; | 488 return NULL; |
| 489 } | 489 } |
| 490 | 490 |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 550 break; | 550 break; |
| 551 } | 551 } |
| 552 } | 552 } |
| 553 DCHECK(child_bb_node); | 553 DCHECK(child_bb_node); |
| 554 bb_model_->SetTitle(child_bb_node, child_b_node->GetTitle()); | 554 bb_model_->SetTitle(child_bb_node, child_b_node->GetTitle()); |
| 555 } | 555 } |
| 556 ApplyNameChangesAndCreateNewGroups(child_bb_node, child_b_node, | 556 ApplyNameChangesAndCreateNewGroups(child_bb_node, child_b_node, |
| 557 parent_b_node, parent_bb_node); | 557 parent_b_node, parent_bb_node); |
| 558 } | 558 } |
| 559 } | 559 } |
| OLD | NEW |