| OLD | NEW |
| 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 16 matching lines...) Expand all Loading... |
| 27 const base::Feature kAutofillCreditCardAssist{ | 27 const base::Feature kAutofillCreditCardAssist{ |
| 28 "AutofillCreditCardAssist", base::FEATURE_DISABLED_BY_DEFAULT}; | 28 "AutofillCreditCardAssist", base::FEATURE_DISABLED_BY_DEFAULT}; |
| 29 const base::Feature kAutofillCreditCardSigninPromo{ | 29 const base::Feature kAutofillCreditCardSigninPromo{ |
| 30 "AutofillCreditCardSigninPromo", base::FEATURE_DISABLED_BY_DEFAULT}; | 30 "AutofillCreditCardSigninPromo", base::FEATURE_DISABLED_BY_DEFAULT}; |
| 31 const base::Feature kAutofillProfileCleanup{"AutofillProfileCleanup", | 31 const base::Feature kAutofillProfileCleanup{"AutofillProfileCleanup", |
| 32 base::FEATURE_DISABLED_BY_DEFAULT}; | 32 base::FEATURE_DISABLED_BY_DEFAULT}; |
| 33 const base::Feature kAutofillScanCardholderName{ | 33 const base::Feature kAutofillScanCardholderName{ |
| 34 "AutofillScanCardholderName", base::FEATURE_DISABLED_BY_DEFAULT}; | 34 "AutofillScanCardholderName", base::FEATURE_DISABLED_BY_DEFAULT}; |
| 35 const base::Feature kAutofillCreditCardPopupLayout{ | 35 const base::Feature kAutofillCreditCardPopupLayout{ |
| 36 "AutofillCreditCardPopupLayout", base::FEATURE_DISABLED_BY_DEFAULT}; | 36 "AutofillCreditCardPopupLayout", base::FEATURE_DISABLED_BY_DEFAULT}; |
| 37 const base::Feature kAutofillCreditCardLastUsedDateDisplay{ |
| 38 "AutofillCreditCardLastUsedDateDisplay", base::FEATURE_DISABLED_BY_DEFAULT}; |
| 37 const char kCreditCardSigninPromoImpressionLimitParamKey[] = "impression_limit"; | 39 const char kCreditCardSigninPromoImpressionLimitParamKey[] = "impression_limit"; |
| 38 const char kAutofillCreditCardPopupBackgroundColorKey[] = "background_color"; | 40 const char kAutofillCreditCardPopupBackgroundColorKey[] = "background_color"; |
| 39 const char kAutofillCreditCardPopupDividerColorKey[] = "dropdown_divider_color"; | 41 const char kAutofillCreditCardPopupDividerColorKey[] = "dropdown_divider_color"; |
| 40 const char kAutofillCreditCardPopupValueBoldKey[] = "is_value_bold"; | 42 const char kAutofillCreditCardPopupValueBoldKey[] = "is_value_bold"; |
| 41 const char kAutofillCreditCardPopupIsValueAndLabelInSingleLineKey[] = | 43 const char kAutofillCreditCardPopupIsValueAndLabelInSingleLineKey[] = |
| 42 "is_value_and_label_in_single_line"; | 44 "is_value_and_label_in_single_line"; |
| 43 const char kAutofillPopupDropdownItemHeightKey[] = | 45 const char kAutofillPopupDropdownItemHeightKey[] = |
| 44 "dropdown_item_height"; | 46 "dropdown_item_height"; |
| 45 const char kAutofillCreditCardPopupIsIconAtStartKey[] = | 47 const char kAutofillCreditCardPopupIsIconAtStartKey[] = |
| 46 "is_credit_card_icon_at_start"; | 48 "is_credit_card_icon_at_start"; |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 95 if (!param_value.empty() && base::StringToInt(param_value, &impression_limit)) | 97 if (!param_value.empty() && base::StringToInt(param_value, &impression_limit)) |
| 96 return impression_limit; | 98 return impression_limit; |
| 97 | 99 |
| 98 return 0; | 100 return 0; |
| 99 } | 101 } |
| 100 | 102 |
| 101 bool IsAutofillCreditCardPopupLayoutExperimentEnabled() { | 103 bool IsAutofillCreditCardPopupLayoutExperimentEnabled() { |
| 102 return base::FeatureList::IsEnabled(kAutofillCreditCardPopupLayout); | 104 return base::FeatureList::IsEnabled(kAutofillCreditCardPopupLayout); |
| 103 } | 105 } |
| 104 | 106 |
| 107 bool IsAutofillCreditCardLastUsedDateDisplayExperimentEnabled() { |
| 108 return base::FeatureList::IsEnabled(kAutofillCreditCardLastUsedDateDisplay); |
| 109 } |
| 110 |
| 105 // |GetCreditCardPopupParameterUintValue| returns 0 if experiment parameter is | 111 // |GetCreditCardPopupParameterUintValue| returns 0 if experiment parameter is |
| 106 // not specified. 0 == |SK_ColorTRANSPARENT|. | 112 // not specified. 0 == |SK_ColorTRANSPARENT|. |
| 107 SkColor GetCreditCardPopupBackgroundColor() { | 113 SkColor GetCreditCardPopupBackgroundColor() { |
| 108 return GetCreditCardPopupParameterUintValue( | 114 return GetCreditCardPopupParameterUintValue( |
| 109 kAutofillCreditCardPopupBackgroundColorKey); | 115 kAutofillCreditCardPopupBackgroundColorKey); |
| 110 } | 116 } |
| 111 | 117 |
| 112 SkColor GetCreditCardPopupDividerColor() { | 118 SkColor GetCreditCardPopupDividerColor() { |
| 113 return GetCreditCardPopupParameterUintValue( | 119 return GetCreditCardPopupParameterUintValue( |
| 114 kAutofillCreditCardPopupDividerColorKey); | 120 kAutofillCreditCardPopupDividerColorKey); |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 221 } | 227 } |
| 222 if (base::CommandLine::ForCurrentProcess()->HasSwitch( | 228 if (base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 223 switches::kDisableOfferUploadCreditCards)) { | 229 switches::kDisableOfferUploadCreditCards)) { |
| 224 return false; | 230 return false; |
| 225 } | 231 } |
| 226 | 232 |
| 227 return !group_name.empty() && group_name != "Disabled"; | 233 return !group_name.empty() && group_name != "Disabled"; |
| 228 } | 234 } |
| 229 | 235 |
| 230 } // namespace autofill | 236 } // namespace autofill |
| OLD | NEW |