Index: components/offline_pages/content/suggested_articles_observer.cc |
diff --git a/components/offline_pages/content/suggested_articles_observer.cc b/components/offline_pages/content/suggested_articles_observer.cc |
index 4b60a286f7b9ab6682cf2637dce3c0b72bbb9dfe..a349ae4ed6ce63acc7686a5e1537cf7bf721de4a 100644 |
--- a/components/offline_pages/content/suggested_articles_observer.cc |
+++ b/components/offline_pages/content/suggested_articles_observer.cc |
@@ -14,6 +14,7 @@ |
#include "components/offline_pages/core/offline_page_feature.h" |
#include "components/offline_pages/core/prefetch/prefetch_dispatcher.h" |
#include "components/offline_pages/core/prefetch/prefetch_service.h" |
+#include "components/offline_pages/core/prefetch/prefetch_types.h" |
using ntp_snippets::Category; |
using ntp_snippets::ContentSuggestion; |
@@ -30,10 +31,6 @@ const ntp_snippets::Category& ArticlesCategory() { |
return articles; |
} |
-ClientId CreateClientIDFromSuggestionId(const ContentSuggestion::ID& id) { |
- return ClientId(kSuggestedArticlesNamespace, id.id_within_category()); |
-} |
- |
// The default delegate that contains external dependencies for the Offline Page |
// Suggestions Observer. This is unused in tests, which implement their own |
// Delegate. |
@@ -101,10 +98,10 @@ void SuggestedArticlesObserver::OnNewSuggestions(Category category) { |
if (suggestions.empty()) |
return; |
- std::vector<PrefetchDispatcher::PrefetchURL> prefetch_urls; |
+ 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()}); |
} |
PrefetchService* service = delegate_->GetPrefetchService(browser_context_); |
@@ -113,7 +110,8 @@ void SuggestedArticlesObserver::OnNewSuggestions(Category category) { |
"SuggestedArticlesObserver."; |
return; |
} |
- service->GetDispatcher()->AddCandidatePrefetchURLs(prefetch_urls); |
+ service->GetDispatcher()->AddCandidatePrefetchURLs( |
+ kSuggestedArticlesNamespace, prefetch_urls); |
} |
void SuggestedArticlesObserver::OnCategoryStatusChanged( |
@@ -148,7 +146,7 @@ void SuggestedArticlesObserver::OnSuggestionInvalidated( |
return; |
} |
service->GetDispatcher()->RemovePrefetchURLsByClientId( |
- CreateClientIDFromSuggestionId(suggestion_id)); |
+ kSuggestedArticlesNamespace, suggestion_id.id_within_category()); |
} |
void SuggestedArticlesObserver::OnFullRefreshRequired() { |