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

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

Issue 1922083004: Allow fetching personalized snippets from ChromeReader. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: After code review #5 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 #include "components/ntp_snippets/ntp_snippets_service.h" 5 #include "components/ntp_snippets/ntp_snippets_service.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <iterator> 8 #include <iterator>
9 #include <utility> 9 #include <utility>
10 10
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after
204 NTPSnippetsServiceShutdown()); 204 NTPSnippetsServiceShutdown());
205 enabled_ = false; 205 enabled_ = false;
206 } 206 }
207 207
208 void NTPSnippetsService::FetchSnippets() { 208 void NTPSnippetsService::FetchSnippets() {
209 FetchSnippetsFromHosts(GetSuggestionsHosts()); 209 FetchSnippetsFromHosts(GetSuggestionsHosts());
210 } 210 }
211 211
212 void NTPSnippetsService::FetchSnippetsFromHosts( 212 void NTPSnippetsService::FetchSnippetsFromHosts(
213 const std::set<std::string>& hosts) { 213 const std::set<std::string>& hosts) {
214 snippets_fetcher_->FetchSnippetsFromHosts(hosts, kMaxSnippetCount); 214 snippets_fetcher_->FetchSnippetsFromHosts(
215 hosts, application_language_code_, kMaxSnippetCount);
215 } 216 }
216 217
217 void NTPSnippetsService::RescheduleFetching() { 218 void NTPSnippetsService::RescheduleFetching() {
218 // The scheduler only exists on Android so far, it's null on other platforms. 219 // The scheduler only exists on Android so far, it's null on other platforms.
219 if (!scheduler_) 220 if (!scheduler_)
220 return; 221 return;
221 222
222 if (enabled_) { 223 if (enabled_) {
223 base::Time now = base::Time::Now(); 224 base::Time now = base::Time::Now();
224 scheduler_->Schedule( 225 scheduler_->Schedule(
(...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after
484 if (snippet->expiry_date() < next_expiry) 485 if (snippet->expiry_date() < next_expiry)
485 next_expiry = snippet->expiry_date(); 486 next_expiry = snippet->expiry_date();
486 } 487 }
487 DCHECK_GT(next_expiry, expiry); 488 DCHECK_GT(next_expiry, expiry);
488 expiry_timer_.Start(FROM_HERE, next_expiry - expiry, 489 expiry_timer_.Start(FROM_HERE, next_expiry - expiry,
489 base::Bind(&NTPSnippetsService::LoadingSnippetsFinished, 490 base::Bind(&NTPSnippetsService::LoadingSnippetsFinished,
490 base::Unretained(this))); 491 base::Unretained(this)));
491 } 492 }
492 493
493 } // namespace ntp_snippets 494 } // namespace ntp_snippets
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698