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

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

Issue 2110663002: components: Change auto to not deduce raw pointers. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase+one fix 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 572 matching lines...) Expand 10 before | Expand all | Expand 10 after
583 } 583 }
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 const CreditCard* existing_credit_card = nullptr;
594 for (auto it : server_credit_cards_) { 594 for (const auto* server_card : server_credit_cards_) {
595 if (credit_card.server_id() == it->server_id()) { 595 if (credit_card.server_id() == server_card->server_id()) {
596 existing_credit_card = it; 596 existing_credit_card = server_card;
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* server_card : server_credit_cards_) {
624 if (credit_card.guid() == it->guid()) { 624 if (credit_card.guid() == server_card->guid()) {
625 existing_credit_card = it; 625 existing_credit_card = server_card;
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 }
634 634
635 existing_credit_card->set_billing_address_id( 635 existing_credit_card->set_billing_address_id(
(...skipping 1109 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698