| 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 "modules/payments/PaymentRequest.h" | 5 #include "modules/payments/PaymentRequest.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <utility> | 8 #include <utility> |
| 9 #include "bindings/core/v8/ExceptionState.h" | 9 #include "bindings/core/v8/ExceptionState.h" |
| 10 #include "bindings/core/v8/ScriptPromiseResolver.h" | 10 #include "bindings/core/v8/ScriptPromiseResolver.h" |
| (...skipping 1022 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1033 DCHECK(complete_resolver_); | 1033 DCHECK(complete_resolver_); |
| 1034 complete_resolver_->Resolve(); | 1034 complete_resolver_->Resolve(); |
| 1035 ClearResolversAndCloseMojoConnection(); | 1035 ClearResolversAndCloseMojoConnection(); |
| 1036 } | 1036 } |
| 1037 | 1037 |
| 1038 void PaymentRequest::OnAbort(bool aborted_successfully) { | 1038 void PaymentRequest::OnAbort(bool aborted_successfully) { |
| 1039 DCHECK(abort_resolver_); | 1039 DCHECK(abort_resolver_); |
| 1040 DCHECK(show_resolver_); | 1040 DCHECK(show_resolver_); |
| 1041 | 1041 |
| 1042 if (!aborted_successfully) { | 1042 if (!aborted_successfully) { |
| 1043 abort_resolver_->Reject(DOMException::Create(kInvalidStateError)); | 1043 abort_resolver_->Reject(DOMException::Create( |
| 1044 kInvalidStateError, "Unable to abort the payment")); |
| 1044 abort_resolver_.Clear(); | 1045 abort_resolver_.Clear(); |
| 1045 return; | 1046 return; |
| 1046 } | 1047 } |
| 1047 | 1048 |
| 1048 show_resolver_->Reject(DOMException::Create(kAbortError)); | 1049 show_resolver_->Reject( |
| 1050 DOMException::Create(kAbortError, "The website has aborted the payment")); |
| 1049 abort_resolver_->Resolve(); | 1051 abort_resolver_->Resolve(); |
| 1050 ClearResolversAndCloseMojoConnection(); | 1052 ClearResolversAndCloseMojoConnection(); |
| 1051 } | 1053 } |
| 1052 | 1054 |
| 1053 void PaymentRequest::OnCanMakePayment(CanMakePaymentQueryResult result) { | 1055 void PaymentRequest::OnCanMakePayment(CanMakePaymentQueryResult result) { |
| 1054 DCHECK(can_make_payment_resolver_); | 1056 DCHECK(can_make_payment_resolver_); |
| 1055 | 1057 |
| 1056 switch (result) { | 1058 switch (result) { |
| 1057 case CanMakePaymentQueryResult::CAN_MAKE_PAYMENT: | 1059 case CanMakePaymentQueryResult::CAN_MAKE_PAYMENT: |
| 1058 can_make_payment_resolver_->Resolve(true); | 1060 can_make_payment_resolver_->Resolve(true); |
| (...skipping 20 matching lines...) Expand all Loading... |
| 1079 complete_resolver_.Clear(); | 1081 complete_resolver_.Clear(); |
| 1080 show_resolver_.Clear(); | 1082 show_resolver_.Clear(); |
| 1081 abort_resolver_.Clear(); | 1083 abort_resolver_.Clear(); |
| 1082 can_make_payment_resolver_.Clear(); | 1084 can_make_payment_resolver_.Clear(); |
| 1083 if (client_binding_.is_bound()) | 1085 if (client_binding_.is_bound()) |
| 1084 client_binding_.Close(); | 1086 client_binding_.Close(); |
| 1085 payment_provider_.reset(); | 1087 payment_provider_.reset(); |
| 1086 } | 1088 } |
| 1087 | 1089 |
| 1088 } // namespace blink | 1090 } // namespace blink |
| OLD | NEW |