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

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

Issue 319543003: Create the managed_node at the ChromeBookmarkClient. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 6 years, 6 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) 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 "chrome/browser/ui/views/bookmarks/bookmark_editor_view.h" 5 #include "chrome/browser/ui/views/bookmarks/bookmark_editor_view.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/basictypes.h" 9 #include "base/basictypes.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 477 matching lines...) Expand 10 before | Expand all | Expand 10 after
488 if (!b_node) 488 if (!b_node)
489 b_node = tree_model_->GetRoot()->GetChild(0); // Bookmark bar node. 489 b_node = tree_model_->GetRoot()->GetChild(0); // Bookmark bar node.
490 490
491 tree_view_->SetSelectedNode(b_node); 491 tree_view_->SetSelectedNode(b_node);
492 } 492 }
493 493
494 BookmarkEditorView::EditorNode* BookmarkEditorView::CreateRootNode() { 494 BookmarkEditorView::EditorNode* BookmarkEditorView::CreateRootNode() {
495 EditorNode* root_node = new EditorNode(base::string16(), 0); 495 EditorNode* root_node = new EditorNode(base::string16(), 0);
496 const BookmarkNode* bb_root_node = bb_model_->root_node(); 496 const BookmarkNode* bb_root_node = bb_model_->root_node();
497 CreateNodes(bb_root_node, root_node); 497 CreateNodes(bb_root_node, root_node);
498 DCHECK(root_node->child_count() >= 2 && root_node->child_count() <= 3); 498 DCHECK(root_node->child_count() >= 2 && root_node->child_count() <= 4);
499 DCHECK_EQ(BookmarkNode::BOOKMARK_BAR, bb_root_node->GetChild(0)->type()); 499 DCHECK_EQ(BookmarkNode::BOOKMARK_BAR, bb_root_node->GetChild(0)->type());
500 DCHECK_EQ(BookmarkNode::OTHER_NODE, bb_root_node->GetChild(1)->type()); 500 DCHECK_EQ(BookmarkNode::OTHER_NODE, bb_root_node->GetChild(1)->type());
501 if (root_node->child_count() == 3) 501 if (root_node->child_count() >= 3)
502 DCHECK_EQ(BookmarkNode::MOBILE, bb_root_node->GetChild(2)->type()); 502 DCHECK_EQ(BookmarkNode::MOBILE, bb_root_node->GetChild(2)->type());
503 return root_node; 503 return root_node;
504 } 504 }
505 505
506 void BookmarkEditorView::CreateNodes(const BookmarkNode* bb_node, 506 void BookmarkEditorView::CreateNodes(const BookmarkNode* bb_node,
507 BookmarkEditorView::EditorNode* b_node) { 507 BookmarkEditorView::EditorNode* b_node) {
508 for (int i = 0; i < bb_node->child_count(); ++i) { 508 for (int i = 0; i < bb_node->child_count(); ++i) {
509 const BookmarkNode* child_bb_node = bb_node->GetChild(i); 509 const BookmarkNode* child_bb_node = bb_node->GetChild(i);
510 if (child_bb_node->IsVisible() && child_bb_node->is_folder()) { 510 if (child_bb_node->IsVisible() && child_bb_node->is_folder()) {
511 EditorNode* new_b_node = new EditorNode(child_bb_node->GetTitle(), 511 EditorNode* new_b_node = new EditorNode(child_bb_node->GetTitle(),
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
635 } 635 }
636 return context_menu_model_.get(); 636 return context_menu_model_.get();
637 } 637 }
638 638
639 void BookmarkEditorView::EditorTreeModel::SetTitle( 639 void BookmarkEditorView::EditorTreeModel::SetTitle(
640 ui::TreeModelNode* node, 640 ui::TreeModelNode* node,
641 const base::string16& title) { 641 const base::string16& title) {
642 if (!title.empty()) 642 if (!title.empty())
643 ui::TreeNodeModel<EditorNode>::SetTitle(node, title); 643 ui::TreeNodeModel<EditorNode>::SetTitle(node, title);
644 } 644 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/bookmarks/bookmark_context_menu_controller_unittest.cc ('k') | chrome/chrome_tests_unit.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698