| 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/PaymentRequestUpdateEvent.h" | 5 #include "modules/payments/PaymentRequestUpdateEvent.h" |
| 6 | 6 |
| 7 #include "bindings/core/v8/ExceptionState.h" | 7 #include "bindings/core/v8/ExceptionState.h" |
| 8 #include "bindings/core/v8/ScriptFunction.h" | 8 #include "bindings/core/v8/ScriptFunction.h" |
| 9 #include "core/dom/DOMException.h" | 9 #include "core/dom/DOMException.h" |
| 10 #include "core/dom/ExceptionCode.h" | 10 #include "core/dom/ExceptionCode.h" |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 113 } | 113 } |
| 114 | 114 |
| 115 stopImmediatePropagation(); | 115 stopImmediatePropagation(); |
| 116 m_waitForUpdate = true; | 116 m_waitForUpdate = true; |
| 117 m_abortTimer.stop(); | 117 m_abortTimer.stop(); |
| 118 | 118 |
| 119 promise.then(UpdatePaymentDetailsFunction::createFunction(scriptState, m_upd
ater), | 119 promise.then(UpdatePaymentDetailsFunction::createFunction(scriptState, m_upd
ater), |
| 120 UpdatePaymentDetailsErrorFunction::createFunction(scriptState, m_updater
)); | 120 UpdatePaymentDetailsErrorFunction::createFunction(scriptState, m_updater
)); |
| 121 } | 121 } |
| 122 | 122 |
| 123 void PaymentRequestUpdateEvent::onTimerFired(TimerBase*) | |
| 124 { | |
| 125 if (!m_updater) | |
| 126 return; | |
| 127 | |
| 128 m_updater->onUpdatePaymentDetailsFailure("Timed out as the page didn't resol
ve the promise from change event"); | |
| 129 } | |
| 130 | |
| 131 DEFINE_TRACE(PaymentRequestUpdateEvent) | 123 DEFINE_TRACE(PaymentRequestUpdateEvent) |
| 132 { | 124 { |
| 133 visitor->trace(m_updater); | 125 visitor->trace(m_updater); |
| 134 Event::trace(visitor); | 126 Event::trace(visitor); |
| 135 } | 127 } |
| 136 | 128 |
| 129 void PaymentRequestUpdateEvent::onUpdateEventTimeoutForTesting() |
| 130 { |
| 131 onUpdateEventTimeout(0); |
| 132 } |
| 133 |
| 134 void PaymentRequestUpdateEvent::onUpdateEventTimeout(TimerBase*) |
| 135 { |
| 136 if (!m_updater) |
| 137 return; |
| 138 |
| 139 m_updater->onUpdatePaymentDetailsFailure("Timed out as the page didn't resol
ve the promise from change event"); |
| 140 } |
| 141 |
| 137 PaymentRequestUpdateEvent::PaymentRequestUpdateEvent(const AtomicString& type, c
onst PaymentRequestUpdateEventInit& init) | 142 PaymentRequestUpdateEvent::PaymentRequestUpdateEvent(const AtomicString& type, c
onst PaymentRequestUpdateEventInit& init) |
| 138 : Event(type, init) | 143 : Event(type, init) |
| 139 , m_waitForUpdate(false) | 144 , m_waitForUpdate(false) |
| 140 , m_abortTimer(this, &PaymentRequestUpdateEvent::onTimerFired) | 145 , m_abortTimer(this, &PaymentRequestUpdateEvent::onUpdateEventTimeout) |
| 141 { | 146 { |
| 142 } | 147 } |
| 143 | 148 |
| 144 } // namespace blink | 149 } // namespace blink |
| OLD | NEW |