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

Side by Side Diff: chrome/browser/bookmarks/bookmark_utils.cc

Issue 6931018: Initial implementation of "Synced Bookmarks" folder. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Fixes for non-linux breakage on trybot 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/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 460 matching lines...) Expand 10 before | Expand all | Expand 10 after
471 if (nodes.size() < max_count) { 471 if (nodes.size() < max_count) {
472 // Add the bookmark bar and other nodes if there is space. 472 // Add the bookmark bar and other nodes if there is space.
473 if (find(nodes.begin(), nodes.end(), model->GetBookmarkBarNode()) == 473 if (find(nodes.begin(), nodes.end(), model->GetBookmarkBarNode()) ==
474 nodes.end()) { 474 nodes.end()) {
475 nodes.push_back(model->GetBookmarkBarNode()); 475 nodes.push_back(model->GetBookmarkBarNode());
476 } 476 }
477 477
478 if (nodes.size() < max_count && 478 if (nodes.size() < max_count &&
479 find(nodes.begin(), nodes.end(), model->other_node()) == nodes.end()) { 479 find(nodes.begin(), nodes.end(), model->other_node()) == nodes.end()) {
480 nodes.push_back(model->other_node()); 480 nodes.push_back(model->other_node());
481
482 if (nodes.size() < max_count &&
483 find(nodes.begin(), nodes.end(),
484 model->synced_node()) == nodes.end()) {
485 nodes.push_back(model->synced_node());
486 if (nodes.size() < max_count &&
487 std::find(nodes.begin(), nodes.end(),
488 model->synced_node()) == nodes.end()) {
489 nodes.push_back(model->synced_node());
490 }
491 }
481 } 492 }
482 } 493 }
483 return nodes; 494 return nodes;
484 } 495 }
485 496
486 void GetMostRecentlyAddedEntries(BookmarkModel* model, 497 void GetMostRecentlyAddedEntries(BookmarkModel* model,
487 size_t count, 498 size_t count,
488 std::vector<const BookmarkNode*>* nodes) { 499 std::vector<const BookmarkNode*>* nodes) {
489 ui::TreeNodeIterator<const BookmarkNode> iterator(model->root_node()); 500 ui::TreeNodeIterator<const BookmarkNode> iterator(model->root_node());
490 while (iterator.has_next()) { 501 while (iterator.has_next()) {
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after
676 return true; 687 return true;
677 688
678 for (int i = 0; i < node->child_count(); ++i) { 689 for (int i = 0; i < node->child_count(); ++i) {
679 if (NodeHasURLs(node->GetChild(i))) 690 if (NodeHasURLs(node->GetChild(i)))
680 return true; 691 return true;
681 } 692 }
682 return false; 693 return false;
683 } 694 }
684 695
685 } // namespace bookmark_utils 696 } // namespace bookmark_utils
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698