Index: components/ntp_snippets/remote/ntp_snippets_fetcher.h |
diff --git a/components/ntp_snippets/remote/ntp_snippets_fetcher.h b/components/ntp_snippets/remote/ntp_snippets_fetcher.h |
index 2d801ac25b858ac06204bfdd88b74fcdd02a8a5e..2bd661e02dde45c0f99dfd3d7071859f7c1479d5 100644 |
--- a/components/ntp_snippets/remote/ntp_snippets_fetcher.h |
+++ b/components/ntp_snippets/remote/ntp_snippets_fetcher.h |
@@ -31,6 +31,8 @@ class Value; |
namespace ntp_snippets { |
+class UserClassifier; |
+ |
// Fetches snippet data for the NTP from the server. |
class NTPSnippetsFetcher : public OAuth2TokenService::Consumer, |
public OAuth2TokenService::Observer, |
@@ -92,7 +94,8 @@ class NTPSnippetsFetcher : public OAuth2TokenService::Consumer, |
PrefService* pref_service, |
CategoryFactory* category_factory, |
const ParseJSONCallback& parse_json_callback, |
- const std::string& api_key); |
+ const std::string& api_key, |
+ const UserClassifier* user_classifier); |
~NTPSnippetsFetcher() override; |
// Set a callback that is called when a new set of snippets are downloaded, |
@@ -165,6 +168,7 @@ class NTPSnippetsFetcher : public OAuth2TokenService::Consumer, |
std::set<std::string> excluded_ids; |
int count_to_fetch; |
bool interactive_request; |
+ std::string user_class; |
RequestParams(); |
~RequestParams(); |
@@ -201,6 +205,8 @@ class NTPSnippetsFetcher : public OAuth2TokenService::Consumer, |
FetchResult result, |
const std::string& extra_message); |
+ bool DemandQuotaForRequest(bool interactive_request); |
+ |
// Authorization for signed-in users. |
SigninManagerBase* signin_manager_; |
OAuth2TokenService* token_service_; |
@@ -253,8 +259,13 @@ class NTPSnippetsFetcher : public OAuth2TokenService::Consumer, |
// Allow for an injectable tick clock for testing. |
std::unique_ptr<base::TickClock> tick_clock_; |
- // Request throttler for limiting requests. |
- RequestThrottler request_throttler_; |
+ // Classifier that tells us how active the user is. Not owned. |
+ const UserClassifier* user_classifier_; |
+ |
+ // Request throttlers for limiting requests for different classes of users. |
+ RequestThrottler request_throttler_rare_ntp_user_; |
+ RequestThrottler request_throttler_active_ntp_user_; |
+ RequestThrottler request_throttler_active_suggestions_consumer_; |
// When a token request gets canceled, we want to retry once. |
bool oauth_token_retried_; |