Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2109)

Unified Diff: components/ntp_snippets/features.cc

Issue 2279123002: [Sync] Initial implementation of foreign sessions suggestions provider. (Closed)
Patch Set: Updating for comments, again! Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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
« no previous file with comments | « components/ntp_snippets/features.h ('k') | components/ntp_snippets/offline_pages/offline_page_suggestions_provider.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698