OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/ntp_snippets_service.h" | 5 #include "components/ntp_snippets/ntp_snippets_service.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <iterator> | 8 #include <iterator> |
9 #include <utility> | 9 #include <utility> |
10 | 10 |
(...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
332 database_->LoadImage( | 332 database_->LoadImage( |
333 snippet_id, | 333 snippet_id, |
334 base::Bind(&NTPSnippetsService::OnSnippetImageFetchedFromDatabase, | 334 base::Bind(&NTPSnippetsService::OnSnippetImageFetchedFromDatabase, |
335 base::Unretained(this), callback, snippet_id)); | 335 base::Unretained(this), callback, snippet_id)); |
336 } | 336 } |
337 | 337 |
338 void NTPSnippetsService::ClearHistory( | 338 void NTPSnippetsService::ClearHistory( |
339 base::Time begin, | 339 base::Time begin, |
340 base::Time end, | 340 base::Time end, |
341 const base::Callback<bool(const GURL& url)>& filter) { | 341 const base::Callback<bool(const GURL& url)>& filter) { |
342 // TODO(vitaliii): Implement. See crbug.com/641321. | 342 // Both time range and the filter are ignored and all suggestions are removed, |
| 343 // because it is not known which history entries were used for the suggestions |
| 344 // personalization. |
| 345 if (!ready()) |
| 346 nuke_after_load_ = true; |
| 347 else |
| 348 NukeAllSnippets(); |
343 } | 349 } |
344 | 350 |
345 void NTPSnippetsService::ClearCachedSuggestions(Category category) { | 351 void NTPSnippetsService::ClearCachedSuggestions(Category category) { |
346 DCHECK_EQ(category, provided_category_); | 352 DCHECK_EQ(category, provided_category_); |
347 if (!initialized()) | 353 if (!initialized()) |
348 return; | 354 return; |
349 | 355 |
350 if (snippets_.empty()) | 356 if (snippets_.empty()) |
351 return; | 357 return; |
352 | 358 |
(...skipping 546 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
899 void NTPSnippetsService::UpdateCategoryStatus(CategoryStatus status) { | 905 void NTPSnippetsService::UpdateCategoryStatus(CategoryStatus status) { |
900 if (status == category_status_) | 906 if (status == category_status_) |
901 return; | 907 return; |
902 | 908 |
903 category_status_ = status; | 909 category_status_ = status; |
904 observer()->OnCategoryStatusChanged(this, provided_category_, | 910 observer()->OnCategoryStatusChanged(this, provided_category_, |
905 category_status_); | 911 category_status_); |
906 } | 912 } |
907 | 913 |
908 } // namespace ntp_snippets | 914 } // namespace ntp_snippets |
OLD | NEW |