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 98e823d23ea5ed77a8592cd06e94c30a81bd6129..b68911ba00c03953b23eaf1678019165eedca1fa 100644 |
--- a/components/ntp_snippets/ntp_snippets_service.cc |
+++ b/components/ntp_snippets/ntp_snippets_service.cc |
@@ -49,6 +49,11 @@ NTPSnippetsService::NTPSnippetsService( |
NTPSnippetsService::~NTPSnippetsService() {} |
void NTPSnippetsService::Init(bool enabled) { |
+ // If enabled, get snippets immediately. If we've downloaded them before, |
+ // this will just read from disk. |
+ if (enabled) |
+ FetchSnippets(false); |
+ |
// The scheduler only exists on Android so far, it's null on other platforms. |
if (!scheduler_) |
return; |
@@ -84,6 +89,8 @@ void NTPSnippetsService::OnFileReadDone(const std::string& json) { |
} |
bool NTPSnippetsService::LoadFromJSONString(const std::string& str) { |
+ snippets_.clear(); |
+ |
JSONStringValueDeserializer deserializer(str); |
int error_code; |
std::string error_message; |