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

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

Issue 8772064: Adds back BookmarkNode::IsVisible. Turns out we want to conditionally (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Tweaks Created 9 years 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 <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 517 matching lines...) Expand 10 before | Expand all | Expand 10 after
528 if (!b_node) 528 if (!b_node)
529 b_node = tree_model_->GetRoot()->GetChild(0); // Bookmark bar node. 529 b_node = tree_model_->GetRoot()->GetChild(0); // Bookmark bar node.
530 530
531 tree_view_->SetSelectedNode(b_node); 531 tree_view_->SetSelectedNode(b_node);
532 } 532 }
533 533
534 BookmarkEditorView::EditorNode* BookmarkEditorView::CreateRootNode() { 534 BookmarkEditorView::EditorNode* BookmarkEditorView::CreateRootNode() {
535 EditorNode* root_node = new EditorNode(string16(), 0); 535 EditorNode* root_node = new EditorNode(string16(), 0);
536 const BookmarkNode* bb_root_node = bb_model_->root_node(); 536 const BookmarkNode* bb_root_node = bb_model_->root_node();
537 CreateNodes(bb_root_node, root_node); 537 CreateNodes(bb_root_node, root_node);
538 DCHECK_EQ(3, root_node->child_count()); 538 DCHECK(root_node->child_count() >= 2 && root_node->child_count() <= 3);
539 DCHECK(bb_root_node->GetChild(0)->type() == BookmarkNode::BOOKMARK_BAR); 539 DCHECK(bb_root_node->GetChild(0)->type() == BookmarkNode::BOOKMARK_BAR);
540 DCHECK(bb_root_node->GetChild(1)->type() == BookmarkNode::OTHER_NODE); 540 DCHECK(bb_root_node->GetChild(1)->type() == BookmarkNode::OTHER_NODE);
541 DCHECK(bb_root_node->GetChild(2)->type() == BookmarkNode::MOBILE); 541 if (root_node->child_count() == 3)
542 DCHECK(bb_root_node->GetChild(2)->type() == BookmarkNode::MOBILE);
542 return root_node; 543 return root_node;
543 } 544 }
544 545
545 void BookmarkEditorView::CreateNodes(const BookmarkNode* bb_node, 546 void BookmarkEditorView::CreateNodes(const BookmarkNode* bb_node,
546 BookmarkEditorView::EditorNode* b_node) { 547 BookmarkEditorView::EditorNode* b_node) {
547 for (int i = 0; i < bb_node->child_count(); ++i) { 548 for (int i = 0; i < bb_node->child_count(); ++i) {
548 const BookmarkNode* child_bb_node = bb_node->GetChild(i); 549 const BookmarkNode* child_bb_node = bb_node->GetChild(i);
549 if (child_bb_node->is_folder()) { 550 if (child_bb_node->IsVisible() && child_bb_node->is_folder()) {
550 EditorNode* new_b_node = new EditorNode(child_bb_node->GetTitle(), 551 EditorNode* new_b_node = new EditorNode(child_bb_node->GetTitle(),
551 child_bb_node->id()); 552 child_bb_node->id());
552 b_node->Add(new_b_node, b_node->child_count()); 553 b_node->Add(new_b_node, b_node->child_count());
553 CreateNodes(child_bb_node, new_b_node); 554 CreateNodes(child_bb_node, new_b_node);
554 } 555 }
555 } 556 }
556 } 557 }
557 558
558 BookmarkEditorView::EditorNode* BookmarkEditorView::FindNodeWithID( 559 BookmarkEditorView::EditorNode* BookmarkEditorView::FindNodeWithID(
559 BookmarkEditorView::EditorNode* node, 560 BookmarkEditorView::EditorNode* node,
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
651 EditorNode* editor_node, 652 EditorNode* editor_node,
652 BookmarkExpandedStateTracker::Nodes* expanded_nodes) { 653 BookmarkExpandedStateTracker::Nodes* expanded_nodes) {
653 if (!tree_view_->IsExpanded(editor_node)) 654 if (!tree_view_->IsExpanded(editor_node))
654 return; 655 return;
655 656
656 if (editor_node->value != 0) // The root is 0 657 if (editor_node->value != 0) // The root is 0
657 expanded_nodes->insert(bb_model_->GetNodeByID(editor_node->value)); 658 expanded_nodes->insert(bb_model_->GetNodeByID(editor_node->value));
658 for (int i = 0; i < editor_node->child_count(); ++i) 659 for (int i = 0; i < editor_node->child_count(); ++i)
659 UpdateExpandedNodes(editor_node->GetChild(i), expanded_nodes); 660 UpdateExpandedNodes(editor_node->GetChild(i), expanded_nodes);
660 } 661 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698