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

Unified Diff: components/payments/content/payment_request_state.cc

Issue 2874873002: [Payments] Record use stats after payment request completion. (Closed)
Patch Set: Removed billing address log Created 3 years, 7 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/payments/content/payment_request_state.cc
diff --git a/components/payments/content/payment_request_state.cc b/components/payments/content/payment_request_state.cc
index dac01e502e008834766e507a7e9e6347f52ff3b6..d2e9a98f50cf465dfffc70b7bd0fe09100f6c8a8 100644
--- a/components/payments/content/payment_request_state.cc
+++ b/components/payments/content/payment_request_state.cc
@@ -106,6 +106,27 @@ void PaymentRequestState::GeneratePaymentResponse() {
selected_shipping_profile_, selected_contact_profile_, this);
}
+void PaymentRequestState::RecordUseStats() {
+ if (spec_->request_shipping()) {
+ DCHECK(selected_shipping_profile_);
+ personal_data_manager_->RecordUseOf(*selected_shipping_profile_);
+ }
+
+ if (spec_->request_payer_name() || spec_->request_payer_email() ||
+ spec_->request_payer_phone()) {
+ DCHECK(selected_contact_profile_);
+
+ // If the same address was used for both contact and shipping, the stats
+ // should only be updated once.
+ if (!spec_->request_shipping() || (selected_shipping_profile_->guid() !=
+ selected_contact_profile_->guid())) {
+ personal_data_manager_->RecordUseOf(*selected_contact_profile_);
+ }
+ }
+
+ selected_instrument_->RecordUse();
+}
+
void PaymentRequestState::AddAutofillPaymentInstrument(
bool selected,
const autofill::CreditCard& card) {
« no previous file with comments | « components/payments/content/payment_request_state.h ('k') | components/payments/core/autofill_payment_instrument.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698