Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 225 | 225 |
| 226 // Insert into |result|. | 226 // Insert into |result|. |
| 227 std::vector<const BookmarkNode*> result; | 227 std::vector<const BookmarkNode*> result; |
| 228 for (const BookmarkModel::URLAndTitle& bookmark : bookmarks) { | 228 for (const BookmarkModel::URLAndTitle& bookmark : bookmarks) { |
| 229 result.push_back( | 229 result.push_back( |
| 230 bookmark_model->GetMostRecentlyAddedUserNodeForURL(bookmark.url)); | 230 bookmark_model->GetMostRecentlyAddedUserNodeForURL(bookmark.url)); |
| 231 } | 231 } |
| 232 return result; | 232 return result; |
| 233 } | 233 } |
| 234 | 234 |
| 235 void RemoveAllLastVisitDates(bookmarks::BookmarkModel* bookmark_model) { | |
| 236 // Get all the bookmark URLs. | |
| 237 std::vector<BookmarkModel::URLAndTitle> bookmark_urls; | |
| 238 bookmark_model->GetBookmarks(&bookmark_urls); | |
| 239 | |
| 240 for (const BookmarkModel::URLAndTitle& url_and_title : bookmark_urls) { | |
| 241 // Get all bookmarks for the given URL. | |
| 242 std::vector<const BookmarkNode*> bookmarks_for_url; | |
| 243 bookmark_model->GetNodesByURL(url_and_title.url, &bookmarks_for_url); | |
| 244 DCHECK(!bookmarks_for_url.empty()); | |
|
Marc Treib
2016/09/01 14:11:20
No need to check for this - it shouldn't happen, b
vitaliii
2016/09/01 14:45:15
Done.
| |
| 245 | |
| 246 for (const BookmarkNode* bookmark : bookmarks_for_url) { | |
| 247 bookmark_model->DeleteNodeMetaInfo(bookmark, kBookmarkLastVisitDateKey); | |
| 248 } | |
| 249 } | |
| 250 } | |
| 251 | |
| 235 } // namespace ntp_snippets | 252 } // namespace ntp_snippets |
| OLD | NEW |