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 <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 573 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
584 | 584 |
585 void PersonalDataManager::UpdateServerCreditCard( | 585 void PersonalDataManager::UpdateServerCreditCard( |
586 const CreditCard& credit_card) { | 586 const CreditCard& credit_card) { |
587 DCHECK_NE(CreditCard::LOCAL_CARD, credit_card.record_type()); | 587 DCHECK_NE(CreditCard::LOCAL_CARD, credit_card.record_type()); |
588 | 588 |
589 if (is_off_the_record_ || !database_.get()) | 589 if (is_off_the_record_ || !database_.get()) |
590 return; | 590 return; |
591 | 591 |
592 // Look up by server id, not GUID. | 592 // Look up by server id, not GUID. |
593 CreditCard* existing_credit_card = nullptr; | 593 CreditCard* existing_credit_card = nullptr; |
594 for (auto it : server_credit_cards_) { | 594 for (auto* it : server_credit_cards_) { |
vabr (Chromium)
2016/07/19 07:54:09
optional nit: Could we rename |it| to |server_card
vabr (Chromium)
2016/07/19 07:54:09
optional: Could we make this "const auto*" and cha
vmpstr
2016/07/19 19:49:31
Done.
| |
595 if (credit_card.server_id() == it->server_id()) { | 595 if (credit_card.server_id() == it->server_id()) { |
596 existing_credit_card = it; | 596 existing_credit_card = it; |
597 break; | 597 break; |
598 } | 598 } |
599 } | 599 } |
600 if (!existing_credit_card) | 600 if (!existing_credit_card) |
601 return; | 601 return; |
602 | 602 |
603 DCHECK_NE(existing_credit_card->record_type(), credit_card.record_type()); | 603 DCHECK_NE(existing_credit_card->record_type(), credit_card.record_type()); |
604 DCHECK_EQ(existing_credit_card->Label(), credit_card.Label()); | 604 DCHECK_EQ(existing_credit_card->Label(), credit_card.Label()); |
605 if (existing_credit_card->record_type() == CreditCard::MASKED_SERVER_CARD) { | 605 if (existing_credit_card->record_type() == CreditCard::MASKED_SERVER_CARD) { |
606 database_->UnmaskServerCreditCard(credit_card, | 606 database_->UnmaskServerCreditCard(credit_card, |
607 credit_card.number()); | 607 credit_card.number()); |
608 } else { | 608 } else { |
609 database_->MaskServerCreditCard(credit_card.server_id()); | 609 database_->MaskServerCreditCard(credit_card.server_id()); |
610 } | 610 } |
611 | 611 |
612 Refresh(); | 612 Refresh(); |
613 } | 613 } |
614 | 614 |
615 void PersonalDataManager::UpdateServerCardBillingAddress( | 615 void PersonalDataManager::UpdateServerCardBillingAddress( |
616 const CreditCard& credit_card) { | 616 const CreditCard& credit_card) { |
617 DCHECK_NE(CreditCard::LOCAL_CARD, credit_card.record_type()); | 617 DCHECK_NE(CreditCard::LOCAL_CARD, credit_card.record_type()); |
618 | 618 |
619 if (!database_.get()) | 619 if (!database_.get()) |
620 return; | 620 return; |
621 | 621 |
622 CreditCard* existing_credit_card = nullptr; | 622 CreditCard* existing_credit_card = nullptr; |
623 for (auto it : server_credit_cards_) { | 623 for (auto* it : server_credit_cards_) { |
624 if (credit_card.guid() == it->guid()) { | 624 if (credit_card.guid() == it->guid()) { |
625 existing_credit_card = it; | 625 existing_credit_card = it; |
626 break; | 626 break; |
627 } | 627 } |
628 } | 628 } |
629 if (!existing_credit_card | 629 if (!existing_credit_card |
630 || existing_credit_card->billing_address_id() == | 630 || existing_credit_card->billing_address_id() == |
631 credit_card.billing_address_id()) { | 631 credit_card.billing_address_id()) { |
632 return; | 632 return; |
633 } | 633 } |
(...skipping 1111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1745 if (profile_to_merge->IsVerified()) | 1745 if (profile_to_merge->IsVerified()) |
1746 break; | 1746 break; |
1747 } | 1747 } |
1748 } | 1748 } |
1749 } | 1749 } |
1750 AutofillMetrics::LogNumberOfProfilesRemovedDuringDedupe( | 1750 AutofillMetrics::LogNumberOfProfilesRemovedDuringDedupe( |
1751 profiles_to_delete->size()); | 1751 profiles_to_delete->size()); |
1752 } | 1752 } |
1753 | 1753 |
1754 } // namespace autofill | 1754 } // namespace autofill |
OLD | NEW |