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

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

Issue 1808613004: Don't ever attempt to upload credit cards whose numbers match. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 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
« no previous file with comments | « components/autofill/core/browser/credit_card_unittest.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/personal_data_manager.h" 5 #include "components/autofill/core/browser/personal_data_manager.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <algorithm> 8 #include <algorithm>
9 #include <list> 9 #include <list>
10 #include <map> 10 #include <map>
(...skipping 1407 matching lines...) Expand 10 before | Expand all | Expand 10 after
1418 // If we should not return the local card, return that we merged it, 1418 // If we should not return the local card, return that we merged it,
1419 // without setting |imported_credit_card|. 1419 // without setting |imported_credit_card|.
1420 if (!should_return_local_card) 1420 if (!should_return_local_card)
1421 return true; 1421 return true;
1422 1422
1423 break; 1423 break;
1424 } 1424 }
1425 } 1425 }
1426 1426
1427 // Also don't offer to save if we already have this stored as a server card. 1427 // Also don't offer to save if we already have this stored as a server card.
1428 // We only check the number because if the new card has the same number as the
1429 // server card, upload is guaranteed to fail. There's no mechanism for entries
1430 // with the same number but different names or expiration dates as there is
1431 // for local cards.
1428 for (const CreditCard* card : server_credit_cards_) { 1432 for (const CreditCard* card : server_credit_cards_) {
1429 if (candidate_credit_card.IsLocalDuplicateOfServerCard(*card)) 1433 if (candidate_credit_card.HasSameNumberAs(*card))
1430 return false; 1434 return false;
1431 } 1435 }
1432 1436
1433 imported_credit_card->reset(new CreditCard(candidate_credit_card)); 1437 imported_credit_card->reset(new CreditCard(candidate_credit_card));
1434 return true; 1438 return true;
1435 } 1439 }
1436 1440
1437 const std::vector<AutofillProfile*>& PersonalDataManager::GetProfiles( 1441 const std::vector<AutofillProfile*>& PersonalDataManager::GetProfiles(
1438 bool record_metrics) const { 1442 bool record_metrics) const {
1439 profiles_.clear(); 1443 profiles_.clear();
1440 profiles_.insert(profiles_.end(), web_profiles().begin(), 1444 profiles_.insert(profiles_.end(), web_profiles().begin(),
1441 web_profiles().end()); 1445 web_profiles().end());
1442 if (pref_service_->GetBoolean(prefs::kAutofillWalletImportEnabled)) { 1446 if (pref_service_->GetBoolean(prefs::kAutofillWalletImportEnabled)) {
1443 profiles_.insert( 1447 profiles_.insert(
1444 profiles_.end(), server_profiles_.begin(), server_profiles_.end()); 1448 profiles_.end(), server_profiles_.begin(), server_profiles_.end());
1445 } 1449 }
1446 return profiles_; 1450 return profiles_;
1447 } 1451 }
1448 1452
1449 } // namespace autofill 1453 } // namespace autofill
OLDNEW
« no previous file with comments | « components/autofill/core/browser/credit_card_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698