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

Unified Diff: components/autofill/core/browser/personal_data_manager.cc

Issue 964643003: Autofill - Don't save a credit card locally if it's already saved in Wallet. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | components/autofill/core/browser/personal_data_manager_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/autofill/core/browser/personal_data_manager.cc
diff --git a/components/autofill/core/browser/personal_data_manager.cc b/components/autofill/core/browser/personal_data_manager.cc
index 4981866007f508448b05ef8e40c4252dbfc9523e..8784de092e86adcd623ee8aa55d6758c0960416a 100644
--- a/components/autofill/core/browser/personal_data_manager.cc
+++ b/components/autofill/core/browser/personal_data_manager.cc
@@ -447,7 +447,7 @@ bool PersonalDataManager::ImportFormData(
// Don't import if we already have this info.
// Don't present an infobar if we have already saved this card number.
bool merged_credit_card = false;
- if (local_imported_credit_card.get()) {
+ if (local_imported_credit_card) {
for (CreditCard* card : local_credit_cards_) {
// Make a local copy so that the data in |local_credit_cards_| isn't
// modified directly by the UpdateFromImportedCard() call.
@@ -462,6 +462,19 @@ bool PersonalDataManager::ImportFormData(
}
}
+ // Also don't offer to save if we already have this stored as a full wallet
+ // card. (In particular this comes up just after filling and submitting a
+ // Wallet card.)
+ if (local_imported_credit_card) {
+ for (CreditCard* card : server_credit_cards_) {
+ if (card->record_type() == CreditCard::FULL_SERVER_CARD &&
+ local_imported_credit_card->IsLocalDuplicateOfServerCard(*card)) {
+ local_imported_credit_card.reset();
+ break;
+ }
+ }
+ }
+
if (imported_profile.get()) {
// We always save imported profiles.
SaveImportedProfile(*imported_profile);
« no previous file with comments | « no previous file | components/autofill/core/browser/personal_data_manager_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698