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

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

Issue 2616633002: Respect time range in browsing data removal for last-visited data. (Closed)
Patch Set: rebase Created 3 years, 11 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 | « components/ntp_snippets/bookmarks/bookmark_last_visit_utils_unittest.cc ('k') | 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 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_suggestions_provider.h" 5 #include "components/ntp_snippets/bookmarks/bookmark_suggestions_provider.h"
6 6
7 #include <utility> 7 #include <utility>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
142 callback, 142 callback,
143 Status(StatusCode::PERMANENT_ERROR, 143 Status(StatusCode::PERMANENT_ERROR,
144 "BookmarkSuggestionsProvider has no |Fetch| functionality!"), 144 "BookmarkSuggestionsProvider has no |Fetch| functionality!"),
145 base::Passed(std::vector<ContentSuggestion>()))); 145 base::Passed(std::vector<ContentSuggestion>())));
146 } 146 }
147 147
148 void BookmarkSuggestionsProvider::ClearHistory( 148 void BookmarkSuggestionsProvider::ClearHistory(
149 base::Time begin, 149 base::Time begin,
150 base::Time end, 150 base::Time end,
151 const base::Callback<bool(const GURL& url)>& filter) { 151 const base::Callback<bool(const GURL& url)>& filter) {
152 // The last visit dates are not "owned" by the bookmark suggestion provider so 152 // To avoid race conditions with the history-removal of the last-visited
153 // it is cleared directly from browsing_data_remover.cc. 153 // timestamps we also trigger a deletion here. The problem is that we need to
154 // update the bookmarks data here and otherwise (depending on the order in
155 // which the code runs) could pick up to-be-deleted data again.
156 if (bookmark_model_->loaded()) {
157 RemoveLastVisitedDatesBetween(begin, end, filter, bookmark_model_);
158 }
154 ClearDismissedSuggestionsForDebugging(provided_category_); 159 ClearDismissedSuggestionsForDebugging(provided_category_);
155 // TODO(tschumann): Before re-fetching bookmarks we need to trigger a clean-up
156 // of the last-visit dates -- otherwise we depend on the order in which the
157 // ClearHistory events are done and might just pick-up to-be-deleted data
158 // again.
159 FetchBookmarks(); 160 FetchBookmarks();
160 } 161 }
161 162
162 void BookmarkSuggestionsProvider::ClearCachedSuggestions(Category category) { 163 void BookmarkSuggestionsProvider::ClearCachedSuggestions(Category category) {
163 DCHECK_EQ(category, provided_category_); 164 DCHECK_EQ(category, provided_category_);
164 // Ignored. 165 // Ignored.
165 } 166 }
166 167
167 void BookmarkSuggestionsProvider::GetDismissedSuggestionsForDebugging( 168 void BookmarkSuggestionsProvider::GetDismissedSuggestionsForDebugging(
168 Category category, 169 Category category,
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
320 void BookmarkSuggestionsProvider::NotifyStatusChanged( 321 void BookmarkSuggestionsProvider::NotifyStatusChanged(
321 CategoryStatus new_status) { 322 CategoryStatus new_status) {
322 if (category_status_ == new_status) { 323 if (category_status_ == new_status) {
323 return; 324 return;
324 } 325 }
325 category_status_ = new_status; 326 category_status_ = new_status;
326 observer()->OnCategoryStatusChanged(this, provided_category_, new_status); 327 observer()->OnCategoryStatusChanged(this, provided_category_, new_status);
327 } 328 }
328 329
329 } // namespace ntp_snippets 330 } // namespace ntp_snippets
OLDNEW
« no previous file with comments | « components/ntp_snippets/bookmarks/bookmark_last_visit_utils_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698