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

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

Issue 2146823003: Autofill Credit Card Signin Promo: Put behind Feature (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Initial 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 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/string_number_conversions.h"
10 #include "base/strings/string_util.h" 11 #include "base/strings/string_util.h"
11 #include "build/build_config.h" 12 #include "build/build_config.h"
12 #include "components/autofill/core/common/autofill_pref_names.h" 13 #include "components/autofill/core/common/autofill_pref_names.h"
13 #include "components/autofill/core/common/autofill_switches.h" 14 #include "components/autofill/core/common/autofill_switches.h"
14 #include "components/prefs/pref_service.h" 15 #include "components/prefs/pref_service.h"
15 #include "components/sync_driver/sync_service.h" 16 #include "components/sync_driver/sync_service.h"
17 #include "components/variations/variations_associated_data.h"
16 #include "google_apis/gaia/gaia_auth_util.h" 18 #include "google_apis/gaia/gaia_auth_util.h"
17 19
18 namespace autofill { 20 namespace autofill {
19 21
20 const base::Feature kAutofillProfileCleanup{"AutofillProfileCleanup", 22 const base::Feature kAutofillProfileCleanup{"AutofillProfileCleanup",
21 base::FEATURE_DISABLED_BY_DEFAULT}; 23 base::FEATURE_DISABLED_BY_DEFAULT};
24 const base::Feature kAutofillCreditCardSigninPromo{
25 "AutofillCreditCardSigninPromo", base::FEATURE_DISABLED_BY_DEFAULT};
26 const char kCreditCardSigninPromoImpressionLimitParamKey[] = "impression_limit";
22 27
23 bool IsAutofillEnabled(const PrefService* pref_service) { 28 bool IsAutofillEnabled(const PrefService* pref_service) {
24 return pref_service->GetBoolean(prefs::kAutofillEnabled); 29 return pref_service->GetBoolean(prefs::kAutofillEnabled);
25 } 30 }
26 31
27 bool IsInAutofillSuggestionsDisabledExperiment() { 32 bool IsInAutofillSuggestionsDisabledExperiment() {
28 std::string group_name = 33 std::string group_name =
29 base::FieldTrialList::FindFullName("AutofillEnabled"); 34 base::FieldTrialList::FindFullName("AutofillEnabled");
30 return group_name == "Disabled"; 35 return group_name == "Disabled";
31 } 36 }
32 37
33 bool IsAutofillProfileCleanupEnabled() { 38 bool IsAutofillProfileCleanupEnabled() {
34 return base::FeatureList::IsEnabled(kAutofillProfileCleanup); 39 return base::FeatureList::IsEnabled(kAutofillProfileCleanup);
35 } 40 }
36 41
42 bool IsAutofillCreditCardSigninPromoEnabled() {
43 return base::FeatureList::IsEnabled(kAutofillCreditCardSigninPromo);
44 }
45
46 int GetCreditCardSigninPromoImpressionLimit() {
47 int impression_limit;
48 std::string param_value = variations::GetVariationParamValueByFeature(
49 kAutofillCreditCardSigninPromo,
50 kCreditCardSigninPromoImpressionLimitParamKey);
51 if (!param_value.empty() && base::StringToInt(param_value, &impression_limit))
52 return impression_limit;
53
54 return 0;
55 }
56
37 bool OfferStoreUnmaskedCards() { 57 bool OfferStoreUnmaskedCards() {
38 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) 58 #if defined(OS_LINUX) && !defined(OS_CHROMEOS)
39 // The checkbox can be forced on with a flag, but by default we don't store 59 // The checkbox can be forced on with a flag, but by default we don't store
40 // on Linux due to lack of system keychain integration. See crbug.com/162735 60 // on Linux due to lack of system keychain integration. See crbug.com/162735
41 return base::CommandLine::ForCurrentProcess()->HasSwitch( 61 return base::CommandLine::ForCurrentProcess()->HasSwitch(
42 switches::kEnableOfferStoreUnmaskedWalletCards); 62 switches::kEnableOfferStoreUnmaskedWalletCards);
43 #else 63 #else
44 // Query the field trial before checking command line flags to ensure UMA 64 // Query the field trial before checking command line flags to ensure UMA
45 // reports the correct group. 65 // reports the correct group.
46 std::string group_name = 66 std::string group_name =
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 } 123 }
104 if (base::CommandLine::ForCurrentProcess()->HasSwitch( 124 if (base::CommandLine::ForCurrentProcess()->HasSwitch(
105 switches::kDisableOfferUploadCreditCards)) { 125 switches::kDisableOfferUploadCreditCards)) {
106 return false; 126 return false;
107 } 127 }
108 128
109 return !group_name.empty() && group_name != "Disabled"; 129 return !group_name.empty() && group_name != "Disabled";
110 } 130 }
111 131
112 } // namespace autofill 132 } // namespace autofill
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698