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

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

Issue 2566123002: Last visit dates of bookmarks - fix browsing data removal on desktop (Closed)
Patch Set: Adding a unittest Created 4 years 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_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 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
143 callback, 143 callback,
144 Status(StatusCode::PERMANENT_ERROR, 144 Status(StatusCode::PERMANENT_ERROR,
145 "BookmarkSuggestionsProvider has no |Fetch| functionality!"), 145 "BookmarkSuggestionsProvider has no |Fetch| functionality!"),
146 base::Passed(std::vector<ContentSuggestion>()))); 146 base::Passed(std::vector<ContentSuggestion>())));
147 } 147 }
148 148
149 void BookmarkSuggestionsProvider::ClearHistory( 149 void BookmarkSuggestionsProvider::ClearHistory(
150 base::Time begin, 150 base::Time begin,
151 base::Time end, 151 base::Time end,
152 const base::Callback<bool(const GURL& url)>& filter) { 152 const base::Callback<bool(const GURL& url)>& filter) {
153 // TODO(vitaliii): Do not remove all dates, but only the ones matched by the 153 // The last visit dates are not "owned" by the bookmark suggestion provider so
154 // time range and the filter. 154 // it is cleared directly from browsing_data_remover.cc.
155 RemoveAllLastVisitDates(bookmark_model_);
156 ClearDismissedSuggestionsForDebugging(provided_category_); 155 ClearDismissedSuggestionsForDebugging(provided_category_);
157 FetchBookmarks(); 156 FetchBookmarks();
158 // Temporarily enter an "explicitly disabled" state, so that any open UIs 157 // Temporarily enter an "explicitly disabled" state, so that any open UIs
159 // will clear the suggestions too. 158 // will clear the suggestions too.
160 if (category_status_ != CategoryStatus::CATEGORY_EXPLICITLY_DISABLED) { 159 if (category_status_ != CategoryStatus::CATEGORY_EXPLICITLY_DISABLED) {
161 CategoryStatus old_category_status = category_status_; 160 CategoryStatus old_category_status = category_status_;
162 NotifyStatusChanged(CategoryStatus::CATEGORY_EXPLICITLY_DISABLED); 161 NotifyStatusChanged(CategoryStatus::CATEGORY_EXPLICITLY_DISABLED);
163 NotifyStatusChanged(old_category_status); 162 NotifyStatusChanged(old_category_status);
164 } 163 }
165 } 164 }
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
325 void BookmarkSuggestionsProvider::NotifyStatusChanged( 324 void BookmarkSuggestionsProvider::NotifyStatusChanged(
326 CategoryStatus new_status) { 325 CategoryStatus new_status) {
327 if (category_status_ == new_status) { 326 if (category_status_ == new_status) {
328 return; 327 return;
329 } 328 }
330 category_status_ = new_status; 329 category_status_ = new_status;
331 observer()->OnCategoryStatusChanged(this, provided_category_, new_status); 330 observer()->OnCategoryStatusChanged(this, provided_category_, new_status);
332 } 331 }
333 332
334 } // namespace ntp_snippets 333 } // namespace ntp_snippets
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698