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

Side by Side Diff: components/ntp_snippets/ntp_snippets_service.h

Issue 1907233002: Allows to dump current snippets to a json in the Downloads folder. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Minor cleanup 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 unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef COMPONENTS_NTP_SNIPPETS_NTP_SNIPPETS_SERVICE_H_ 5 #ifndef COMPONENTS_NTP_SNIPPETS_NTP_SNIPPETS_SERVICE_H_
6 #define COMPONENTS_NTP_SNIPPETS_NTP_SNIPPETS_SERVICE_H_ 6 #define COMPONENTS_NTP_SNIPPETS_NTP_SNIPPETS_SERVICE_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 9
10 #include <set> 10 #include <set>
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 // the schedule depends on the time of day 83 // the schedule depends on the time of day
84 void RescheduleFetching(); 84 void RescheduleFetching();
85 85
86 // Deletes all currently stored snippets. 86 // Deletes all currently stored snippets.
87 void ClearSnippets(); 87 void ClearSnippets();
88 88
89 // Discards the snippet with the given |url|, if it exists. Returns true iff 89 // Discards the snippet with the given |url|, if it exists. Returns true iff
90 // a snippet was discarded. 90 // a snippet was discarded.
91 bool DiscardSnippet(const GURL& url); 91 bool DiscardSnippet(const GURL& url);
92 92
93 // Returns the lists of snippets previously discarded by the user (that are 93 // Returns the list of current valid snippets.
94 const NTPSnippetStorage& snippets() const {
95 return snippets_;
96 }
97
98 // Returns the list of snippets previously discarded by the user (that are
94 // not expired yet). 99 // not expired yet).
95 const NTPSnippetStorage& discarded_snippets() const { 100 const NTPSnippetStorage& discarded_snippets() const {
96 return discarded_snippets_; 101 return discarded_snippets_;
97 } 102 }
98 103
99 // Clears the lists of snippets previously discarded by the user. 104 // Clears the lists of snippets previously discarded by the user.
100 void ClearDiscardedSnippets(); 105 void ClearDiscardedSnippets();
101 106
102 // Returns the lists of suggestion hosts the snippets are restricted to. 107 // Returns the lists of suggestion hosts the snippets are restricted to.
103 std::set<std::string> GetSuggestionsHosts() const; 108 std::set<std::string> GetSuggestionsHosts() const;
104 109
110 // Returns the given snippets as a list value.
111 scoped_ptr<base::ListValue> SnippetsToListValue(
112 const NTPSnippetsService::NTPSnippetStorage& snippets) const;
113
105 // Observer accessors. 114 // Observer accessors.
106 void AddObserver(NTPSnippetsServiceObserver* observer); 115 void AddObserver(NTPSnippetsServiceObserver* observer);
107 void RemoveObserver(NTPSnippetsServiceObserver* observer); 116 void RemoveObserver(NTPSnippetsServiceObserver* observer);
108 117
109 // Number of snippets available. 118 // Number of snippets available.
110 size_t size() const { return snippets_.size(); } 119 size_t size() const { return snippets_.size(); }
111 120
112 // The snippets can be iterated upon only via a const_iterator. Recommended 121 // The snippets can be iterated upon only via a const_iterator. Recommended
113 // way to iterate is as follows: 122 // way to iterate is as follows:
114 // 123 //
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
206 // Sent when the service is shutting down. 215 // Sent when the service is shutting down.
207 virtual void NTPSnippetsServiceShutdown() = 0; 216 virtual void NTPSnippetsServiceShutdown() = 0;
208 217
209 protected: 218 protected:
210 virtual ~NTPSnippetsServiceObserver() {} 219 virtual ~NTPSnippetsServiceObserver() {}
211 }; 220 };
212 221
213 } // namespace ntp_snippets 222 } // namespace ntp_snippets
214 223
215 #endif // COMPONENTS_NTP_SNIPPETS_NTP_SNIPPETS_SERVICE_H_ 224 #endif // COMPONENTS_NTP_SNIPPETS_NTP_SNIPPETS_SERVICE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698