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

Unified Diff: components/flags_ui/feature_entry.cc

Issue 2146903002: Clean-up the code for default variations in chrome://flags. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 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
« no previous file with comments | « components/flags_ui/feature_entry.h ('k') | components/flags_ui/feature_entry_macros.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/flags_ui/feature_entry.cc
diff --git a/components/flags_ui/feature_entry.cc b/components/flags_ui/feature_entry.cc
index 53a219c3d55c59d51ca41be641e86eec610b9aa6..47cf080a0f0b4c824da5c0d1ec8ccbfc5a01b9f5 100644
--- a/components/flags_ui/feature_entry.cc
+++ b/components/flags_ui/feature_entry.cc
@@ -41,11 +41,10 @@ base::string16 FeatureEntry::DescriptionForOption(int index) const {
if (index == 0) {
description_id = IDS_GENERIC_EXPERIMENT_CHOICE_DEFAULT;
} else if (index == 1) {
- // Variation 1: the default enabled variation => "Enabled".
description_id = IDS_GENERIC_EXPERIMENT_CHOICE_ENABLED;
} else if (index < num_options - 1) {
- // Variations 2 .. n => "Enabled <description_text>".
- int variation_index = index - 1;
+ // First two options do not correspond to variations.
Alexei Svitkine (slow) 2016/07/13 14:07:13 Nit: I would actually rephrase this slightly, i.e.
+ int variation_index = index - 2;
return l10n_util::GetStringUTF16(IDS_GENERIC_EXPERIMENT_CHOICE_ENABLED) +
base::ASCIIToUTF16(" ") +
base::ASCIIToUTF16(
@@ -86,11 +85,12 @@ const FeatureEntry::FeatureVariation* FeatureEntry::VariationForOption(
type == FeatureEntry::FEATURE_WITH_VARIATIONS_VALUE);
DCHECK_LT(index, num_options);
- if (type == FeatureEntry::FEATURE_WITH_VARIATIONS_VALUE && index > 0 &&
+ if (type == FeatureEntry::FEATURE_WITH_VARIATIONS_VALUE && index > 1 &&
index < num_options - 1) {
// We have no variations for FEATURE_VALUE type. Option at |index|
- // corresponds to variation at |index| - 1 as the first option is "Default".
- return &feature_variations[index - 1];
+ // corresponds to variation at |index| - 2 as the list starts with "Default"
+ // and "Enabled" (with default parameters).
+ return &feature_variations[index - 2];
}
return nullptr;
}
« no previous file with comments | « components/flags_ui/feature_entry.h ('k') | components/flags_ui/feature_entry_macros.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698