Chromium Code Reviews| Index: components/ntp_snippets/request_throttler.h |
| diff --git a/components/ntp_snippets/request_throttler.h b/components/ntp_snippets/request_throttler.h |
| index a81bcdac9f632b46e7c64962bb964e09d97bfe08..9a804663a86e7e72d3e8f89fd0be74f16402ea62 100644 |
| --- a/components/ntp_snippets/request_throttler.h |
| +++ b/components/ntp_snippets/request_throttler.h |
| @@ -5,6 +5,7 @@ |
| #ifndef COMPONENTS_NTP_SNIPPETS_REQUEST_THROTTLER_H_ |
| #define COMPONENTS_NTP_SNIPPETS_REQUEST_THROTTLER_H_ |
| +#include <limits.h> |
|
Marc Treib
2016/08/09 14:04:53
Move to the .cc
jkrcal
2016/08/10 10:27:26
Done.
|
| #include <string> |
| #include "base/macros.h" |
| @@ -40,7 +41,8 @@ class RequestThrottler { |
| public: |
| // Enumeration listing all current applications of the request counter. |
| enum class RequestType { |
| - CONTENT_SUGGESTION_FETCHER |
| + CONTENT_SUGGESTION_FETCHER, |
| + CONTENT_SUGGESTION_THUMBNAIL, |
| }; |
| RequestThrottler(PrefService* pref_service, RequestType type); |
| @@ -49,10 +51,11 @@ class RequestThrottler { |
| static void RegisterProfilePrefs(PrefRegistrySimple* registry); |
| // Returns whether quota is available for another request and reports this |
| - // information to UMA. Forced requests always return true -- should be only |
| - // used for requests initiated by the user (if it is safe to assume that all |
| - // users cannot generate an amount of requests we cannot handle). |
| - bool DemandQuotaForRequest(bool force_request); |
| + // information to UMA. Interactive requests should be always granted (upon |
| + // standard conditions) and should be only used for requests initiated by the |
| + // user (if it is safe to assume that all users cannot generate an amount of |
| + // requests we cannot handle). |
| + bool DemandQuotaForRequest(bool interactive_request); |
| private: |
| friend class RequestThrottlerTest; |
| @@ -67,8 +70,9 @@ class RequestThrottler { |
| const char* GetRequestTypeAsString() const; |
| - int GetCount() const; |
| - void SetCount(int count); |
| + int GetQuota(bool interactive_request) const; |
| + int GetCount(bool interactive_request) const; |
| + void SetCount(bool interactive_request, int count); |
| int GetDay() const; |
| void SetDay(int day); |
| bool HasDay() const; |
| @@ -76,8 +80,9 @@ class RequestThrottler { |
| PrefService* pref_service_; |
| const RequestTypeInfo& type_info_; |
| - // It comes from a variation parameter or |default_quota| as a fallback. |
| + // The quotas come from variation parameters or default quotas as a fallback. |
|
Marc Treib
2016/08/09 14:04:53
I'd formulate this the other way around: The quota
jkrcal
2016/08/10 10:27:26
Done.
|
| int quota_; |
| + int interactive_quota_; |
| // The histograms for reporting the requests of the given |type_|. |
| base::HistogramBase* histogram_request_status_; |