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

Unified Diff: components/ntp_snippets/ntp_snippets_service.h

Issue 1883523002: chrome://snippets-internals page for debugging NTP snippets. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Adding the chrome://snippets-internals page in the auto-suggest list. Created 4 years, 8 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 d6ab94c7f476981938ea99aa637bbf7dcdba7623..f48225d6adccb040b2232b5136f5d3110131b91f 100644
--- a/components/ntp_snippets/ntp_snippets_service.h
+++ b/components/ntp_snippets/ntp_snippets_service.h
@@ -75,11 +75,28 @@ class NTPSnippetsService : public KeyedService {
// Fetches snippets from the server and adds them to the current ones.
void FetchSnippets();
+ // Fetches snippets from the server for specified hosts (overriding
+ // suggestions from the suggestion service) and adds them to the current ones.
+ void FetchSnippetsFromHosts(const std::set<std::string>& hosts);
+ // Deletes all currently stored snippets.
Bernhard Bauer 2016/04/14 16:50:24 Empty line before comment.
jkrcal 2016/04/15 14:11:50 Done.
+ void ClearSnippets();
// Discards the snippet with the given |url|, if it exists. Returns true iff
// a snippet was discarded.
bool DiscardSnippet(const GURL& url);
+ // Returns the lists of snippets previously discarded by the user (that are
+ // not expired yet).
+ const NTPSnippetStorage& discarded_snippets() const {
Bernhard Bauer 2016/04/14 16:50:24 Somewhat unrelated yak-shaving: Now that we have a
Marc Treib 2016/04/15 09:00:30 +1, but IMO this can wait for another CL.
jkrcal 2016/04/15 14:11:50 I agree, I really did not like the asymmetry when
+ return discarded_snippets_;
+ }
+
+ // Clears the lists of snippets previously discarded by the user.
+ void ClearDiscardedSnippets();
+
+ // Returns the lists of suggestion hosts the snippets are restricted to.
+ std::set<std::string> GetSuggestionsHosts() const;
+
// Observer accessors.
void AddObserver(NTPSnippetsServiceObserver* observer);
void RemoveObserver(NTPSnippetsServiceObserver* observer);
@@ -107,8 +124,6 @@ class NTPSnippetsService : public KeyedService {
scoped_ptr<base::Value> parsed);
void OnJsonError(const std::string& snippets_json, const std::string& error);
- void FetchSnippetsImpl(const std::set<std::string>& hosts);
-
// Expects a top-level dictionary containing a "recos" list, which will be
// passed to LoadFromListValue().
bool LoadFromValue(const base::Value& value);

Powered by Google App Engine
This is Rietveld 408576698