| Index: components/ntp_snippets/remote/json_request.cc
|
| diff --git a/components/ntp_snippets/remote/json_request.cc b/components/ntp_snippets/remote/json_request.cc
|
| index 3f7af6e8b2b7f893cc10e9fb8321da7fabef1914..20c2da47710dca3232dd468cab2f8e08a928a636 100644
|
| --- a/components/ntp_snippets/remote/json_request.cc
|
| +++ b/components/ntp_snippets/remote/json_request.cc
|
| @@ -49,36 +49,25 @@ namespace internal {
|
|
|
| namespace {
|
|
|
| -// Variation parameter for disabling the retry.
|
| -const char kBackground5xxRetriesName[] = "background_5xx_retries_count";
|
| +constexpr base::FeatureParam<int> kBackground5xxRetries{
|
| + &ntp_snippets::kArticleSuggestionsFeature, "background_5xx_retries_count",
|
| + 0};
|
|
|
| const int kMaxExcludedIds = 100;
|
|
|
| // Variation parameter for sending LanguageModel info to the server.
|
| -const char kSendTopLanguagesName[] = "send_top_languages";
|
| +constexpr base::FeatureParam<bool> kSendTopLanguagesParam{
|
| + &kArticleSuggestionsFeature, "send_top_languages", true};
|
|
|
| // Variation parameter for sending UserClassifier info to the server.
|
| -const char kSendUserClassName[] = "send_user_class";
|
| +constexpr base::FeatureParam<bool> kSendUserClassNameParam{
|
| + &kArticleSuggestionsFeature, "send_user_class", false};
|
|
|
| int Get5xxRetryCount(bool interactive_request) {
|
| if (interactive_request) {
|
| return 2;
|
| }
|
| - return std::max(0, variations::GetVariationParamByFeatureAsInt(
|
| - ntp_snippets::kArticleSuggestionsFeature,
|
| - kBackground5xxRetriesName, 0));
|
| -}
|
| -
|
| -bool IsSendingTopLanguagesEnabled() {
|
| - return variations::GetVariationParamByFeatureAsBool(
|
| - ntp_snippets::kArticleSuggestionsFeature, kSendTopLanguagesName,
|
| - /*default_value=*/true);
|
| -}
|
| -
|
| -bool IsSendingUserClassEnabled() {
|
| - return variations::GetVariationParamByFeatureAsBool(
|
| - ntp_snippets::kArticleSuggestionsFeature, kSendUserClassName,
|
| - /*default_value=*/false);
|
| + return std::max(0, kBackground5xxRetries.Get());
|
| }
|
|
|
| // Translate the BCP 47 |language_code| into a posix locale string.
|
| @@ -284,7 +273,7 @@ JsonRequest::Builder& JsonRequest::Builder::SetUrlRequestContextGetter(
|
|
|
| JsonRequest::Builder& JsonRequest::Builder::SetUserClassifier(
|
| const UserClassifier& user_classifier) {
|
| - if (IsSendingUserClassEnabled()) {
|
| + if (kSendUserClassNameParam.Get()) {
|
| user_class_ = GetUserClassString(user_classifier.GetUserClass());
|
| }
|
| return *this;
|
| @@ -412,7 +401,7 @@ void JsonRequest::Builder::PrepareLanguages(
|
| // TODO(jkrcal): Add language model factory for iOS and add fakes to tests so
|
| // that |language_model| is never nullptr. Remove this check and add a DCHECK
|
| // into the constructor.
|
| - if (!language_model_ || !IsSendingTopLanguagesEnabled()) {
|
| + if (!language_model_ || !kSendTopLanguagesParam.Get()) {
|
| return;
|
| }
|
|
|
|
|