| 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 #ifndef PaymentRequestUpdateEvent_h | 5 #ifndef PaymentRequestUpdateEvent_h |
| 6 #define PaymentRequestUpdateEvent_h | 6 #define PaymentRequestUpdateEvent_h |
| 7 | 7 |
| 8 #include "bindings/core/v8/ScriptPromise.h" | 8 #include "bindings/core/v8/ScriptPromise.h" |
| 9 #include "bindings/core/v8/ScriptWrappable.h" | 9 #include "bindings/core/v8/ScriptWrappable.h" |
| 10 #include "core/events/Event.h" | 10 #include "core/events/Event.h" |
| 11 #include "modules/ModulesExport.h" | 11 #include "modules/ModulesExport.h" |
| 12 #include "modules/payments/PaymentRequestUpdateEventInit.h" | 12 #include "modules/payments/PaymentRequestUpdateEventInit.h" |
| 13 #include "modules/payments/PaymentUpdater.h" |
| 13 #include "platform/Timer.h" | 14 #include "platform/Timer.h" |
| 14 #include "platform/heap/Handle.h" | 15 #include "platform/heap/Handle.h" |
| 15 | 16 |
| 16 namespace blink { | 17 namespace blink { |
| 17 | 18 |
| 18 class ExceptionState; | 19 class ExceptionState; |
| 19 class ExecutionContext; | 20 class ExecutionContext; |
| 20 class PaymentUpdater; | |
| 21 class ScriptState; | 21 class ScriptState; |
| 22 | 22 |
| 23 class MODULES_EXPORT PaymentRequestUpdateEvent final : public Event { | 23 class MODULES_EXPORT PaymentRequestUpdateEvent final : public Event, |
| 24 public PaymentUpdater { |
| 24 DEFINE_WRAPPERTYPEINFO(); | 25 DEFINE_WRAPPERTYPEINFO(); |
| 26 USING_GARBAGE_COLLECTED_MIXIN(PaymentRequestUpdateEvent) |
| 25 | 27 |
| 26 public: | 28 public: |
| 27 ~PaymentRequestUpdateEvent() override; | 29 ~PaymentRequestUpdateEvent() override; |
| 28 | 30 |
| 29 static PaymentRequestUpdateEvent* Create( | 31 static PaymentRequestUpdateEvent* Create( |
| 30 ExecutionContext*, | 32 ExecutionContext*, |
| 31 const AtomicString& type, | 33 const AtomicString& type, |
| 32 const PaymentRequestUpdateEventInit& = PaymentRequestUpdateEventInit()); | 34 const PaymentRequestUpdateEventInit& = PaymentRequestUpdateEventInit()); |
| 33 | 35 |
| 34 void SetPaymentDetailsUpdater(PaymentUpdater*); | 36 void SetPaymentDetailsUpdater(PaymentUpdater*); |
| 35 | 37 |
| 36 void updateWith(ScriptState*, ScriptPromise, ExceptionState&); | 38 void updateWith(ScriptState*, ScriptPromise, ExceptionState&); |
| 37 | 39 |
| 40 // PaymentUpdater: |
| 41 void OnUpdatePaymentDetails(const ScriptValue& details_script_value) override; |
| 42 void OnUpdatePaymentDetailsFailure(const String& error) override; |
| 43 |
| 38 DECLARE_VIRTUAL_TRACE(); | 44 DECLARE_VIRTUAL_TRACE(); |
| 39 | 45 |
| 40 void OnUpdateEventTimeoutForTesting(); | 46 void OnUpdateEventTimeoutForTesting(); |
| 41 | 47 |
| 42 private: | 48 private: |
| 43 PaymentRequestUpdateEvent(ExecutionContext*, | 49 PaymentRequestUpdateEvent(ExecutionContext*, |
| 44 const AtomicString& type, | 50 const AtomicString& type, |
| 45 const PaymentRequestUpdateEventInit&); | 51 const PaymentRequestUpdateEventInit&); |
| 46 | 52 |
| 47 void OnUpdateEventTimeout(TimerBase*); | 53 void OnUpdateEventTimeout(TimerBase*); |
| 48 | 54 |
| 49 Member<PaymentUpdater> updater_; | 55 Member<PaymentUpdater> updater_; |
| 50 bool wait_for_update_; | 56 bool wait_for_update_; |
| 51 TaskRunnerTimer<PaymentRequestUpdateEvent> abort_timer_; | 57 TaskRunnerTimer<PaymentRequestUpdateEvent> abort_timer_; |
| 52 }; | 58 }; |
| 53 | 59 |
| 54 } // namespace blink | 60 } // namespace blink |
| 55 | 61 |
| 56 #endif // PaymentRequestUpdateEvent_h | 62 #endif // PaymentRequestUpdateEvent_h |
| OLD | NEW |