OLD | NEW |
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 Loading... |
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 Loading... |
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 |
OLD | NEW |