| OLD | NEW |
| 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 489 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 bb_model_->client()->CanBeEditedByUser(child_bb_node)) { |
| 511 EditorNode* new_b_node = new EditorNode(child_bb_node->GetTitle(), | 512 EditorNode* new_b_node = new EditorNode(child_bb_node->GetTitle(), |
| 512 child_bb_node->id()); | 513 child_bb_node->id()); |
| 513 b_node->Add(new_b_node, b_node->child_count()); | 514 b_node->Add(new_b_node, b_node->child_count()); |
| 514 CreateNodes(child_bb_node, new_b_node); | 515 CreateNodes(child_bb_node, new_b_node); |
| 515 } | 516 } |
| 516 } | 517 } |
| 517 } | 518 } |
| 518 | 519 |
| 519 BookmarkEditorView::EditorNode* BookmarkEditorView::FindNodeWithID( | 520 BookmarkEditorView::EditorNode* BookmarkEditorView::FindNodeWithID( |
| 520 BookmarkEditorView::EditorNode* node, | 521 BookmarkEditorView::EditorNode* node, |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 635 } | 636 } |
| 636 return context_menu_model_.get(); | 637 return context_menu_model_.get(); |
| 637 } | 638 } |
| 638 | 639 |
| 639 void BookmarkEditorView::EditorTreeModel::SetTitle( | 640 void BookmarkEditorView::EditorTreeModel::SetTitle( |
| 640 ui::TreeModelNode* node, | 641 ui::TreeModelNode* node, |
| 641 const base::string16& title) { | 642 const base::string16& title) { |
| 642 if (!title.empty()) | 643 if (!title.empty()) |
| 643 ui::TreeNodeModel<EditorNode>::SetTitle(node, title); | 644 ui::TreeNodeModel<EditorNode>::SetTitle(node, title); |
| 644 } | 645 } |
| OLD | NEW |