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 c0018e7d816ad650ff06f25bdf664b5b64034e2e..c040af7b25f331ca4eccae7d55bc6217ba97c32b 100644 |
--- a/components/ntp_snippets/ntp_snippets_fetcher.cc |
+++ b/components/ntp_snippets/ntp_snippets_fetcher.cc |
@@ -86,6 +86,10 @@ std::string FetchResultToString(NTPSnippetsFetcher::FetchResult result) { |
return "Invalid / empty list."; |
case NTPSnippetsFetcher::FetchResult::OAUTH_TOKEN_ERROR: |
return "Error in obtaining an OAuth2 access token."; |
+ case NTPSnippetsFetcher::FetchResult::INTERACTIVE_QUOTA_ERROR: |
+ return "Out of interactive quota."; |
+ case NTPSnippetsFetcher::FetchResult::NON_INTERACTIVE_QUOTA_ERROR: |
+ return "Out of non-interactive quota."; |
case NTPSnippetsFetcher::FetchResult::RESULT_MAX: |
break; |
} |
@@ -218,8 +222,15 @@ void NTPSnippetsFetcher::FetchSnippetsFromHosts( |
const std::string& language_code, |
int count, |
bool interactive_request) { |
- if (!request_throttler_.DemandQuotaForRequest(interactive_request)) |
+ if (!request_throttler_.DemandQuotaForRequest(interactive_request)) { |
+ FetchFinished( |
+ OptionalSnippets(), |
+ interactive_request ? |
+ FetchResult::INTERACTIVE_QUOTA_ERROR : |
+ FetchResult::NON_INTERACTIVE_QUOTA_ERROR, |
+ /*extra_message=*/std::string()); |
return; |
+ } |
hosts_ = hosts; |
fetch_start_time_ = tick_clock_->NowTicks(); |