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

Side by Side Diff: components/autofill/core/browser/autofill_experiments.cc

Issue 2649623002: [Autofill] Uses uniform margin for icon, label and sublabel in popup (Closed)
Patch Set: Moves label margin calculation to constructor. Created 3 years, 10 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
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/autofill/core/browser/autofill_experiments.h" 5 #include "components/autofill/core/browser/autofill_experiments.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/feature_list.h" 8 #include "base/feature_list.h"
9 #include "base/metrics/field_trial.h" 9 #include "base/metrics/field_trial.h"
10 #include "base/strings/string16.h" 10 #include "base/strings/string16.h"
(...skipping 21 matching lines...) Expand all
32 "AutofillCreditCardPopupLayout", base::FEATURE_DISABLED_BY_DEFAULT}; 32 "AutofillCreditCardPopupLayout", base::FEATURE_DISABLED_BY_DEFAULT};
33 const char kAutofillCreditCardPopupBackgroundColorKey[] = "background_color"; 33 const char kAutofillCreditCardPopupBackgroundColorKey[] = "background_color";
34 const char kAutofillCreditCardPopupDividerColorKey[] = "dropdown_divider_color"; 34 const char kAutofillCreditCardPopupDividerColorKey[] = "dropdown_divider_color";
35 const char kAutofillCreditCardPopupValueBoldKey[] = "is_value_bold"; 35 const char kAutofillCreditCardPopupValueBoldKey[] = "is_value_bold";
36 const char kAutofillCreditCardPopupIsValueAndLabelInSingleLineKey[] = 36 const char kAutofillCreditCardPopupIsValueAndLabelInSingleLineKey[] =
37 "is_value_and_label_in_single_line"; 37 "is_value_and_label_in_single_line";
38 const char kAutofillPopupDropdownItemHeightKey[] = 38 const char kAutofillPopupDropdownItemHeightKey[] =
39 "dropdown_item_height"; 39 "dropdown_item_height";
40 const char kAutofillCreditCardPopupIsIconAtStartKey[] = 40 const char kAutofillCreditCardPopupIsIconAtStartKey[] =
41 "is_credit_card_icon_at_start"; 41 "is_credit_card_icon_at_start";
42 const char kAutofillPopupMarginKey[] = "margin";
42 43
43 namespace { 44 namespace {
44 45
45 // Returns parameter value in |kAutofillCreditCardPopupLayout| feature, or 0 if 46 // Returns parameter value in |kAutofillCreditCardPopupLayout| feature, or 0 if
46 // parameter is not specified. 47 // parameter is not specified.
47 unsigned int GetCreditCardPopupParameterUintValue( 48 unsigned int GetCreditCardPopupParameterUintValue(
48 const std::string& param_name) { 49 const std::string& param_name) {
49 unsigned int value; 50 unsigned int value;
50 const std::string param_value = variations::GetVariationParamValueByFeature( 51 const std::string param_value = variations::GetVariationParamValueByFeature(
51 kAutofillCreditCardPopupLayout, param_name); 52 kAutofillCreditCardPopupLayout, param_name);
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
121 IDS_AUTOFILL_CREDIT_CARD_EXPIRATION_DATE_LABEL_AND_ABBR); 122 IDS_AUTOFILL_CREDIT_CARD_EXPIRATION_DATE_LABEL_AND_ABBR);
122 if (!format_string.empty()) { 123 if (!format_string.empty()) {
123 suggestion->value.append(l10n_util::GetStringFUTF16( 124 suggestion->value.append(l10n_util::GetStringFUTF16(
124 IDS_AUTOFILL_CREDIT_CARD_EXPIRATION_DATE_LABEL_AND_ABBR, 125 IDS_AUTOFILL_CREDIT_CARD_EXPIRATION_DATE_LABEL_AND_ABBR,
125 suggestion->label)); 126 suggestion->label));
126 } 127 }
127 suggestion->label.clear(); 128 suggestion->label.clear();
128 } 129 }
129 } 130 }
130 131
132 unsigned int GetPopupMargin() {
133 return GetCreditCardPopupParameterUintValue(kAutofillPopupMarginKey);
134 }
135
131 bool OfferStoreUnmaskedCards() { 136 bool OfferStoreUnmaskedCards() {
132 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) 137 #if defined(OS_LINUX) && !defined(OS_CHROMEOS)
133 // The checkbox can be forced on with a flag, but by default we don't store 138 // The checkbox can be forced on with a flag, but by default we don't store
134 // on Linux due to lack of system keychain integration. See crbug.com/162735 139 // on Linux due to lack of system keychain integration. See crbug.com/162735
135 return base::CommandLine::ForCurrentProcess()->HasSwitch( 140 return base::CommandLine::ForCurrentProcess()->HasSwitch(
136 switches::kEnableOfferStoreUnmaskedWalletCards); 141 switches::kEnableOfferStoreUnmaskedWalletCards);
137 #else 142 #else
138 // Query the field trial before checking command line flags to ensure UMA 143 // Query the field trial before checking command line flags to ensure UMA
139 // reports the correct group. 144 // reports the correct group.
140 std::string group_name = 145 std::string group_name =
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
197 } 202 }
198 if (base::CommandLine::ForCurrentProcess()->HasSwitch( 203 if (base::CommandLine::ForCurrentProcess()->HasSwitch(
199 switches::kDisableOfferUploadCreditCards)) { 204 switches::kDisableOfferUploadCreditCards)) {
200 return false; 205 return false;
201 } 206 }
202 207
203 return !group_name.empty() && group_name != "Disabled"; 208 return !group_name.empty() && group_name != "Disabled";
204 } 209 }
205 210
206 } // namespace autofill 211 } // namespace autofill
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698