| 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 af047ac3af7da517dda41c378aa711cfd3cecd9c..ea575674ca800812191fb4cdb0284cbb242fba71 100644
|
| --- a/components/ntp_snippets/ntp_snippets_service.cc
|
| +++ b/components/ntp_snippets/ntp_snippets_service.cc
|
| @@ -347,6 +347,8 @@ void NTPSnippetsService::OnSnippetsDownloaded(
|
| if (!snippets_json.empty()) {
|
| DCHECK(status.empty());
|
|
|
| + last_fetch_json_ = snippets_json;
|
| +
|
| parse_json_callback_.Run(
|
| snippets_json,
|
| base::Bind(&NTPSnippetsService::OnJsonParsed,
|
| @@ -422,11 +424,6 @@ bool NTPSnippetsService::LoadFromListValue(const base::ListValue& list) {
|
| std::make_move_iterator(new_snippets.begin()),
|
| std::make_move_iterator(new_snippets.end()));
|
|
|
| - // If there are more snippets now than we want to show, drop the extra ones
|
| - // from the end of the list.
|
| - if (snippets_.size() > kMaxSnippetCount)
|
| - snippets_.resize(kMaxSnippetCount);
|
| -
|
| return true;
|
| }
|
|
|
| @@ -484,6 +481,12 @@ void NTPSnippetsService::LoadingSnippetsFinished() {
|
| return snippet->expiry_date() <= expiry;
|
| }),
|
| snippets_.end());
|
| +
|
| + // If there are more snippets now than we want to show, drop the extra ones
|
| + // from the end of the list.
|
| + if (snippets_.size() > kMaxSnippetCount)
|
| + snippets_.resize(kMaxSnippetCount);
|
| +
|
| StoreSnippetsToPrefs();
|
|
|
| discarded_snippets_.erase(
|
|
|