OLD | NEW |
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/bookmarks/bookmark_utils.h" | 5 #include "chrome/browser/bookmarks/bookmark_utils.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
10 #include "base/file_path.h" | 10 #include "base/file_path.h" |
(...skipping 461 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
472 if (nodes.size() < max_count) { | 472 if (nodes.size() < max_count) { |
473 // Add the bookmark bar and other nodes if there is space. | 473 // Add the bookmark bar and other nodes if there is space. |
474 if (find(nodes.begin(), nodes.end(), model->GetBookmarkBarNode()) == | 474 if (find(nodes.begin(), nodes.end(), model->GetBookmarkBarNode()) == |
475 nodes.end()) { | 475 nodes.end()) { |
476 nodes.push_back(model->GetBookmarkBarNode()); | 476 nodes.push_back(model->GetBookmarkBarNode()); |
477 } | 477 } |
478 | 478 |
479 if (nodes.size() < max_count && | 479 if (nodes.size() < max_count && |
480 find(nodes.begin(), nodes.end(), model->other_node()) == nodes.end()) { | 480 find(nodes.begin(), nodes.end(), model->other_node()) == nodes.end()) { |
481 nodes.push_back(model->other_node()); | 481 nodes.push_back(model->other_node()); |
| 482 |
| 483 if (nodes.size() < max_count && |
| 484 find(nodes.begin(), nodes.end(), |
| 485 model->synced_node()) == nodes.end()) { |
| 486 nodes.push_back(model->synced_node()); |
| 487 if (nodes.size() < max_count && |
| 488 std::find(nodes.begin(), nodes.end(), |
| 489 model->synced_node()) == nodes.end()) { |
| 490 nodes.push_back(model->synced_node()); |
| 491 } |
| 492 } |
482 } | 493 } |
483 } | 494 } |
484 return nodes; | 495 return nodes; |
485 } | 496 } |
486 | 497 |
487 void GetMostRecentlyAddedEntries(BookmarkModel* model, | 498 void GetMostRecentlyAddedEntries(BookmarkModel* model, |
488 size_t count, | 499 size_t count, |
489 std::vector<const BookmarkNode*>* nodes) { | 500 std::vector<const BookmarkNode*>* nodes) { |
490 ui::TreeNodeIterator<const BookmarkNode> iterator(model->root_node()); | 501 ui::TreeNodeIterator<const BookmarkNode> iterator(model->root_node()); |
491 while (iterator.has_next()) { | 502 while (iterator.has_next()) { |
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
681 return true; | 692 return true; |
682 | 693 |
683 for (int i = 0; i < node->child_count(); ++i) { | 694 for (int i = 0; i < node->child_count(); ++i) { |
684 if (NodeHasURLs(node->GetChild(i))) | 695 if (NodeHasURLs(node->GetChild(i))) |
685 return true; | 696 return true; |
686 } | 697 } |
687 return false; | 698 return false; |
688 } | 699 } |
689 | 700 |
690 } // namespace bookmark_utils | 701 } // namespace bookmark_utils |
OLD | NEW |