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

Side by Side Diff: chrome/browser/views/bookmark_editor_view.cc

Issue 155456: Try the original CL "Always persist bookmark IDs" again with the fix to... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 11 years, 5 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 | Annotate | Revision Log
« no previous file with comments | « chrome/browser/views/bookmark_editor_view.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 425 matching lines...) Expand 10 before | Expand all | Expand 10 after
436 new_node->value = 0; 436 new_node->value = 0;
437 // new_node is now owned by parent. 437 // new_node is now owned by parent.
438 tree_model_->Add(parent, parent->GetChildCount(), new_node); 438 tree_model_->Add(parent, parent->GetChildCount(), new_node);
439 return new_node; 439 return new_node;
440 } 440 }
441 441
442 void BookmarkEditorView::ExpandAndSelect() { 442 void BookmarkEditorView::ExpandAndSelect() {
443 tree_view_->ExpandAll(); 443 tree_view_->ExpandAll();
444 444
445 const BookmarkNode* to_select = node_ ? node_->GetParent() : parent_; 445 const BookmarkNode* to_select = node_ ? node_->GetParent() : parent_;
446 int group_id_to_select = to_select->id(); 446 int64 group_id_to_select = to_select->id();
447 DCHECK(group_id_to_select); // GetMostRecentParent should never return NULL. 447 DCHECK(group_id_to_select); // GetMostRecentParent should never return NULL.
448 EditorNode* b_node = 448 EditorNode* b_node =
449 FindNodeWithID(tree_model_->GetRoot(), group_id_to_select); 449 FindNodeWithID(tree_model_->GetRoot(), group_id_to_select);
450 if (!b_node) 450 if (!b_node)
451 b_node = tree_model_->GetRoot()->GetChild(0); // Bookmark bar node. 451 b_node = tree_model_->GetRoot()->GetChild(0); // Bookmark bar node.
452 452
453 tree_view_->SetSelectedNode(b_node); 453 tree_view_->SetSelectedNode(b_node);
454 } 454 }
455 455
456 BookmarkEditorView::EditorNode* BookmarkEditorView::CreateRootNode() { 456 BookmarkEditorView::EditorNode* BookmarkEditorView::CreateRootNode() {
(...skipping 14 matching lines...) Expand all
471 EditorNode* new_b_node = new EditorNode(child_bb_node->GetTitle(), 471 EditorNode* new_b_node = new EditorNode(child_bb_node->GetTitle(),
472 child_bb_node->id()); 472 child_bb_node->id());
473 b_node->Add(b_node->GetChildCount(), new_b_node); 473 b_node->Add(b_node->GetChildCount(), new_b_node);
474 CreateNodes(child_bb_node, new_b_node); 474 CreateNodes(child_bb_node, new_b_node);
475 } 475 }
476 } 476 }
477 } 477 }
478 478
479 BookmarkEditorView::EditorNode* BookmarkEditorView::FindNodeWithID( 479 BookmarkEditorView::EditorNode* BookmarkEditorView::FindNodeWithID(
480 BookmarkEditorView::EditorNode* node, 480 BookmarkEditorView::EditorNode* node,
481 int id) { 481 int64 id) {
482 if (node->value == id) 482 if (node->value == id)
483 return node; 483 return node;
484 for (int i = 0; i < node->GetChildCount(); ++i) { 484 for (int i = 0; i < node->GetChildCount(); ++i) {
485 EditorNode* result = FindNodeWithID(node->GetChild(i), id); 485 EditorNode* result = FindNodeWithID(node->GetChild(i), id);
486 if (result) 486 if (result)
487 return result; 487 return result;
488 } 488 }
489 return NULL; 489 return NULL;
490 } 490 }
491 491
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
551 break; 551 break;
552 } 552 }
553 } 553 }
554 DCHECK(child_bb_node); 554 DCHECK(child_bb_node);
555 bb_model_->SetTitle(child_bb_node, child_b_node->GetTitle()); 555 bb_model_->SetTitle(child_bb_node, child_b_node->GetTitle());
556 } 556 }
557 ApplyNameChangesAndCreateNewGroups(child_bb_node, child_b_node, 557 ApplyNameChangesAndCreateNewGroups(child_bb_node, child_b_node,
558 parent_b_node, parent_bb_node); 558 parent_b_node, parent_bb_node);
559 } 559 }
560 } 560 }
OLDNEW
« no previous file with comments | « chrome/browser/views/bookmark_editor_view.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698