| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "components/ntp_snippets/features.h" | 5 #include "components/ntp_snippets/features.h" |
| 6 | 6 |
| 7 #include "base/strings/string_number_conversions.h" | 7 #include "base/strings/string_number_conversions.h" |
| 8 #include "components/variations/variations_associated_data.h" | 8 #include "components/variations/variations_associated_data.h" |
| 9 | 9 |
| 10 namespace ntp_snippets { | 10 namespace ntp_snippets { |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 const base::Feature kDownloadSuggestionsFeature{ | 24 const base::Feature kDownloadSuggestionsFeature{ |
| 25 "NTPDownloadSuggestions", base::FEATURE_DISABLED_BY_DEFAULT}; | 25 "NTPDownloadSuggestions", base::FEATURE_DISABLED_BY_DEFAULT}; |
| 26 | 26 |
| 27 const base::Feature kPhysicalWebPageSuggestionsFeature{ | 27 const base::Feature kPhysicalWebPageSuggestionsFeature{ |
| 28 "NTPPhysicalWebPageSuggestions", base::FEATURE_DISABLED_BY_DEFAULT}; | 28 "NTPPhysicalWebPageSuggestions", base::FEATURE_DISABLED_BY_DEFAULT}; |
| 29 | 29 |
| 30 const base::Feature kContentSuggestionsFeature{ | 30 const base::Feature kContentSuggestionsFeature{ |
| 31 "NTPSnippets", base::FEATURE_ENABLED_BY_DEFAULT}; | 31 "NTPSnippets", base::FEATURE_ENABLED_BY_DEFAULT}; |
| 32 | 32 |
| 33 const base::Feature kSectionDismissalFeature{ | 33 const base::Feature kSectionDismissalFeature{ |
| 34 "NTPSuggestionsSectionDismissal", base::FEATURE_DISABLED_BY_DEFAULT}; | 34 "NTPSuggestionsSectionDismissal", base::FEATURE_ENABLED_BY_DEFAULT}; |
| 35 | 35 |
| 36 const base::Feature kForeignSessionsSuggestionsFeature{ | 36 const base::Feature kForeignSessionsSuggestionsFeature{ |
| 37 "NTPForeignSessionsSuggestions", base::FEATURE_DISABLED_BY_DEFAULT}; | 37 "NTPForeignSessionsSuggestions", base::FEATURE_DISABLED_BY_DEFAULT}; |
| 38 | 38 |
| 39 int GetParamAsInt(const base::Feature& feature, | 39 int GetParamAsInt(const base::Feature& feature, |
| 40 const std::string& param_name, | 40 const std::string& param_name, |
| 41 const int default_value) { | 41 const int default_value) { |
| 42 std::string value_as_string = | 42 std::string value_as_string = |
| 43 variations::GetVariationParamValueByFeature(feature, param_name); | 43 variations::GetVariationParamValueByFeature(feature, param_name); |
| 44 int value_as_int = 0; | 44 int value_as_int = 0; |
| 45 if (!base::StringToInt(value_as_string, &value_as_int)) { | 45 if (!base::StringToInt(value_as_string, &value_as_int)) { |
| 46 if (!value_as_string.empty()) { | 46 if (!value_as_string.empty()) { |
| 47 LOG(WARNING) << "Failed to parse variation param " << param_name | 47 LOG(WARNING) << "Failed to parse variation param " << param_name |
| 48 << " with string value " << value_as_string | 48 << " with string value " << value_as_string |
| 49 << " under feature " << feature.name | 49 << " under feature " << feature.name |
| 50 << " into an int. Falling back to default value of " | 50 << " into an int. Falling back to default value of " |
| 51 << default_value; | 51 << default_value; |
| 52 } | 52 } |
| 53 value_as_int = default_value; | 53 value_as_int = default_value; |
| 54 } | 54 } |
| 55 return value_as_int; | 55 return value_as_int; |
| 56 } | 56 } |
| 57 | 57 |
| 58 } // namespace ntp_snippets | 58 } // namespace ntp_snippets |
| OLD | NEW |