| OLD | NEW |
| 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 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 167 observer_for_testing_->OnAbortCalled(); | 167 observer_for_testing_->OnAbortCalled(); |
| 168 } | 168 } |
| 169 | 169 |
| 170 void PaymentRequest::Complete(mojom::PaymentComplete result) { | 170 void PaymentRequest::Complete(mojom::PaymentComplete result) { |
| 171 if (!client_.is_bound()) | 171 if (!client_.is_bound()) |
| 172 return; | 172 return; |
| 173 | 173 |
| 174 if (result != mojom::PaymentComplete::SUCCESS) { | 174 if (result != mojom::PaymentComplete::SUCCESS) { |
| 175 delegate_->ShowErrorMessage(); | 175 delegate_->ShowErrorMessage(); |
| 176 } else { | 176 } else { |
| 177 journey_logger_.RecordJourneyStatsHistograms( | 177 journey_logger_.SetCompleted(); |
| 178 JourneyLogger::COMPLETION_STATUS_COMPLETED); | |
| 179 delegate_->GetPrefService()->SetBoolean(kPaymentsFirstTransactionCompleted, | 178 delegate_->GetPrefService()->SetBoolean(kPaymentsFirstTransactionCompleted, |
| 180 true); | 179 true); |
| 181 // When the renderer closes the connection, | 180 // When the renderer closes the connection, |
| 182 // PaymentRequest::OnConnectionTerminated will be called. | 181 // PaymentRequest::OnConnectionTerminated will be called. |
| 183 client_->OnComplete(); | 182 client_->OnComplete(); |
| 184 state_->RecordUseStats(); | 183 state_->RecordUseStats(); |
| 185 } | 184 } |
| 186 } | 185 } |
| 187 | 186 |
| 188 void PaymentRequest::CanMakePayment() { | 187 void PaymentRequest::CanMakePayment() { |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 269 } | 268 } |
| 270 | 269 |
| 271 void PaymentRequest::Pay() { | 270 void PaymentRequest::Pay() { |
| 272 state_->GeneratePaymentResponse(); | 271 state_->GeneratePaymentResponse(); |
| 273 } | 272 } |
| 274 | 273 |
| 275 void PaymentRequest::RecordFirstCompletionStatus( | 274 void PaymentRequest::RecordFirstCompletionStatus( |
| 276 JourneyLogger::CompletionStatus completion_status) { | 275 JourneyLogger::CompletionStatus completion_status) { |
| 277 if (!has_recorded_abort_reason_) { | 276 if (!has_recorded_abort_reason_) { |
| 278 has_recorded_abort_reason_ = true; | 277 has_recorded_abort_reason_ = true; |
| 279 journey_logger_.RecordJourneyStatsHistograms(completion_status); | 278 // TODO(crbug.com/716546): Record more abort reasons. |
| 279 if (completion_status == JourneyLogger::COMPLETION_STATUS_USER_ABORTED) { |
| 280 journey_logger_.SetAborted(JourneyLogger::ABORT_REASON_ABORTED_BY_USER); |
| 281 } else { |
| 282 journey_logger_.SetAborted(JourneyLogger::ABORT_REASON_OTHER); |
| 283 } |
| 280 } | 284 } |
| 281 } | 285 } |
| 282 | 286 |
| 283 } // namespace payments | 287 } // namespace payments |
| OLD | NEW |