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

Unified Diff: components/autofill/core/browser/personal_data_manager.cc

Issue 2829853008: Stores server card as a full server card when upload to server succeeds. (Closed)
Patch Set: Renames AddServerCreditCard to AddFullServerCreditCard. Adds DCHECK to verify that we are in a tran… Created 3 years, 8 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 side-by-side diff with in-line comments
Download patch
Index: components/autofill/core/browser/personal_data_manager.cc
diff --git a/components/autofill/core/browser/personal_data_manager.cc b/components/autofill/core/browser/personal_data_manager.cc
index e634110a718f8481083cb271cfb35b4207d8f358..bb3495af87da27e0eb29caa29e67f19513b497ef 100644
--- a/components/autofill/core/browser/personal_data_manager.cc
+++ b/components/autofill/core/browser/personal_data_manager.cc
@@ -611,6 +611,27 @@ void PersonalDataManager::UpdateCreditCard(const CreditCard& credit_card) {
Refresh();
}
+void PersonalDataManager::AddFullServerCreditCard(
+ const CreditCard& credit_card) {
+ DCHECK_EQ(CreditCard::FULL_SERVER_CARD, credit_card.record_type());
+ DCHECK(!credit_card.IsEmpty(app_locale_));
+ DCHECK(!credit_card.server_id().empty());
+
+ if (is_off_the_record_ || !database_.get())
+ return;
+
+ // Don't add a duplicate.
+ if (FindByGUID<CreditCard>(server_credit_cards_, credit_card.guid()) ||
+ FindByContents(server_credit_cards_, credit_card))
+ return;
+
+ // Add the new credit card to the web database.
+ database_->AddFullServerCreditCard(credit_card);
+
+ // Refresh our local cache and send notifications to observers.
+ Refresh();
+}
+
void PersonalDataManager::UpdateServerCreditCard(
const CreditCard& credit_card) {
DCHECK_NE(CreditCard::LOCAL_CARD, credit_card.record_type());

Powered by Google App Engine
This is Rietveld 408576698