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

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

Issue 6931018: Initial implementation of "Synced Bookmarks" folder. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Merge Created 9 years, 7 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
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/ui/views/bookmarks/bookmark_editor_view.h" 5 #include "chrome/browser/ui/views/bookmarks/bookmark_editor_view.h"
6 6
7 #include "base/basictypes.h" 7 #include "base/basictypes.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/string_util.h" 9 #include "base/string_util.h"
10 #include "base/utf_string_conversions.h" 10 #include "base/utf_string_conversions.h"
(...skipping 467 matching lines...) Expand 10 before | Expand all | Expand 10 after
478 if (!b_node) 478 if (!b_node)
479 b_node = tree_model_->GetRoot()->GetChild(0); // Bookmark bar node. 479 b_node = tree_model_->GetRoot()->GetChild(0); // Bookmark bar node.
480 480
481 tree_view_->SetSelectedNode(b_node); 481 tree_view_->SetSelectedNode(b_node);
482 } 482 }
483 483
484 BookmarkEditorView::EditorNode* BookmarkEditorView::CreateRootNode() { 484 BookmarkEditorView::EditorNode* BookmarkEditorView::CreateRootNode() {
485 EditorNode* root_node = new EditorNode(std::wstring(), 0); 485 EditorNode* root_node = new EditorNode(std::wstring(), 0);
486 const BookmarkNode* bb_root_node = bb_model_->root_node(); 486 const BookmarkNode* bb_root_node = bb_model_->root_node();
487 CreateNodes(bb_root_node, root_node); 487 CreateNodes(bb_root_node, root_node);
488 DCHECK(root_node->child_count() == 2); 488 DCHECK(root_node->child_count() == 3);
489 DCHECK(bb_root_node->GetChild(0)->type() == BookmarkNode::BOOKMARK_BAR); 489 DCHECK(bb_root_node->GetChild(0)->type() == BookmarkNode::BOOKMARK_BAR);
490 DCHECK(bb_root_node->GetChild(1)->type() == BookmarkNode::OTHER_NODE); 490 DCHECK(bb_root_node->GetChild(1)->type() == BookmarkNode::OTHER_NODE);
491 DCHECK(bb_root_node->GetChild(2)->type() == BookmarkNode::SYNCED);
491 return root_node; 492 return root_node;
492 } 493 }
493 494
494 void BookmarkEditorView::CreateNodes(const BookmarkNode* bb_node, 495 void BookmarkEditorView::CreateNodes(const BookmarkNode* bb_node,
495 BookmarkEditorView::EditorNode* b_node) { 496 BookmarkEditorView::EditorNode* b_node) {
496 for (int i = 0; i < bb_node->child_count(); ++i) { 497 for (int i = 0; i < bb_node->child_count(); ++i) {
497 const BookmarkNode* child_bb_node = bb_node->GetChild(i); 498 const BookmarkNode* child_bb_node = bb_node->GetChild(i);
498 if (child_bb_node->is_folder()) { 499 if (child_bb_node->is_folder()) {
499 EditorNode* new_b_node = 500 EditorNode* new_b_node =
500 new EditorNode(WideToUTF16(child_bb_node->GetTitle()), 501 new EditorNode(WideToUTF16(child_bb_node->GetTitle()),
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
580 break; 581 break;
581 } 582 }
582 } 583 }
583 DCHECK(child_bb_node); 584 DCHECK(child_bb_node);
584 bb_model_->SetTitle(child_bb_node, child_b_node->GetTitle()); 585 bb_model_->SetTitle(child_bb_node, child_b_node->GetTitle());
585 } 586 }
586 ApplyNameChangesAndCreateNewFolders(child_bb_node, child_b_node, 587 ApplyNameChangesAndCreateNewFolders(child_bb_node, child_b_node,
587 parent_b_node, parent_bb_node); 588 parent_b_node, parent_bb_node);
588 } 589 }
589 } 590 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698