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

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

Issue 1922463002: [NTP Snippets] Limit the number of snippets to 10 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: review 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 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 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 // The snippets can be iterated upon only via a const_iterator. Recommended 117 // The snippets can be iterated upon only via a const_iterator. Recommended
118 // way to iterate is as follows: 118 // way to iterate is as follows:
119 // 119 //
120 // NTPSnippetsService* service; // Assume is set. 120 // NTPSnippetsService* service; // Assume is set.
121 // for (auto& snippet : *service) { 121 // for (auto& snippet : *service) {
122 // // |snippet| here is a const object. 122 // // |snippet| here is a const object.
123 // } 123 // }
124 const_iterator begin() const { return const_iterator(snippets_.begin()); } 124 const_iterator begin() const { return const_iterator(snippets_.begin()); }
125 const_iterator end() const { return const_iterator(snippets_.end()); } 125 const_iterator end() const { return const_iterator(snippets_.end()); }
126 126
127 // Returns the maximum number of snippets that will be shown at once.
128 static int GetMaxSnippetCountForTesting();
129
127 private: 130 private:
128 friend class NTPSnippetsServiceTest; 131 friend class NTPSnippetsServiceTest;
129 132
130 void OnSuggestionsChanged(const suggestions::SuggestionsProfile& suggestions); 133 void OnSuggestionsChanged(const suggestions::SuggestionsProfile& suggestions);
131 void OnSnippetsDownloaded(const std::string& snippets_json, 134 void OnSnippetsDownloaded(const std::string& snippets_json,
132 const std::string& status); 135 const std::string& status);
133 136
134 void OnJsonParsed(const std::string& snippets_json, 137 void OnJsonParsed(const std::string& snippets_json,
135 scoped_ptr<base::Value> parsed); 138 scoped_ptr<base::Value> parsed);
136 void OnJsonError(const std::string& snippets_json, const std::string& error); 139 void OnJsonError(const std::string& snippets_json, const std::string& error);
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
214 // Sent when the service is shutting down. 217 // Sent when the service is shutting down.
215 virtual void NTPSnippetsServiceShutdown() = 0; 218 virtual void NTPSnippetsServiceShutdown() = 0;
216 219
217 protected: 220 protected:
218 virtual ~NTPSnippetsServiceObserver() {} 221 virtual ~NTPSnippetsServiceObserver() {}
219 }; 222 };
220 223
221 } // namespace ntp_snippets 224 } // namespace ntp_snippets
222 225
223 #endif // COMPONENTS_NTP_SNIPPETS_NTP_SNIPPETS_SERVICE_H_ 226 #endif // COMPONENTS_NTP_SNIPPETS_NTP_SNIPPETS_SERVICE_H_
OLDNEW
« no previous file with comments | « components/ntp_snippets/ntp_snippets_fetcher.cc ('k') | components/ntp_snippets/ntp_snippets_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698