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

Side by Side Diff: components/payments/content/payment_request.cc

Issue 2943433004: [Payments] Log multiple events in the journey logger. (Closed)
Patch Set: addressed comment Created 3 years, 6 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
« no previous file with comments | « chrome/browser/ui/views/payments/payment_request_journey_logger_browsertest.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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/payments/content/payment_request.h" 5 #include "components/payments/content/payment_request.h"
6 6
7 #include <string> 7 #include <string>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/memory/ptr_util.h" 10 #include "base/memory/ptr_util.h"
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
133 JourneyLogger::NOT_SHOWN_REASON_NO_SUPPORTED_PAYMENT_METHOD); 133 JourneyLogger::NOT_SHOWN_REASON_NO_SUPPORTED_PAYMENT_METHOD);
134 has_recorded_completion_ = true; 134 has_recorded_completion_ = true;
135 client_->OnError(mojom::PaymentErrorReason::NOT_SUPPORTED); 135 client_->OnError(mojom::PaymentErrorReason::NOT_SUPPORTED);
136 if (observer_for_testing_) 136 if (observer_for_testing_)
137 observer_for_testing_->OnNotSupportedError(); 137 observer_for_testing_->OnNotSupportedError();
138 OnConnectionTerminated(); 138 OnConnectionTerminated();
139 return; 139 return;
140 } 140 }
141 141
142 journey_logger_.SetShowCalled(); 142 journey_logger_.SetShowCalled();
143 journey_logger_.SetEventOccurred(JourneyLogger::EVENT_SHOWN);
143 journey_logger_.SetRequestedInformation( 144 journey_logger_.SetRequestedInformation(
144 spec_->request_shipping(), spec_->request_payer_email(), 145 spec_->request_shipping(), spec_->request_payer_email(),
145 spec_->request_payer_phone(), spec_->request_payer_name()); 146 spec_->request_payer_phone(), spec_->request_payer_name());
146 147
147 delegate_->ShowDialog(this); 148 delegate_->ShowDialog(this);
148 } 149 }
149 150
150 void PaymentRequest::UpdateWith(mojom::PaymentDetailsPtr details) { 151 void PaymentRequest::UpdateWith(mojom::PaymentDetailsPtr details) {
151 std::string error; 152 std::string error;
152 if (!validatePaymentDetails(details, &error)) { 153 if (!validatePaymentDetails(details, &error)) {
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
220 client_->OnCanMakePayment( 221 client_->OnCanMakePayment(
221 mojom::CanMakePaymentQueryResult::QUERY_QUOTA_EXCEEDED); 222 mojom::CanMakePaymentQueryResult::QUERY_QUOTA_EXCEEDED);
222 } 223 }
223 224
224 if (observer_for_testing_) 225 if (observer_for_testing_)
225 observer_for_testing_->OnCanMakePaymentCalled(); 226 observer_for_testing_->OnCanMakePaymentCalled();
226 } 227 }
227 228
228 void PaymentRequest::OnPaymentResponseAvailable( 229 void PaymentRequest::OnPaymentResponseAvailable(
229 mojom::PaymentResponsePtr response) { 230 mojom::PaymentResponsePtr response) {
231 journey_logger_.SetEventOccurred(
232 JourneyLogger::EVENT_RECEIVED_INSTRUMENT_DETAILS);
230 client_->OnPaymentResponse(std::move(response)); 233 client_->OnPaymentResponse(std::move(response));
231 } 234 }
232 235
233 void PaymentRequest::OnShippingOptionIdSelected( 236 void PaymentRequest::OnShippingOptionIdSelected(
234 std::string shipping_option_id) { 237 std::string shipping_option_id) {
235 client_->OnShippingOptionChange(shipping_option_id); 238 client_->OnShippingOptionChange(shipping_option_id);
236 } 239 }
237 240
238 void PaymentRequest::OnShippingAddressSelected( 241 void PaymentRequest::OnShippingAddressSelected(
239 mojom::PaymentAddressPtr address) { 242 mojom::PaymentAddressPtr address) {
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
275 binding_.Close(); 278 binding_.Close();
276 delegate_->CloseDialog(); 279 delegate_->CloseDialog();
277 if (observer_for_testing_) 280 if (observer_for_testing_)
278 observer_for_testing_->OnConnectionTerminated(); 281 observer_for_testing_->OnConnectionTerminated();
279 282
280 RecordFirstAbortReason(JourneyLogger::ABORT_REASON_MOJO_CONNECTION_ERROR); 283 RecordFirstAbortReason(JourneyLogger::ABORT_REASON_MOJO_CONNECTION_ERROR);
281 manager_->DestroyRequest(this); 284 manager_->DestroyRequest(this);
282 } 285 }
283 286
284 void PaymentRequest::Pay() { 287 void PaymentRequest::Pay() {
288 journey_logger_.SetEventOccurred(JourneyLogger::EVENT_PAY_CLICKED);
285 journey_logger_.SetSelectedPaymentMethod( 289 journey_logger_.SetSelectedPaymentMethod(
286 JourneyLogger::SELECTED_PAYMENT_METHOD_CREDIT_CARD); 290 JourneyLogger::SELECTED_PAYMENT_METHOD_CREDIT_CARD);
287 state_->GeneratePaymentResponse(); 291 state_->GeneratePaymentResponse();
288 } 292 }
289 293
290 void PaymentRequest::RecordFirstAbortReason( 294 void PaymentRequest::RecordFirstAbortReason(
291 JourneyLogger::AbortReason abort_reason) { 295 JourneyLogger::AbortReason abort_reason) {
292 if (!has_recorded_completion_) { 296 if (!has_recorded_completion_) {
293 has_recorded_completion_ = true; 297 has_recorded_completion_ = true;
294 journey_logger_.SetAborted(abort_reason); 298 journey_logger_.SetAborted(abort_reason);
295 } 299 }
296 } 300 }
297 301
298 } // namespace payments 302 } // namespace payments
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/payments/payment_request_journey_logger_browsertest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698