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

Side by Side Diff: components/ntp_snippets/ntp_snippets_service.cc

Issue 2303713002: Implement ClearHistory for all ntp_snippets providers (Closed)
Patch Set: Created 4 years, 3 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
OLDNEW
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
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 // Note that both time range and the filter are ignored and all suggestions
343 // are removed, because it is not known which history entries were used for
344 // the suggestions personalization.
345 if (!ready())
346 nuke_after_load_ = true;
347 else
348 NukeAllSnippets();
Marc Treib 2016/09/01 14:11:20 Since this four-line block now exists twice, we co
vitaliii 2016/09/01 14:45:15 Acknowledged.
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
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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698