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

Unified Diff: components/ntp_snippets/ntp_snippets_fetcher.cc

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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « components/ntp_snippets/ntp_snippets_fetcher.h ('k') | components/ntp_snippets/ntp_snippets_service.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/ntp_snippets/ntp_snippets_fetcher.cc
diff --git a/components/ntp_snippets/ntp_snippets_fetcher.cc b/components/ntp_snippets/ntp_snippets_fetcher.cc
index 0dbf7024d7ebbbfa16bcfdca0fd94bc079ae3e07..ac39f5d7f800b6dea6fc20e18c7e66421c645ec6 100644
--- a/components/ntp_snippets/ntp_snippets_fetcher.cc
+++ b/components/ntp_snippets/ntp_snippets_fetcher.cc
@@ -56,7 +56,7 @@ const char kRequestParameterFormat[] =
"%s"
" },"
" \"global_scoring_params\": {"
- " \"num_to_return\": 10"
+ " \"num_to_return\": %i"
" }"
" }"
"}";
@@ -77,15 +77,15 @@ NTPSnippetsFetcher::NTPSnippetsFetcher(
url_request_context_getter_(url_request_context_getter),
is_stable_channel_(is_stable_channel) {}
-NTPSnippetsFetcher::~NTPSnippetsFetcher() {
-}
+NTPSnippetsFetcher::~NTPSnippetsFetcher() {}
scoped_ptr<NTPSnippetsFetcher::SnippetsAvailableCallbackList::Subscription>
NTPSnippetsFetcher::AddCallback(const SnippetsAvailableCallback& callback) {
return callback_list_.Add(callback);
}
-void NTPSnippetsFetcher::FetchSnippets(const std::set<std::string>& hosts) {
+void NTPSnippetsFetcher::FetchSnippets(const std::set<std::string>& hosts,
+ int count) {
// TODO(treib): What to do if there's already a pending request?
const std::string& key = is_stable_channel_
? google_apis::GetAPIKey()
@@ -104,7 +104,8 @@ void NTPSnippetsFetcher::FetchSnippets(const std::set<std::string>& hosts) {
host_restricts += base::StringPrintf(kHostRestrictFormat, host.c_str());
url_fetcher_->SetUploadData("application/json",
base::StringPrintf(kRequestParameterFormat,
- host_restricts.c_str()));
+ host_restricts.c_str(),
+ count));
// Fetchers are sometimes cancelled because a network change was detected.
url_fetcher_->SetAutomaticallyRetryOnNetworkChanges(3);
« no previous file with comments | « components/ntp_snippets/ntp_snippets_fetcher.h ('k') | components/ntp_snippets/ntp_snippets_service.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698