Chromium Code Reviews| Index: components/ntp_snippets/offline_pages/offline_page_suggestions_provider.cc |
| diff --git a/components/ntp_snippets/offline_pages/offline_page_suggestions_provider.cc b/components/ntp_snippets/offline_pages/offline_page_suggestions_provider.cc |
| index ed0dd39dc0c27838594b900d15788f72d3522f5d..dba15ddaa669dc620bc849924610d1de9a235da3 100644 |
| --- a/components/ntp_snippets/offline_pages/offline_page_suggestions_provider.cc |
| +++ b/components/ntp_snippets/offline_pages/offline_page_suggestions_provider.cc |
| @@ -95,8 +95,12 @@ void OfflinePageSuggestionsProvider::OnOfflinePagesLoaded( |
| if (!observer_) |
| return; |
| + int counter = 0; |
| std::vector<ContentSuggestion> suggestions; |
| for (const OfflinePageItem& item : result) { |
| + // TODO(pke): Make sure the URL is actually opened as an offline URL. |
| + // Currently, the browser opens the offline URL and then immediately |
| + // redirects to the online URL if the device is online. |
| ContentSuggestion suggestion( |
| MakeUniqueID(ContentSuggestionsCategory::OFFLINE_PAGES, |
| base::IntToString(item.offline_id)), |
| @@ -110,6 +114,10 @@ void OfflinePageSuggestionsProvider::OnOfflinePagesLoaded( |
| suggestion.set_publish_date(item.creation_time); |
| suggestion.set_publisher_name(item.url.host()); |
| suggestions.emplace_back(std::move(suggestion)); |
| + // TODO(pke): Refine the number of offline pages to be returned, introduce |
| + // a constant? |
|
Marc Treib
2016/07/26 14:00:00
Yup, you should probably introduce a constant :)
A
Philipp Keck
2016/07/26 15:47:20
Good idea. Constant is there, I put a question abo
|
| + if (5 == ++counter) |
| + break; |
| } |
| observer_->OnNewSuggestions(ContentSuggestionsCategory::OFFLINE_PAGES, |