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

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

Issue 2109643003: Add billing address to masked server credit cards. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add version_66.sql to the build file. Created 4 years, 5 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
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 567 matching lines...) Expand 10 before | Expand all | Expand 10 after
578 if (existing_credit_card->record_type() == CreditCard::MASKED_SERVER_CARD) { 578 if (existing_credit_card->record_type() == CreditCard::MASKED_SERVER_CARD) {
579 database_->UnmaskServerCreditCard(credit_card, 579 database_->UnmaskServerCreditCard(credit_card,
580 credit_card.number()); 580 credit_card.number());
581 } else { 581 } else {
582 database_->MaskServerCreditCard(credit_card.server_id()); 582 database_->MaskServerCreditCard(credit_card.server_id());
583 } 583 }
584 584
585 Refresh(); 585 Refresh();
586 } 586 }
587 587
588 void PersonalDataManager::UpdateServerCardBillingAddress(
589 const CreditCard& credit_card) {
590 DCHECK_NE(CreditCard::LOCAL_CARD, credit_card.record_type());
591
592 if (!database_.get())
593 return;
594
595 CreditCard* existing_credit_card = nullptr;
596 for (auto it : server_credit_cards_) {
597 if (credit_card.guid() == it->guid()) {
598 existing_credit_card = it;
599 break;
600 }
601 }
602 if (!existing_credit_card
603 || existing_credit_card->billing_address_id() ==
604 credit_card.billing_address_id()) {
605 return;
606 }
607
608 existing_credit_card->set_billing_address_id(
609 credit_card.billing_address_id());
610 database_->UpdateServerCardBillingAddress(*existing_credit_card);
611
612 Refresh();
613 }
614
588 void PersonalDataManager::ResetFullServerCard(const std::string& guid) { 615 void PersonalDataManager::ResetFullServerCard(const std::string& guid) {
589 for (const CreditCard* card : server_credit_cards_) { 616 for (const CreditCard* card : server_credit_cards_) {
590 if (card->guid() == guid) { 617 if (card->guid() == guid) {
591 DCHECK_EQ(card->record_type(), CreditCard::FULL_SERVER_CARD); 618 DCHECK_EQ(card->record_type(), CreditCard::FULL_SERVER_CARD);
592 CreditCard card_copy = *card; 619 CreditCard card_copy = *card;
593 card_copy.set_record_type(CreditCard::MASKED_SERVER_CARD); 620 card_copy.set_record_type(CreditCard::MASKED_SERVER_CARD);
594 card_copy.SetNumber(card->LastFourDigits()); 621 card_copy.SetNumber(card->LastFourDigits());
595 UpdateServerCreditCard(card_copy); 622 UpdateServerCreditCard(card_copy);
596 break; 623 break;
597 } 624 }
(...skipping 1087 matching lines...) Expand 10 before | Expand all | Expand 10 after
1685 if (profile_to_merge->IsVerified()) 1712 if (profile_to_merge->IsVerified())
1686 break; 1713 break;
1687 } 1714 }
1688 } 1715 }
1689 } 1716 }
1690 AutofillMetrics::LogNumberOfProfilesRemovedDuringDedupe( 1717 AutofillMetrics::LogNumberOfProfilesRemovedDuringDedupe(
1691 profiles_to_delete->size()); 1718 profiles_to_delete->size());
1692 } 1719 }
1693 1720
1694 } // namespace autofill 1721 } // namespace autofill
OLDNEW
« no previous file with comments | « components/autofill/core/browser/personal_data_manager.h ('k') | components/autofill/core/browser/webdata/autofill_table.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698