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

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

Issue 2829853008: Stores server card as a full server card when upload to server succeeds. (Closed)
Patch Set: Makes OnDidUploadCard public so TestAutofillManager in anonymous namespace can reference it. 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/autofill_manager.cc
diff --git a/components/autofill/core/browser/autofill_manager.cc b/components/autofill/core/browser/autofill_manager.cc
index 933b7c5dd41a1549fca6c368a1235d2e756ba4c3..f5dee1929bb4474c4e4664a0450e6f2c1d53e4c7 100644
--- a/components/autofill/core/browser/autofill_manager.cc
+++ b/components/autofill/core/browser/autofill_manager.cc
@@ -1081,10 +1081,20 @@ void AutofillManager::OnDidGetUploadDetails(
pending_upload_request_url_ = GURL();
}
-void AutofillManager::OnDidUploadCard(
- AutofillClient::PaymentsRpcResult result) {
+void AutofillManager::OnDidUploadCard(AutofillClient::PaymentsRpcResult result,
+ const std::string& server_id) {
// We don't do anything user-visible if the upload attempt fails.
+ // If the upload succeeds, we will keep a copy of the card as a full server
+ // card on the device.
// TODO(jdonnelly): Log duration.
Mathieu 2017/04/24 18:11:55 we should either transform this into a TODO(crbug.
csashi 2017/04/24 18:30:06 Done.
+ if (result == AutofillClient::SUCCESS && !server_id.empty()) {
+ upload_request_.card.set_record_type(CreditCard::FULL_SERVER_CARD);
+ upload_request_.card.SetServerStatus(CreditCard::OK);
+ upload_request_.card.set_server_id(server_id);
+ DCHECK(personal_data_);
+ if (personal_data_)
+ personal_data_->AddServerCreditCard(upload_request_.card);
+ }
}
void AutofillManager::OnFullCardRequestSucceeded(const CreditCard& card,

Powered by Google App Engine
This is Rietveld 408576698