Index: components/ntp_snippets/request_throttler.cc |
diff --git a/components/ntp_snippets/request_throttler.cc b/components/ntp_snippets/request_throttler.cc |
index 3055375aacbdc379101f1c12b6ec785c9e5a922d..0a6388169265ec3fba373d7546b2143bde812b67 100644 |
--- a/components/ntp_snippets/request_throttler.cc |
+++ b/components/ntp_snippets/request_throttler.cc |
@@ -19,13 +19,6 @@ |
namespace ntp_snippets { |
-// Used internally for working with a RequestType. |
-struct RequestTypeInfo { |
- const char* name; |
- const char* count_pref; |
- const char* day_pref; |
-}; |
- |
namespace { |
// Enumeration listing all possible outcomes for fetch attempts. Used for UMA |
@@ -38,18 +31,23 @@ enum class RequestStatus { |
REQUEST_STATUS_COUNT |
}; |
+} // namespace |
+ |
+struct RequestThrottler::RequestTypeInfo { |
+ const char* name; |
+ const char* count_pref; |
+ const char* day_pref; |
+ const int default_quota; |
+}; |
+ |
// When adding a new type here, extend also the "RequestCounterTypes" |
// <histogram_suffixes> in histograms.xml with the |name| string. |
-const RequestTypeInfo kRequestTypeInfo[] = { |
+const RequestThrottler::RequestTypeInfo RequestThrottler::kRequestTypeInfo[] = { |
// RequestCounter::RequestType::CONTENT_SUGGESTION_FETCHER, |
{"SuggestionFetcher", prefs::kSnippetFetcherQuotaCount, |
- prefs::kSnippetFetcherQuotaDay}}; |
- |
-} // namespace |
+ prefs::kSnippetFetcherQuotaDay, 50}}; |
-RequestThrottler::RequestThrottler(PrefService* pref_service, |
- RequestType type, |
- int default_quota) |
+RequestThrottler::RequestThrottler(PrefService* pref_service, RequestType type) |
: pref_service_(pref_service), |
type_info_(kRequestTypeInfo[static_cast<int>(type)]) { |
DCHECK(pref_service); |
@@ -61,7 +59,7 @@ RequestThrottler::RequestThrottler(PrefService* pref_service, |
LOG_IF(WARNING, !quota.empty()) |
<< "Invalid variation parameter for quota for " |
<< GetRequestTypeAsString(); |
- quota_ = default_quota; |
+ quota_ = type_info_.default_quota; |
} |
// Since the histogram names are dynamic, we cannot use the standard macros |