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

Unified Diff: components/offline_pages/core/prefetch/suggested_articles_observer.cc

Issue 2920083002: Prefetching: Introduce store commands abstractions to be used by tasks. (Closed)
Patch Set: Minor changes Created 3 years, 6 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/offline_pages/core/prefetch/suggested_articles_observer.cc
diff --git a/components/offline_pages/core/prefetch/suggested_articles_observer.cc b/components/offline_pages/core/prefetch/suggested_articles_observer.cc
index e7225a5a1e703a73f4f26df38b6363461d13e0d7..d0fb3ba0460bc3bc2bf944d6cceca1be246d08af 100644
--- a/components/offline_pages/core/prefetch/suggested_articles_observer.cc
+++ b/components/offline_pages/core/prefetch/suggested_articles_observer.cc
@@ -28,10 +28,6 @@ const ntp_snippets::Category& ArticlesCategory() {
return articles;
}
-ClientId CreateClientIDFromSuggestionId(const ContentSuggestion::ID& id) {
- return ClientId(kSuggestedArticlesNamespace, id.id_within_category());
-}
-
} // namespace
SuggestedArticlesObserver::SuggestedArticlesObserver(
@@ -71,10 +67,11 @@ void SuggestedArticlesObserver::OnNewSuggestions(Category category) {
std::vector<PrefetchURL> prefetch_urls;
for (const ContentSuggestion& suggestion : suggestions) {
prefetch_urls.push_back(
- {CreateClientIDFromSuggestionId(suggestion.id()), suggestion.url()});
+ {suggestion.id().id_within_category(), suggestion.url()});
}
- prefetch_dispatcher_->AddCandidatePrefetchURLs(prefetch_urls);
+ prefetch_dispatcher_->AddCandidatePrefetchURLs(kSuggestedArticlesNamespace,
+ prefetch_urls);
}
void SuggestedArticlesObserver::OnCategoryStatusChanged(
@@ -96,8 +93,8 @@ void SuggestedArticlesObserver::OnCategoryStatusChanged(
void SuggestedArticlesObserver::OnSuggestionInvalidated(
const ContentSuggestion::ID& suggestion_id) {
- prefetch_dispatcher_->RemovePrefetchURLsByClientId(
- CreateClientIDFromSuggestionId(suggestion_id));
+ prefetch_dispatcher_->RemovePrefetchURLsByClientId(ClientId(
+ kSuggestedArticlesNamespace, suggestion_id.id_within_category()));
}
void SuggestedArticlesObserver::OnFullRefreshRequired() {

Powered by Google App Engine
This is Rietveld 408576698