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

Side by Side Diff: components/ntp_snippets/features.cc

Issue 2595883002: [NTP::SectionOrder] Add a flag to choose category ranker. (Closed)
Patch Set: histograms.xml + jkrcal@ & tschumann comments. Created 4 years 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 unified diff | Download patch
OLDNEW
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 "components/variations/variations_associated_data.h" 7 #include "components/variations/variations_associated_data.h"
8 8
9 namespace ntp_snippets { 9 namespace ntp_snippets {
10 10
(...skipping 26 matching lines...) Expand all
37 37
38 const base::Feature kForeignSessionsSuggestionsFeature{ 38 const base::Feature kForeignSessionsSuggestionsFeature{
39 "NTPForeignSessionsSuggestions", base::FEATURE_DISABLED_BY_DEFAULT}; 39 "NTPForeignSessionsSuggestions", base::FEATURE_DISABLED_BY_DEFAULT};
40 40
41 const base::Feature kFetchMoreFeature{"NTPSuggestionsFetchMore", 41 const base::Feature kFetchMoreFeature{"NTPSuggestionsFetchMore",
42 base::FEATURE_ENABLED_BY_DEFAULT}; 42 base::FEATURE_ENABLED_BY_DEFAULT};
43 43
44 const base::Feature kPreferAmpUrlsFeature{"NTPPreferAmpUrls", 44 const base::Feature kPreferAmpUrlsFeature{"NTPPreferAmpUrls",
45 base::FEATURE_ENABLED_BY_DEFAULT}; 45 base::FEATURE_ENABLED_BY_DEFAULT};
46 46
47 const base::Feature kCategoryRanker{"NTPCategoryRanker",
48 base::FEATURE_ENABLED_BY_DEFAULT};
49
50 CategoryRankerChoice GetSelectedCategoryRanker() {
51 std::string category_ranker_value =
52 variations::GetVariationParamValueByFeature(kCategoryRanker,
53 kCategoryRankerParameter);
54
55 if (category_ranker_value.empty()) {
56 // Default, Enabled or Disabled.
57 return CategoryRankerChoice::CONSTANT;
58 }
59 if (category_ranker_value == kCategoryRankerConstantRanker) {
60 return CategoryRankerChoice::CONSTANT;
61 }
62 if (category_ranker_value == kCategoryRankerClickBasedRanker) {
63 return CategoryRankerChoice::CLICK_BASED;
64 }
65
66 NOTREACHED() << "The " << kCategoryRankerParameter << " parameter value is '"
67 << category_ranker_value << "'";
68 return CategoryRankerChoice::CONSTANT;
69 }
70
47 } // namespace ntp_snippets 71 } // namespace ntp_snippets
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698