Chromium Code Reviews| 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 } | 80 } |
|
Evan Stade
2016/03/14 23:01:58
nit: no curlies
Justin Donnelly
2016/03/15 17:09:45
Done.
| |
| 82 | 81 |
| 83 // Check that the user is logged into a supported domain. | 82 // Check that the user is logged into a supported domain. |
| 84 if (user_email.empty()) | 83 if (user_email.empty()) |
| 85 return false; | 84 return false; |
| 86 std::string domain = gaia::ExtractDomainName(user_email); | 85 std::string domain = gaia::ExtractDomainName(user_email); |
| 87 if (!(domain == "googlemail.com" || domain == "gmail.com" || | 86 if (!(domain == "googlemail.com" || domain == "gmail.com" || |
| 88 domain == "google.com")) { | 87 domain == "google.com")) { |
| 89 return false; | 88 return false; |
| 90 } | 89 } |
| 91 | 90 |
| 92 // With the user settings and logged in state verified, now we can consult the | 91 // With the user settings and logged in state verified, now we can consult the |
| 93 // command-line flags and experiment settings. | 92 // command-line flags and experiment settings. |
| 94 if (base::CommandLine::ForCurrentProcess()->HasSwitch( | 93 if (base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 95 switches::kEnableOfferUploadCreditCards)) { | 94 switches::kEnableOfferUploadCreditCards)) { |
| 96 return true; | 95 return true; |
| 97 } | 96 } |
| 98 if (base::CommandLine::ForCurrentProcess()->HasSwitch( | 97 if (base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 99 switches::kDisableOfferUploadCreditCards)) { | 98 switches::kDisableOfferUploadCreditCards)) { |
| 100 return false; | 99 return false; |
| 101 } | 100 } |
| 102 | 101 |
| 103 return !group_name.empty() && group_name != "Disabled"; | 102 return !group_name.empty() && group_name != "Disabled"; |
| 104 } | 103 } |
| 105 | 104 |
| 106 } // namespace autofill | 105 } // namespace autofill |
| OLD | NEW |