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

Unified Diff: components/ntp_snippets/ntp_snippets_service.h

Issue 1743333002: [NTP Snippets] Implement snippets expiry (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@snippets_persist
Patch Set: review Created 4 years, 10 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
« no previous file with comments | « components/ntp_snippets/ntp_snippet.cc ('k') | components/ntp_snippets/ntp_snippets_service.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/ntp_snippets/ntp_snippets_service.h
diff --git a/components/ntp_snippets/ntp_snippets_service.h b/components/ntp_snippets/ntp_snippets_service.h
index a37b08e74afce82611310aabf7bf306004e7f735..19f3b4ed1312a12e2e157032d224af01d54a8097 100644
--- a/components/ntp_snippets/ntp_snippets_service.h
+++ b/components/ntp_snippets/ntp_snippets_service.h
@@ -14,6 +14,7 @@
#include "base/memory/weak_ptr.h"
#include "base/observer_list.h"
#include "base/sequenced_task_runner.h"
+#include "base/timer/timer.h"
#include "components/keyed_service/core/keyed_service.h"
#include "components/ntp_snippets/inner_iterator.h"
#include "components/ntp_snippets/ntp_snippet.h"
@@ -110,6 +111,8 @@ class NTPSnippetsService : public KeyedService, NTPSnippetsFetcher::Observer {
void LoadFromPrefs();
void StoreToPrefs();
+ void RemoveExpiredSnippets();
+
PrefService* pref_service_;
// True if the suggestions are loaded.
@@ -130,13 +133,16 @@ class NTPSnippetsService : public KeyedService, NTPSnippetsFetcher::Observer {
// Scheduler for fetching snippets. Not owned.
NTPSnippetsScheduler* scheduler_;
- // The snippets fetcher
+ // The snippets fetcher.
scoped_ptr<NTPSnippetsFetcher> snippets_fetcher_;
- // The callback from the snippets fetcher
+ // The subscription to the snippets fetcher.
scoped_ptr<NTPSnippetsFetcher::SnippetsAvailableCallbackList::Subscription>
snippets_fetcher_callback_;
+ // Timer that calls us back when the next snippet expires.
+ base::OneShotTimer expiry_timer_;
+
base::WeakPtrFactory<NTPSnippetsService> weak_ptr_factory_;
friend class NTPSnippetsServiceTest;
« no previous file with comments | « components/ntp_snippets/ntp_snippet.cc ('k') | components/ntp_snippets/ntp_snippets_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698