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

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

Issue 1818403003: Don't ever attempt to upload credit cards whose numbers match. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2661
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 1377 matching lines...) Expand 10 before | Expand all | Expand 10 after
1388 // If we should not return the local card, return that we merged it, 1388 // If we should not return the local card, return that we merged it,
1389 // without setting |imported_credit_card|. 1389 // without setting |imported_credit_card|.
1390 if (!should_return_local_card) 1390 if (!should_return_local_card)
1391 return true; 1391 return true;
1392 1392
1393 break; 1393 break;
1394 } 1394 }
1395 } 1395 }
1396 1396
1397 // Also don't offer to save if we already have this stored as a server card. 1397 // Also don't offer to save if we already have this stored as a server card.
1398 // We only check the number because if the new card has the same number as the
1399 // server card, upload is guaranteed to fail. There's no mechanism for entries
1400 // with the same number but different names or expiration dates as there is
1401 // for local cards.
1398 for (const CreditCard* card : server_credit_cards_) { 1402 for (const CreditCard* card : server_credit_cards_) {
1399 if (candidate_credit_card.IsLocalDuplicateOfServerCard(*card)) 1403 if (candidate_credit_card.HasSameNumberAs(*card))
1400 return false; 1404 return false;
1401 } 1405 }
1402 1406
1403 imported_credit_card->reset(new CreditCard(candidate_credit_card)); 1407 imported_credit_card->reset(new CreditCard(candidate_credit_card));
1404 return true; 1408 return true;
1405 } 1409 }
1406 1410
1407 const std::vector<AutofillProfile*>& PersonalDataManager::GetProfiles( 1411 const std::vector<AutofillProfile*>& PersonalDataManager::GetProfiles(
1408 bool record_metrics) const { 1412 bool record_metrics) const {
1409 profiles_.clear(); 1413 profiles_.clear();
1410 profiles_.insert(profiles_.end(), web_profiles().begin(), 1414 profiles_.insert(profiles_.end(), web_profiles().begin(),
1411 web_profiles().end()); 1415 web_profiles().end());
1412 if (IsExperimentalWalletIntegrationEnabled() && 1416 if (IsExperimentalWalletIntegrationEnabled() &&
1413 pref_service_->GetBoolean(prefs::kAutofillWalletImportEnabled)) { 1417 pref_service_->GetBoolean(prefs::kAutofillWalletImportEnabled)) {
1414 profiles_.insert( 1418 profiles_.insert(
1415 profiles_.end(), server_profiles_.begin(), server_profiles_.end()); 1419 profiles_.end(), server_profiles_.begin(), server_profiles_.end());
1416 } 1420 }
1417 return profiles_; 1421 return profiles_;
1418 } 1422 }
1419 1423
1420 } // namespace autofill 1424 } // 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