Chromium Code Reviews| 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 1037 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1048 | 1048 |
| 1049 switch (result) { | 1049 switch (result) { |
| 1050 case CanMakePaymentQueryResult::CAN_MAKE_PAYMENT: | 1050 case CanMakePaymentQueryResult::CAN_MAKE_PAYMENT: |
| 1051 m_canMakePaymentResolver->resolve(true); | 1051 m_canMakePaymentResolver->resolve(true); |
| 1052 break; | 1052 break; |
| 1053 case CanMakePaymentQueryResult::CANNOT_MAKE_PAYMENT: | 1053 case CanMakePaymentQueryResult::CANNOT_MAKE_PAYMENT: |
| 1054 m_canMakePaymentResolver->resolve(false); | 1054 m_canMakePaymentResolver->resolve(false); |
| 1055 break; | 1055 break; |
| 1056 case CanMakePaymentQueryResult::QUERY_QUOTA_EXCEEDED: | 1056 case CanMakePaymentQueryResult::QUERY_QUOTA_EXCEEDED: |
| 1057 m_canMakePaymentResolver->reject( | 1057 m_canMakePaymentResolver->reject( |
| 1058 DOMException::create(QuotaExceededError, "Query quota exceeded")); | 1058 DOMException::create(NotAllowedError, "The canMakePayment() was called too often.")); |
|
please use gerrit instead
2017/04/10 15:10:19
Do you think maybe "Not allowed to check whether
zino
2017/04/10 17:01:20
Done.
| |
| 1059 break; | 1059 break; |
| 1060 } | 1060 } |
| 1061 | 1061 |
| 1062 m_canMakePaymentResolver.clear(); | 1062 m_canMakePaymentResolver.clear(); |
| 1063 } | 1063 } |
| 1064 | 1064 |
| 1065 void PaymentRequest::onCompleteTimeout(TimerBase*) { | 1065 void PaymentRequest::onCompleteTimeout(TimerBase*) { |
| 1066 m_paymentProvider->Complete(payments::mojom::blink::PaymentComplete(Fail)); | 1066 m_paymentProvider->Complete(payments::mojom::blink::PaymentComplete(Fail)); |
| 1067 clearResolversAndCloseMojoConnection(); | 1067 clearResolversAndCloseMojoConnection(); |
| 1068 } | 1068 } |
| 1069 | 1069 |
| 1070 void PaymentRequest::clearResolversAndCloseMojoConnection() { | 1070 void PaymentRequest::clearResolversAndCloseMojoConnection() { |
| 1071 m_completeTimer.stop(); | 1071 m_completeTimer.stop(); |
| 1072 m_completeResolver.clear(); | 1072 m_completeResolver.clear(); |
| 1073 m_showResolver.clear(); | 1073 m_showResolver.clear(); |
| 1074 m_abortResolver.clear(); | 1074 m_abortResolver.clear(); |
| 1075 m_canMakePaymentResolver.clear(); | 1075 m_canMakePaymentResolver.clear(); |
| 1076 if (m_clientBinding.is_bound()) | 1076 if (m_clientBinding.is_bound()) |
| 1077 m_clientBinding.Close(); | 1077 m_clientBinding.Close(); |
| 1078 m_paymentProvider.reset(); | 1078 m_paymentProvider.reset(); |
| 1079 } | 1079 } |
| 1080 | 1080 |
| 1081 } // namespace blink | 1081 } // namespace blink |
| OLD | NEW |