| 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/metrics/field_trial.h" | 8 #include "base/metrics/field_trial.h" |
| 9 #include "base/strings/string_util.h" | 9 #include "base/strings/string_util.h" |
| 10 #include "build/build_config.h" | 10 #include "build/build_config.h" |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 67 // Users who have enabled a passphrase have chosen to not make their sync | 67 // Users who have enabled a passphrase have chosen to not make their sync |
| 68 // information accessible to Google. Since upload makes credit card data | 68 // information accessible to Google. Since upload makes credit card data |
| 69 // available to other Google systems, disable it for passphrase users. | 69 // available to other Google systems, disable it for passphrase users. |
| 70 // We can't determine the passphrase state until the sync backend is | 70 // We can't determine the passphrase state until the sync backend is |
| 71 // initialized so disable upload if sync is not yet available. | 71 // initialized so disable upload if sync is not yet available. |
| 72 if (!sync_service->IsBackendInitialized() || | 72 if (!sync_service->IsBackendInitialized() || |
| 73 sync_service->IsUsingSecondaryPassphrase()) { | 73 sync_service->IsUsingSecondaryPassphrase()) { |
| 74 return false; | 74 return false; |
| 75 } | 75 } |
| 76 | 76 |
| 77 // Check Payments integration setting. | 77 // Check Payments integration user setting. |
| 78 if (!pref_service->GetBoolean(prefs::kAutofillWalletSyncExperimentEnabled) || | 78 if (!pref_service->GetBoolean(prefs::kAutofillWalletImportEnabled)) |
| 79 !pref_service->GetBoolean(prefs::kAutofillWalletImportEnabled)) { | |
| 80 return false; | 79 return false; |
| 81 } | |
| 82 | 80 |
| 83 // Check that the user is logged into a supported domain. | 81 // Check that the user is logged into a supported domain. |
| 84 if (user_email.empty()) | 82 if (user_email.empty()) |
| 85 return false; | 83 return false; |
| 86 std::string domain = gaia::ExtractDomainName(user_email); | 84 std::string domain = gaia::ExtractDomainName(user_email); |
| 87 if (!(domain == "googlemail.com" || domain == "gmail.com" || | 85 if (!(domain == "googlemail.com" || domain == "gmail.com" || |
| 88 domain == "google.com")) { | 86 domain == "google.com")) { |
| 89 return false; | 87 return false; |
| 90 } | 88 } |
| 91 | 89 |
| 92 // With the user settings and logged in state verified, now we can consult the | 90 // With the user settings and logged in state verified, now we can consult the |
| 93 // command-line flags and experiment settings. | 91 // command-line flags and experiment settings. |
| 94 if (base::CommandLine::ForCurrentProcess()->HasSwitch( | 92 if (base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 95 switches::kEnableOfferUploadCreditCards)) { | 93 switches::kEnableOfferUploadCreditCards)) { |
| 96 return true; | 94 return true; |
| 97 } | 95 } |
| 98 if (base::CommandLine::ForCurrentProcess()->HasSwitch( | 96 if (base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 99 switches::kDisableOfferUploadCreditCards)) { | 97 switches::kDisableOfferUploadCreditCards)) { |
| 100 return false; | 98 return false; |
| 101 } | 99 } |
| 102 | 100 |
| 103 return !group_name.empty() && group_name != "Disabled"; | 101 return !group_name.empty() && group_name != "Disabled"; |
| 104 } | 102 } |
| 105 | 103 |
| 106 } // namespace autofill | 104 } // namespace autofill |
| OLD | NEW |