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

Unified Diff: components/ntp_snippets/ntp_snippets_service.cc

Issue 2292003002: Move OnURLsDeleted from NTPSnippetsService to ContentSuggestionsService (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 side-by-side diff with in-line comments
Download patch
Index: components/ntp_snippets/ntp_snippets_service.cc
diff --git a/components/ntp_snippets/ntp_snippets_service.cc b/components/ntp_snippets/ntp_snippets_service.cc
index 79b6a7939e91945ab2c60ce63fdcb1a7389d8ed8..040cb9a65589836f56d42ecfb80229263d30be70 100644
--- a/components/ntp_snippets/ntp_snippets_service.cc
+++ b/components/ntp_snippets/ntp_snippets_service.cc
@@ -191,7 +191,6 @@ NTPSnippetsService::NTPSnippetsService(
Observer* observer,
CategoryFactory* category_factory,
PrefService* pref_service,
- history::HistoryService* history_service,
SuggestionsService* suggestions_service,
const std::string& application_language_code,
NTPSnippetsScheduler* scheduler,
@@ -207,7 +206,6 @@ NTPSnippetsService::NTPSnippetsService(
suggestions_service_(suggestions_service),
application_language_code_(application_language_code),
scheduler_(scheduler),
- history_service_observer_(this),
snippets_fetcher_(std::move(snippets_fetcher)),
image_fetcher_(std::move(image_fetcher)),
image_decoder_(std::move(image_decoder)),
@@ -226,10 +224,6 @@ NTPSnippetsService::NTPSnippetsService(
return;
}
- // Can be null in tests.
- if (history_service)
- history_service_observer_.Add(history_service);
-
database_->SetErrorCallback(base::Bind(&NTPSnippetsService::OnDatabaseError,
base::Unretained(this)));
@@ -335,6 +329,18 @@ void NTPSnippetsService::FetchSuggestionImage(
base::Unretained(this), callback, snippet_id));
}
+void NTPSnippetsService::RemoveURLsFromHistory(
+ bool all_history,
+ const std::vector<GURL>& deleted_urls) {
+ // |deleted_urls| are ignored and all suggestions are removed, because it is
+ // not known which history entries were used for the suggestions
+ // personalization.
+ if (!ready())
+ nuke_after_load_ = true;
+ else
+ NukeAllSnippets();
+}
+
void NTPSnippetsService::ClearHistory(
base::Time begin,
base::Time end,
@@ -416,28 +422,6 @@ int NTPSnippetsService::GetMaxSnippetCountForTesting() {
////////////////////////////////////////////////////////////////////////////////
// Private methods
-// history::HistoryServiceObserver implementation.
-void NTPSnippetsService::OnURLsDeleted(
- history::HistoryService* history_service,
- bool all_history,
- bool expired,
- const history::URLRows& deleted_rows,
- const std::set<GURL>& favicon_urls) {
- // We don't care about expired entries.
- if (expired)
- return;
-
- if (!ready())
- nuke_after_load_ = true;
- else
- NukeAllSnippets();
-}
-
-void NTPSnippetsService::HistoryServiceBeingDeleted(
- history::HistoryService* history_service) {
- history_service_observer_.RemoveAll();
-}
-
// image_fetcher::ImageFetcherDelegate implementation.
void NTPSnippetsService::OnImageDataFetched(const std::string& snippet_id,
const std::string& image_data) {

Powered by Google App Engine
This is Rietveld 408576698