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

Side by Side Diff: components/enhanced_bookmarks/enhanced_bookmark_utils.cc

Issue 912503002: ★ Change the order of the permanent nodes. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 10 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "components/enhanced_bookmarks/enhanced_bookmark_utils.h" 5 #include "components/enhanced_bookmarks/enhanced_bookmark_utils.h"
6 6
7 #include "base/i18n/string_compare.h" 7 #include "base/i18n/string_compare.h"
8 #include "components/bookmarks/browser/bookmark_model.h" 8 #include "components/bookmarks/browser/bookmark_model.h"
9 9
10 using bookmarks::BookmarkModel; 10 using bookmarks::BookmarkModel;
(...skipping 27 matching lines...) Expand all
38 UErrorCode error = U_ZERO_ERROR; 38 UErrorCode error = U_ZERO_ERROR;
39 scoped_ptr<icu::Collator> collator(icu::Collator::createInstance(error)); 39 scoped_ptr<icu::Collator> collator(icu::Collator::createInstance(error));
40 if (U_FAILURE(error)) 40 if (U_FAILURE(error))
41 collator.reset(NULL); 41 collator.reset(NULL);
42 std::sort(nodes.begin(), nodes.end(), BookmarkNameComparator(collator.get())); 42 std::sort(nodes.begin(), nodes.end(), BookmarkNameComparator(collator.get()));
43 } 43 }
44 44
45 std::vector<const BookmarkNode*> PrimaryPermanentNodes(BookmarkModel* model) { 45 std::vector<const BookmarkNode*> PrimaryPermanentNodes(BookmarkModel* model) {
46 DCHECK(model->loaded()); 46 DCHECK(model->loaded());
47 std::vector<const BookmarkNode*> nodes; 47 std::vector<const BookmarkNode*> nodes;
48 nodes.push_back(model->other_node());
49 nodes.push_back(model->mobile_node()); 48 nodes.push_back(model->mobile_node());
50 nodes.push_back(model->bookmark_bar_node()); 49 nodes.push_back(model->bookmark_bar_node());
50 nodes.push_back(model->other_node());
51 return nodes; 51 return nodes;
52 } 52 }
53 53
54 std::vector<const BookmarkNode*> RootLevelFolders(BookmarkModel* model) { 54 std::vector<const BookmarkNode*> RootLevelFolders(BookmarkModel* model) {
55 std::vector<const BookmarkNode*> root_level_folders; 55 std::vector<const BookmarkNode*> root_level_folders;
56 56
57 // Find the direct folder children of the primary permanent nodes. 57 // Find the direct folder children of the primary permanent nodes.
58 std::vector<const BookmarkNode*> primary_permanent_nodes = 58 std::vector<const BookmarkNode*> primary_permanent_nodes =
59 PrimaryPermanentNodes(model); 59 PrimaryPermanentNodes(model);
60 for (const BookmarkNode* parent : primary_permanent_nodes) { 60 for (const BookmarkNode* parent : primary_permanent_nodes) {
(...skipping 27 matching lines...) Expand all
88 const BookmarkNode* top = node; 88 const BookmarkNode* top = node;
89 while (top && 89 while (top &&
90 std::find(root_folders.begin(), root_folders.end(), top) == 90 std::find(root_folders.begin(), root_folders.end(), top) ==
91 root_folders.end()) { 91 root_folders.end()) {
92 top = top->parent(); 92 top = top->parent();
93 } 93 }
94 return top; 94 return top;
95 } 95 }
96 96
97 } // namespace enhanced_bookmarks 97 } // namespace enhanced_bookmarks
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698