Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 <algorithm> | 7 #include <algorithm> |
| 8 #include <functional> | 8 #include <functional> |
| 9 #include <iterator> | 9 #include <iterator> |
| 10 | 10 |
| (...skipping 647 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 658 if (existing_credit_card->record_type() == CreditCard::MASKED_SERVER_CARD) { | 658 if (existing_credit_card->record_type() == CreditCard::MASKED_SERVER_CARD) { |
| 659 database_->UnmaskServerCreditCard(credit_card.server_id(), | 659 database_->UnmaskServerCreditCard(credit_card.server_id(), |
| 660 credit_card.number()); | 660 credit_card.number()); |
| 661 } else { | 661 } else { |
| 662 database_->MaskServerCreditCard(credit_card.server_id()); | 662 database_->MaskServerCreditCard(credit_card.server_id()); |
| 663 } | 663 } |
| 664 | 664 |
| 665 Refresh(); | 665 Refresh(); |
| 666 } | 666 } |
| 667 | 667 |
| 668 void PersonalDataManager::ResetFullServerCard(const std::string& guid) { | |
| 669 for (const CreditCard* card : server_credit_cards_) { | |
| 670 if (card->guid() == guid) { | |
| 671 DCHECK_EQ(card->record_type(), CreditCard::FULL_SERVER_CARD); | |
| 672 CreditCard card_copy = *card; | |
| 673 card_copy.set_record_type(CreditCard::MASKED_SERVER_CARD); | |
| 674 card_copy.SetNumber(card->LastFourDigits()); | |
| 675 UpdateServerCreditCard(card_copy); | |
| 676 break; | |
|
please use gerrit instead
2015/03/12 20:40:12
Nit: "return" here and "NOTREACHED()" after the lo
Evan Stade
2015/03/12 21:28:03
the general pattern in PDM is to fail silently if
| |
| 677 } | |
| 678 } | |
| 679 } | |
| 680 | |
| 668 void PersonalDataManager::ResetFullServerCards() { | 681 void PersonalDataManager::ResetFullServerCards() { |
| 669 for (const CreditCard* card : server_credit_cards_) { | 682 for (const CreditCard* card : server_credit_cards_) { |
| 670 CreditCard card_copy = *card; | 683 CreditCard card_copy = *card; |
| 671 if (card_copy.record_type() == CreditCard::FULL_SERVER_CARD) { | 684 if (card_copy.record_type() == CreditCard::FULL_SERVER_CARD) { |
| 672 card_copy.set_record_type(CreditCard::MASKED_SERVER_CARD); | 685 card_copy.set_record_type(CreditCard::MASKED_SERVER_CARD); |
| 673 card_copy.SetNumber(card->LastFourDigits()); | 686 card_copy.SetNumber(card->LastFourDigits()); |
| 674 UpdateServerCreditCard(card_copy); | 687 UpdateServerCreditCard(card_copy); |
| 675 } | 688 } |
| 676 } | 689 } |
| 677 } | 690 } |
| (...skipping 659 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1337 } | 1350 } |
| 1338 if (IsExperimentalWalletIntegrationEnabled() && | 1351 if (IsExperimentalWalletIntegrationEnabled() && |
| 1339 pref_service_->GetBoolean(prefs::kAutofillWalletImportEnabled)) { | 1352 pref_service_->GetBoolean(prefs::kAutofillWalletImportEnabled)) { |
| 1340 profiles_.insert( | 1353 profiles_.insert( |
| 1341 profiles_.end(), server_profiles_.begin(), server_profiles_.end()); | 1354 profiles_.end(), server_profiles_.begin(), server_profiles_.end()); |
| 1342 } | 1355 } |
| 1343 return profiles_; | 1356 return profiles_; |
| 1344 } | 1357 } |
| 1345 | 1358 |
| 1346 } // namespace autofill | 1359 } // namespace autofill |
| OLD | NEW |