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

Unified Diff: components/ntp_snippets/ntp_snippets_service.h

Issue 1976153002: Various NTPSnippetsService cleanups: (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Shutdown() in tests Created 4 years, 7 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
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 13e949afb04dd48467f35c90321bb8acf9c4e08f..2611206fec06e793574531cf58eb844f13d502ba 100644
--- a/components/ntp_snippets/ntp_snippets_service.h
+++ b/components/ntp_snippets/ntp_snippets_service.h
@@ -46,8 +46,6 @@ class NTPSnippetsServiceObserver;
// Stores and vends fresh content data for the NTP.
class NTPSnippetsService : public KeyedService {
public:
- using NTPSnippetStorage = NTPSnippet::PtrVector;
-
using ImageFetchedCallback =
base::Callback<void(const std::string& snippet_id, const SkBitmap*)>;
@@ -79,11 +77,11 @@ class NTPSnippetsService : public KeyedService {
void FetchSnippetsFromHosts(const std::set<std::string>& hosts);
// Available snippets.
- const NTPSnippetStorage& snippets() const { return snippets_; }
+ const NTPSnippet::PtrVector& snippets() const { return snippets_; }
// Returns the list of snippets previously discarded by the user (that are
// not expired yet).
- const NTPSnippetStorage& discarded_snippets() const {
+ const NTPSnippet::PtrVector& discarded_snippets() const {
return discarded_snippets_;
}
@@ -131,12 +129,8 @@ class NTPSnippetsService : public KeyedService {
void OnSuggestionsChanged(const suggestions::SuggestionsProfile& suggestions);
void OnFetchFinished(NTPSnippetsFetcher::OptionalSnippets snippets);
- // Expects a top-level dictionary containing a "recos" list, each element of
- // which will be parsed as a snippet.
- bool LoadFromFetchedValue(const base::Value& value);
-
// Merges newly available snippets with the previously available list.
- void MergeSnippets(NTPSnippetStorage new_snippets);
+ void MergeSnippets(NTPSnippet::PtrVector new_snippets);
// TODO(treib): Investigate a better storage, maybe LevelDB or SQLite?
void LoadSnippetsFromPrefs();
void StoreSnippetsToPrefs();
@@ -149,6 +143,9 @@ class NTPSnippetsService : public KeyedService {
void LoadingSnippetsFinished();
+ bool did_init_;
Bernhard Bauer 2016/05/13 16:04:05 Alternative would be to use a tri-state enum.
Bernhard Bauer 2016/05/17 09:23:40 ^^^ WDYT?
Marc Treib 2016/05/17 11:21:18 I didn't forget, just wanted to sort out the other
+ bool did_shutdown_;
+
bool enabled_;
PrefService* pref_service_;
@@ -159,11 +156,11 @@ class NTPSnippetsService : public KeyedService {
scoped_refptr<base::SequencedTaskRunner> file_task_runner_;
// All current suggestions (i.e. not discarded ones).
- NTPSnippetStorage snippets_;
+ NTPSnippet::PtrVector snippets_;
// Suggestions that the user discarded. We keep these around until they expire
// so we won't re-add them on the next fetch.
- NTPSnippetStorage discarded_snippets_;
+ NTPSnippet::PtrVector discarded_snippets_;
// The ISO 639-1 code of the language used by the application.
const std::string application_language_code_;
« no previous file with comments | « no previous file | components/ntp_snippets/ntp_snippets_service.cc » ('j') | components/ntp_snippets/ntp_snippets_service.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698