| 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/metrics/field_trial.h" | 9 #include "base/metrics/field_trial.h" |
| 9 #include "base/strings/string_util.h" | 10 #include "base/strings/string_util.h" |
| 10 #include "build/build_config.h" | 11 #include "build/build_config.h" |
| 11 #include "components/autofill/core/common/autofill_pref_names.h" | 12 #include "components/autofill/core/common/autofill_pref_names.h" |
| 12 #include "components/autofill/core/common/autofill_switches.h" | 13 #include "components/autofill/core/common/autofill_switches.h" |
| 13 #include "components/prefs/pref_service.h" | 14 #include "components/prefs/pref_service.h" |
| 14 #include "components/sync_driver/sync_service.h" | 15 #include "components/sync_driver/sync_service.h" |
| 15 #include "google_apis/gaia/gaia_auth_util.h" | 16 #include "google_apis/gaia/gaia_auth_util.h" |
| 16 | 17 |
| 17 namespace autofill { | 18 namespace autofill { |
| 18 | 19 |
| 20 const base::Feature kAutofillProfileCleanup{"AutofillProfileCleanup", |
| 21 base::FEATURE_DISABLED_BY_DEFAULT}; |
| 22 |
| 19 bool IsAutofillEnabled(const PrefService* pref_service) { | 23 bool IsAutofillEnabled(const PrefService* pref_service) { |
| 20 return pref_service->GetBoolean(prefs::kAutofillEnabled); | 24 return pref_service->GetBoolean(prefs::kAutofillEnabled); |
| 21 } | 25 } |
| 22 | 26 |
| 23 bool IsInAutofillSuggestionsDisabledExperiment() { | 27 bool IsInAutofillSuggestionsDisabledExperiment() { |
| 24 std::string group_name = | 28 std::string group_name = |
| 25 base::FieldTrialList::FindFullName("AutofillEnabled"); | 29 base::FieldTrialList::FindFullName("AutofillEnabled"); |
| 26 return group_name == "Disabled"; | 30 return group_name == "Disabled"; |
| 27 } | 31 } |
| 28 | 32 |
| 33 bool IsAutofillProfileCleanupEnabled() { |
| 34 return base::FeatureList::IsEnabled(kAutofillProfileCleanup); |
| 35 } |
| 36 |
| 29 bool OfferStoreUnmaskedCards() { | 37 bool OfferStoreUnmaskedCards() { |
| 30 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) | 38 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) |
| 31 // The checkbox can be forced on with a flag, but by default we don't store | 39 // The checkbox can be forced on with a flag, but by default we don't store |
| 32 // on Linux due to lack of system keychain integration. See crbug.com/162735 | 40 // on Linux due to lack of system keychain integration. See crbug.com/162735 |
| 33 return base::CommandLine::ForCurrentProcess()->HasSwitch( | 41 return base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 34 switches::kEnableOfferStoreUnmaskedWalletCards); | 42 switches::kEnableOfferStoreUnmaskedWalletCards); |
| 35 #else | 43 #else |
| 36 // Query the field trial before checking command line flags to ensure UMA | 44 // Query the field trial before checking command line flags to ensure UMA |
| 37 // reports the correct group. | 45 // reports the correct group. |
| 38 std::string group_name = | 46 std::string group_name = |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 95 } | 103 } |
| 96 if (base::CommandLine::ForCurrentProcess()->HasSwitch( | 104 if (base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 97 switches::kDisableOfferUploadCreditCards)) { | 105 switches::kDisableOfferUploadCreditCards)) { |
| 98 return false; | 106 return false; |
| 99 } | 107 } |
| 100 | 108 |
| 101 return !group_name.empty() && group_name != "Disabled"; | 109 return !group_name.empty() && group_name != "Disabled"; |
| 102 } | 110 } |
| 103 | 111 |
| 104 } // namespace autofill | 112 } // namespace autofill |
| OLD | NEW |