| 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 "bindings/core/v8/ExceptionState.h" | 7 #include "bindings/core/v8/ExceptionState.h" |
| 8 #include "bindings/core/v8/JSONValuesForV8.h" | 8 #include "bindings/core/v8/JSONValuesForV8.h" |
| 9 #include "bindings/core/v8/ScriptPromiseResolver.h" | 9 #include "bindings/core/v8/ScriptPromiseResolver.h" |
| 10 #include "bindings/core/v8/ScriptState.h" | 10 #include "bindings/core/v8/ScriptState.h" |
| (...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 164 } | 164 } |
| 165 return output; | 165 return output; |
| 166 } | 166 } |
| 167 }; | 167 }; |
| 168 | 168 |
| 169 } // namespace mojo | 169 } // namespace mojo |
| 170 | 170 |
| 171 namespace blink { | 171 namespace blink { |
| 172 namespace { | 172 namespace { |
| 173 | 173 |
| 174 // If the website does not call complete() 60 seconds after show() has been reso
lved, then behave as if | 174 // If the website does not call complete() 60 seconds after show() has been |
| 175 // the website called complete("fail"). | 175 // resolved, then behave as if the website called complete("fail"). |
| 176 static const int completeTimeoutSeconds = 60; | 176 static const int completeTimeoutSeconds = 60; |
| 177 | 177 |
| 178 // Validates ShippingOption or PaymentItem, which happen to have identical field
s, | 178 // Validates ShippingOption or PaymentItem, which happen to have identical |
| 179 // except for "id", which is present only in ShippingOption. | 179 // fields, except for "id", which is present only in ShippingOption. |
| 180 template <typename T> | 180 template <typename T> |
| 181 void validateShippingOptionOrPaymentItem(const T& item, | 181 void validateShippingOptionOrPaymentItem(const T& item, |
| 182 ExceptionState& exceptionState) { | 182 ExceptionState& exceptionState) { |
| 183 if (!item.hasLabel() || item.label().isEmpty()) { | 183 if (!item.hasLabel() || item.label().isEmpty()) { |
| 184 exceptionState.throwTypeError("Item label required"); | 184 exceptionState.throwTypeError("Item label required"); |
| 185 return; | 185 return; |
| 186 } | 186 } |
| 187 | 187 |
| 188 if (!item.hasAmount()) { | 188 if (!item.hasAmount()) { |
| 189 exceptionState.throwTypeError("Currency amount required"); | 189 exceptionState.throwTypeError("Currency amount required"); |
| (...skipping 593 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 783 m_completeTimer.stop(); | 783 m_completeTimer.stop(); |
| 784 m_completeResolver.clear(); | 784 m_completeResolver.clear(); |
| 785 m_showResolver.clear(); | 785 m_showResolver.clear(); |
| 786 m_abortResolver.clear(); | 786 m_abortResolver.clear(); |
| 787 if (m_clientBinding.is_bound()) | 787 if (m_clientBinding.is_bound()) |
| 788 m_clientBinding.Close(); | 788 m_clientBinding.Close(); |
| 789 m_paymentProvider.reset(); | 789 m_paymentProvider.reset(); |
| 790 } | 790 } |
| 791 | 791 |
| 792 } // namespace blink | 792 } // namespace blink |
| OLD | NEW |