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

Side by Side Diff: chrome/android/java/src/org/chromium/chrome/browser/ntp/cards/CardsVariationParameters.java

Issue 2782233002: Drop ntp_snippets::kStudyName in chrome://flags (Closed)
Patch Set: rebase Created 3 years, 8 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 unified diff | Download patch
« no previous file with comments | « no previous file | chrome/browser/about_flags.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 package org.chromium.chrome.browser.ntp.cards; 5 package org.chromium.chrome.browser.ntp.cards;
6 6
7 import android.text.TextUtils; 7 import android.text.TextUtils;
8 8
9 import org.chromium.base.Log; 9 import org.chromium.base.Log;
10 import org.chromium.base.VisibleForTesting; 10 import org.chromium.base.VisibleForTesting;
11 import org.chromium.components.variations.VariationsAssociatedData; 11 import org.chromium.components.variations.VariationsAssociatedData;
12 12
13 import java.util.Map; 13 import java.util.Map;
14 14
15 /** 15 /**
16 * Provides easy access to data for field trials to do with the Cards UI. 16 * Provides easy access to data for field trials to do with the Cards UI.
17 */ 17 */
18 public final class CardsVariationParameters { 18 public final class CardsVariationParameters {
19 /** Map that stores substitution values for params. */ 19 /** Map that stores substitution values for params. */
20 private static Map<String, String> sTestVariationParams; 20 private static Map<String, String> sTestVariationParams;
21 21
22 // Tags are limited to 20 characters. 22 // Tags are limited to 20 characters.
23 private static final String TAG = "CardsVariationParams"; 23 private static final String TAG = "CardsVariationParams";
24 24
25 // Also defined in ntp_snippets_constants.cc 25 // Also defined in ntp_snippets_constants.cc
26 private static final String FIELD_TRIAL_NAME_MAIN = "NTPSnippets";
27 private static final String FIELD_TRIAL_NAME_VISIBILITY = "NTPSnippetsVisibi lity"; 26 private static final String FIELD_TRIAL_NAME_VISIBILITY = "NTPSnippetsVisibi lity";
28 27
29 private static final String PARAM_FAVICON_SERVICE_NAME = "favicons_fetch_fro m_service"; 28 private static final String PARAM_FAVICON_SERVICE_NAME = "favicons_fetch_fro m_service";
30 private static final String PARAM_FIRST_CARD_OFFSET = "first_card_offset"; 29 private static final String PARAM_FIRST_CARD_OFFSET = "first_card_offset";
31 private static final String PARAM_FIRST_CARD_ANIMATION_MAX_RUNS = 30 private static final String PARAM_FIRST_CARD_ANIMATION_MAX_RUNS =
32 "first_card_animation_max_runs"; 31 "first_card_animation_max_runs";
33 private static final String PARAM_SCROLL_BELOW_THE_FOLD = "scroll_below_the_ fold"; 32 private static final String PARAM_SCROLL_BELOW_THE_FOLD = "scroll_below_the_ fold";
34 private static final String PARAM_IGNORE_UPDATES_FOR_EXISTING_SUGGESTIONS = 33 private static final String PARAM_IGNORE_UPDATES_FOR_EXISTING_SUGGESTIONS =
35 "ignore_updates_for_existing_suggestions"; 34 "ignore_updates_for_existing_suggestions";
36 35
37 private static final String PARAM_DISABLED_VALUE = "off"; 36 private static final String PARAM_DISABLED_VALUE = "off";
38 37
39 private static final int FIRST_CARD_ANIMATION_DEFAULT_VALUE = 7; 38 private static final int FIRST_CARD_ANIMATION_DEFAULT_VALUE = 7;
40 39
40 // TODO(sfiera): replace with feature-specific field trials, as has been don e in C++.
41 private static final String FIELD_TRIAL_NAME_MAIN = "NTPSnippets";
42
41 private CardsVariationParameters() {} 43 private CardsVariationParameters() {}
42 44
43 // TODO(jkrcal): Do a proper general fix in VariationsAssociatedData in the spirit of 45 // TODO(jkrcal): Do a proper general fix in VariationsAssociatedData in the spirit of
44 // @Features and ChromeFeatureList. 46 // @Features and ChromeFeatureList.
45 /** 47 /**
46 * Sets the parameter values to use in JUnit tests, since native calls are n ot available there. 48 * Sets the parameter values to use in JUnit tests, since native calls are n ot available there.
47 */ 49 */
48 @VisibleForTesting 50 @VisibleForTesting
49 public static void setTestVariationParams(Map<String, String> variationParam s) { 51 public static void setTestVariationParams(Map<String, String> variationParam s) {
50 sTestVariationParams = variationParams; 52 sTestVariationParams = variationParams;
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 private static String getParamValue(String fieldTrialName, String paramName) { 107 private static String getParamValue(String fieldTrialName, String paramName) {
106 if (sTestVariationParams != null) { 108 if (sTestVariationParams != null) {
107 String value = sTestVariationParams.get(paramName); 109 String value = sTestVariationParams.get(paramName);
108 if (value == null) return ""; 110 if (value == null) return "";
109 return value; 111 return value;
110 } 112 }
111 113
112 return VariationsAssociatedData.getVariationParamValue(fieldTrialName, p aramName); 114 return VariationsAssociatedData.getVariationParamValue(fieldTrialName, p aramName);
113 } 115 }
114 } 116 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/about_flags.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698