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

Side by Side Diff: components/ntp_snippets/bookmarks/bookmark_last_visit_utils.cc

Issue 2305583002: Do not select old bookmarks in ntp_snippets::BookmarkSuggestionsProvider (Closed)
Patch Set: Marc's comments. Created 4 years, 3 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
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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/ntp_snippets/bookmarks/bookmark_last_visit_utils.h" 5 #include "components/ntp_snippets/bookmarks/bookmark_last_visit_utils.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <string> 8 #include <string>
9 #include <utility> 9 #include <utility>
10 10
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
180 std::sort(bookmarks.begin(), bookmarks.end(), 180 std::sort(bookmarks.begin(), bookmarks.end(),
181 [creation_date_fallback](const RecentBookmark& a, 181 [creation_date_fallback](const RecentBookmark& a,
182 const RecentBookmark& b) { 182 const RecentBookmark& b) {
183 return CompareBookmarksByLastVisitDate(a.node, b.node, 183 return CompareBookmarksByLastVisitDate(a.node, b.node,
184 creation_date_fallback); 184 creation_date_fallback);
185 }); 185 });
186 186
187 // Insert the first |max_count| items from |bookmarks| into |result|. 187 // Insert the first |max_count| items from |bookmarks| into |result|.
188 std::vector<const BookmarkNode*> result; 188 std::vector<const BookmarkNode*> result;
189 for (const RecentBookmark& bookmark : bookmarks) { 189 for (const RecentBookmark& bookmark : bookmarks) {
190 if (min_visit_time >
191 GetLastVisitDateForBookmark(bookmark.node, creation_date_fallback))
Marc Treib 2016/09/01 11:16:32 I think this should be if (!creation_date_fallback
vitaliii 2016/09/01 11:38:43 Done.
192 break;
Marc Treib 2016/09/01 11:16:32 nit: braces if the condition doesn't fit on one li
vitaliii 2016/09/01 11:38:43 Done.
193
190 result.push_back(bookmark.node); 194 result.push_back(bookmark.node);
191 if (result.size() >= static_cast<size_t>(max_count)) 195 if (result.size() >= static_cast<size_t>(max_count))
192 break; 196 break;
193 } 197 }
194 return result; 198 return result;
195 } 199 }
196 200
197 std::vector<const BookmarkNode*> GetDismissedBookmarksForDebugging( 201 std::vector<const BookmarkNode*> GetDismissedBookmarksForDebugging(
198 BookmarkModel* bookmark_model) { 202 BookmarkModel* bookmark_model) {
199 // Get all the bookmark URLs. 203 // Get all the bookmark URLs.
(...skipping 20 matching lines...) Expand all
220 // Insert into |result|. 224 // Insert into |result|.
221 std::vector<const BookmarkNode*> result; 225 std::vector<const BookmarkNode*> result;
222 for (const BookmarkModel::URLAndTitle& bookmark : bookmarks) { 226 for (const BookmarkModel::URLAndTitle& bookmark : bookmarks) {
223 result.push_back( 227 result.push_back(
224 bookmark_model->GetMostRecentlyAddedUserNodeForURL(bookmark.url)); 228 bookmark_model->GetMostRecentlyAddedUserNodeForURL(bookmark.url));
225 } 229 }
226 return result; 230 return result;
227 } 231 }
228 232
229 } // namespace ntp_snippets 233 } // namespace ntp_snippets
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698