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_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 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
186 | 186 |
187 void BookmarkSuggestionsProvider::ClearHistory( | 187 void BookmarkSuggestionsProvider::ClearHistory( |
188 base::Time begin, | 188 base::Time begin, |
189 base::Time end, | 189 base::Time end, |
190 const base::Callback<bool(const GURL& url)>& filter) { | 190 const base::Callback<bool(const GURL& url)>& filter) { |
191 // TODO(vitaliii): Do not remove all dates, but only the ones matched by the | 191 // TODO(vitaliii): Do not remove all dates, but only the ones matched by the |
192 // time range and the filter. | 192 // time range and the filter. |
193 RemoveAllLastVisitDates(bookmark_model_); | 193 RemoveAllLastVisitDates(bookmark_model_); |
194 ClearDismissedSuggestionsForDebugging(provided_category_); | 194 ClearDismissedSuggestionsForDebugging(provided_category_); |
195 FetchBookmarks(); | 195 FetchBookmarks(); |
| 196 // Temporarily enter an "explicitly disabled" state, so that any open UIs |
| 197 // will clear the suggestions too. |
| 198 if (category_status_ != CategoryStatus::CATEGORY_EXPLICITLY_DISABLED) { |
| 199 CategoryStatus old_category_status = category_status_; |
| 200 NotifyStatusChanged(CategoryStatus::CATEGORY_EXPLICITLY_DISABLED); |
| 201 NotifyStatusChanged(old_category_status); |
| 202 } |
196 } | 203 } |
197 | 204 |
198 void BookmarkSuggestionsProvider::ClearCachedSuggestions(Category category) { | 205 void BookmarkSuggestionsProvider::ClearCachedSuggestions(Category category) { |
199 DCHECK_EQ(category, provided_category_); | 206 DCHECK_EQ(category, provided_category_); |
200 // Ignored. | 207 // Ignored. |
201 } | 208 } |
202 | 209 |
203 void BookmarkSuggestionsProvider::GetDismissedSuggestionsForDebugging( | 210 void BookmarkSuggestionsProvider::GetDismissedSuggestionsForDebugging( |
204 Category category, | 211 Category category, |
205 const DismissedSuggestionsCallback& callback) { | 212 const DismissedSuggestionsCallback& callback) { |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
314 | 321 |
315 void BookmarkSuggestionsProvider::NotifyStatusChanged( | 322 void BookmarkSuggestionsProvider::NotifyStatusChanged( |
316 CategoryStatus new_status) { | 323 CategoryStatus new_status) { |
317 if (category_status_ == new_status) | 324 if (category_status_ == new_status) |
318 return; | 325 return; |
319 category_status_ = new_status; | 326 category_status_ = new_status; |
320 observer()->OnCategoryStatusChanged(this, provided_category_, new_status); | 327 observer()->OnCategoryStatusChanged(this, provided_category_, new_status); |
321 } | 328 } |
322 | 329 |
323 } // namespace ntp_snippets | 330 } // namespace ntp_snippets |
OLD | NEW |