| Index: components/ntp_snippets/features.cc
|
| diff --git a/components/ntp_snippets/features.cc b/components/ntp_snippets/features.cc
|
| index 0527eddfc4df89152f365ae26f5bc5fcb910a7d1..7baf3d7bc0ac482e80ff664f7633c940173b4cbb 100644
|
| --- a/components/ntp_snippets/features.cc
|
| +++ b/components/ntp_snippets/features.cc
|
| @@ -4,6 +4,9 @@
|
|
|
| #include "components/ntp_snippets/features.h"
|
|
|
| +#include "base/strings/string_number_conversions.h"
|
| +#include "components/variations/variations_associated_data.h"
|
| +
|
| namespace ntp_snippets {
|
|
|
| const base::Feature kArticleSuggestionsFeature{
|
| @@ -27,4 +30,26 @@ const base::Feature kPhysicalWebPageSuggestionsFeature{
|
| const base::Feature kContentSuggestionsFeature{
|
| "NTPSnippets", base::FEATURE_ENABLED_BY_DEFAULT};
|
|
|
| +const base::Feature kForeignSessionsSuggestionsFeature{
|
| + "NTPForeignSessionsSuggestions", base::FEATURE_DISABLED_BY_DEFAULT};
|
| +
|
| +int GetParamAsInt(const base::Feature& feature,
|
| + const std::string& param_name,
|
| + const int default_value) {
|
| + std::string value_as_string =
|
| + variations::GetVariationParamValueByFeature(feature, param_name);
|
| + int value_as_int = 0;
|
| + if (!base::StringToInt(value_as_string, &value_as_int)) {
|
| + if (!value_as_string.empty()) {
|
| + LOG(WARNING) << "Failed to parse variation param " << param_name
|
| + << " with string value " << value_as_string
|
| + << " under feature " << feature.name
|
| + << " into an int. Falling back to default value of "
|
| + << default_value;
|
| + }
|
| + value_as_int = default_value;
|
| + }
|
| + return value_as_int;
|
| +}
|
| +
|
| } // namespace ntp_snippets
|
|
|