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 12 matching lines...) Expand all Loading... |
23 | 23 |
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{ |
| 34 "NTPSuggestionsSectionDismissal", base::FEATURE_DISABLED_BY_DEFAULT}; |
| 35 |
33 const base::Feature kForeignSessionsSuggestionsFeature{ | 36 const base::Feature kForeignSessionsSuggestionsFeature{ |
34 "NTPForeignSessionsSuggestions", base::FEATURE_DISABLED_BY_DEFAULT}; | 37 "NTPForeignSessionsSuggestions", base::FEATURE_DISABLED_BY_DEFAULT}; |
35 | 38 |
36 int GetParamAsInt(const base::Feature& feature, | 39 int GetParamAsInt(const base::Feature& feature, |
37 const std::string& param_name, | 40 const std::string& param_name, |
38 const int default_value) { | 41 const int default_value) { |
39 std::string value_as_string = | 42 std::string value_as_string = |
40 variations::GetVariationParamValueByFeature(feature, param_name); | 43 variations::GetVariationParamValueByFeature(feature, param_name); |
41 int value_as_int = 0; | 44 int value_as_int = 0; |
42 if (!base::StringToInt(value_as_string, &value_as_int)) { | 45 if (!base::StringToInt(value_as_string, &value_as_int)) { |
43 if (!value_as_string.empty()) { | 46 if (!value_as_string.empty()) { |
44 LOG(WARNING) << "Failed to parse variation param " << param_name | 47 LOG(WARNING) << "Failed to parse variation param " << param_name |
45 << " with string value " << value_as_string | 48 << " with string value " << value_as_string |
46 << " under feature " << feature.name | 49 << " under feature " << feature.name |
47 << " into an int. Falling back to default value of " | 50 << " into an int. Falling back to default value of " |
48 << default_value; | 51 << default_value; |
49 } | 52 } |
50 value_as_int = default_value; | 53 value_as_int = default_value; |
51 } | 54 } |
52 return value_as_int; | 55 return value_as_int; |
53 } | 56 } |
54 | 57 |
55 } // namespace ntp_snippets | 58 } // namespace ntp_snippets |
OLD | NEW |