| 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 5869644f963492b331dfbcc2dc5eb70accf87db8..8e888abf50f507f447aac0215d3906ed9a0deb9f 100644
|
| --- a/components/ntp_snippets/ntp_snippets_fetcher.cc
|
| +++ b/components/ntp_snippets/ntp_snippets_fetcher.cc
|
| @@ -158,6 +158,7 @@ NTPSnippetsFetcher::NTPSnippetsFetcher(
|
| SigninManagerBase* signin_manager,
|
| OAuth2TokenService* token_service,
|
| scoped_refptr<URLRequestContextGetter> url_request_context_getter,
|
| + PrefService* pref_service,
|
| const ParseJSONCallback& parse_json_callback,
|
| bool is_stable_channel)
|
| : OAuth2TokenService::Consumer("ntp_snippets"),
|
| @@ -172,6 +173,9 @@ NTPSnippetsFetcher::NTPSnippetsFetcher(
|
| : CHROME_READER_API),
|
| is_stable_channel_(is_stable_channel),
|
| tick_clock_(new base::DefaultTickClock()),
|
| + request_throttler_(
|
| + pref_service,
|
| + RequestThrottler::RequestType::CONTENT_SUGGESTION_FETCHER),
|
| weak_ptr_factory_(this) {
|
| // Parse the variation parameters and set the defaults if missing.
|
| std::string personalization = variations::GetVariationParamValue(
|
| @@ -214,7 +218,11 @@ void NTPSnippetsFetcher::SetCallback(
|
| void NTPSnippetsFetcher::FetchSnippetsFromHosts(
|
| const std::set<std::string>& hosts,
|
| const std::string& language_code,
|
| - int count) {
|
| + int count,
|
| + bool force_request) {
|
| + if (!request_throttler_.DemandQuotaForRequest(force_request))
|
| + return;
|
| +
|
| hosts_ = hosts;
|
| fetch_start_time_ = tick_clock_->NowTicks();
|
|
|
|
|