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 1043 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1054 DCHECK(can_make_payment_resolver_); | 1054 DCHECK(can_make_payment_resolver_); |
1055 | 1055 |
1056 switch (result) { | 1056 switch (result) { |
1057 case CanMakePaymentQueryResult::CAN_MAKE_PAYMENT: | 1057 case CanMakePaymentQueryResult::CAN_MAKE_PAYMENT: |
1058 can_make_payment_resolver_->Resolve(true); | 1058 can_make_payment_resolver_->Resolve(true); |
1059 break; | 1059 break; |
1060 case CanMakePaymentQueryResult::CANNOT_MAKE_PAYMENT: | 1060 case CanMakePaymentQueryResult::CANNOT_MAKE_PAYMENT: |
1061 can_make_payment_resolver_->Resolve(false); | 1061 can_make_payment_resolver_->Resolve(false); |
1062 break; | 1062 break; |
1063 case CanMakePaymentQueryResult::QUERY_QUOTA_EXCEEDED: | 1063 case CanMakePaymentQueryResult::QUERY_QUOTA_EXCEEDED: |
1064 can_make_payment_resolver_->Reject( | 1064 can_make_payment_resolver_->Reject(DOMException::Create( |
1065 DOMException::Create(kQuotaExceededError, "Query quota exceeded")); | 1065 kNotAllowedError, "Not allowed to check whether can make payment")); |
1066 break; | 1066 break; |
1067 } | 1067 } |
1068 | 1068 |
1069 can_make_payment_resolver_.Clear(); | 1069 can_make_payment_resolver_.Clear(); |
1070 } | 1070 } |
1071 | 1071 |
1072 void PaymentRequest::OnCompleteTimeout(TimerBase*) { | 1072 void PaymentRequest::OnCompleteTimeout(TimerBase*) { |
1073 payment_provider_->Complete(payments::mojom::blink::PaymentComplete(kFail)); | 1073 payment_provider_->Complete(payments::mojom::blink::PaymentComplete(kFail)); |
1074 ClearResolversAndCloseMojoConnection(); | 1074 ClearResolversAndCloseMojoConnection(); |
1075 } | 1075 } |
1076 | 1076 |
1077 void PaymentRequest::ClearResolversAndCloseMojoConnection() { | 1077 void PaymentRequest::ClearResolversAndCloseMojoConnection() { |
1078 complete_timer_.Stop(); | 1078 complete_timer_.Stop(); |
1079 complete_resolver_.Clear(); | 1079 complete_resolver_.Clear(); |
1080 show_resolver_.Clear(); | 1080 show_resolver_.Clear(); |
1081 abort_resolver_.Clear(); | 1081 abort_resolver_.Clear(); |
1082 can_make_payment_resolver_.Clear(); | 1082 can_make_payment_resolver_.Clear(); |
1083 if (client_binding_.is_bound()) | 1083 if (client_binding_.is_bound()) |
1084 client_binding_.Close(); | 1084 client_binding_.Close(); |
1085 payment_provider_.reset(); | 1085 payment_provider_.reset(); |
1086 } | 1086 } |
1087 | 1087 |
1088 } // namespace blink | 1088 } // namespace blink |
OLD | NEW |