| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 BeforeInstallPromptEvent_h | 5 #ifndef BeforeInstallPromptEvent_h |
| 6 #define BeforeInstallPromptEvent_h | 6 #define BeforeInstallPromptEvent_h |
| 7 | 7 |
| 8 #include "bindings/core/v8/ScriptPromise.h" | 8 #include "bindings/core/v8/ScriptPromise.h" |
| 9 #include "bindings/core/v8/ScriptPromiseProperty.h" | 9 #include "bindings/core/v8/ScriptPromiseProperty.h" |
| 10 #include "modules/EventModules.h" | 10 #include "modules/EventModules.h" |
| 11 #include "modules/app_banner/AppBannerPromptResult.h" | 11 #include "modules/app_banner/AppBannerPromptResult.h" |
| 12 #include "platform/heap/Handle.h" | 12 #include "platform/heap/Handle.h" |
| 13 | 13 |
| 14 namespace blink { | 14 namespace blink { |
| 15 | 15 |
| 16 class BeforeInstallPromptEvent; | 16 class BeforeInstallPromptEvent; |
| 17 class BeforeInstallPromptEventInit; | 17 class BeforeInstallPromptEventInit; |
| 18 class WebAppBannerClient; | 18 class WebAppBannerClient; |
| 19 | 19 |
| 20 using UserChoiceProperty = ScriptPromiseProperty<RawPtrWillBeMember<BeforeInstal
lPromptEvent>, Member<AppBannerPromptResult>, ToV8UndefinedGenerator>; | 20 using UserChoiceProperty = ScriptPromiseProperty<Member<BeforeInstallPromptEvent
>, Member<AppBannerPromptResult>, ToV8UndefinedGenerator>; |
| 21 | 21 |
| 22 class BeforeInstallPromptEvent final : public Event { | 22 class BeforeInstallPromptEvent final : public Event { |
| 23 DEFINE_WRAPPERTYPEINFO(); | 23 DEFINE_WRAPPERTYPEINFO(); |
| 24 public: | 24 public: |
| 25 ~BeforeInstallPromptEvent() override; | 25 ~BeforeInstallPromptEvent() override; |
| 26 | 26 |
| 27 // For EventModules.cpp | 27 // For EventModules.cpp |
| 28 static PassRefPtrWillBeRawPtr<BeforeInstallPromptEvent> create() | 28 static RawPtr<BeforeInstallPromptEvent> create() |
| 29 { | 29 { |
| 30 return adoptRefWillBeNoop(new BeforeInstallPromptEvent()); | 30 return new BeforeInstallPromptEvent(); |
| 31 } | 31 } |
| 32 | 32 |
| 33 static PassRefPtrWillBeRawPtr<BeforeInstallPromptEvent> create(const AtomicS
tring& name, ExecutionContext* executionContext, const Vector<String>& platforms
, int requestId, WebAppBannerClient* client) | 33 static RawPtr<BeforeInstallPromptEvent> create(const AtomicString& name, Exe
cutionContext* executionContext, const Vector<String>& platforms, int requestId,
WebAppBannerClient* client) |
| 34 { | 34 { |
| 35 return adoptRefWillBeNoop(new BeforeInstallPromptEvent(name, executionCo
ntext, platforms, requestId, client)); | 35 return new BeforeInstallPromptEvent(name, executionContext, platforms, r
equestId, client); |
| 36 } | 36 } |
| 37 | 37 |
| 38 static PassRefPtrWillBeRawPtr<BeforeInstallPromptEvent> create(const AtomicS
tring& name, const BeforeInstallPromptEventInit& init) | 38 static RawPtr<BeforeInstallPromptEvent> create(const AtomicString& name, con
st BeforeInstallPromptEventInit& init) |
| 39 { | 39 { |
| 40 return adoptRefWillBeNoop(new BeforeInstallPromptEvent(name, init)); | 40 return new BeforeInstallPromptEvent(name, init); |
| 41 } | 41 } |
| 42 | 42 |
| 43 Vector<String> platforms() const; | 43 Vector<String> platforms() const; |
| 44 ScriptPromise userChoice(ScriptState*); | 44 ScriptPromise userChoice(ScriptState*); |
| 45 ScriptPromise prompt(ScriptState*); | 45 ScriptPromise prompt(ScriptState*); |
| 46 | 46 |
| 47 const AtomicString& interfaceName() const override; | 47 const AtomicString& interfaceName() const override; |
| 48 | 48 |
| 49 DECLARE_VIRTUAL_TRACE(); | 49 DECLARE_VIRTUAL_TRACE(); |
| 50 | 50 |
| 51 private: | 51 private: |
| 52 BeforeInstallPromptEvent(); | 52 BeforeInstallPromptEvent(); |
| 53 BeforeInstallPromptEvent(const AtomicString& name, ExecutionContext*, const
Vector<String>& platforms, int requestId, WebAppBannerClient*); | 53 BeforeInstallPromptEvent(const AtomicString& name, ExecutionContext*, const
Vector<String>& platforms, int requestId, WebAppBannerClient*); |
| 54 BeforeInstallPromptEvent(const AtomicString& name, const BeforeInstallPrompt
EventInit&); | 54 BeforeInstallPromptEvent(const AtomicString& name, const BeforeInstallPrompt
EventInit&); |
| 55 | 55 |
| 56 Vector<String> m_platforms; | 56 Vector<String> m_platforms; |
| 57 | 57 |
| 58 int m_requestId; | 58 int m_requestId; |
| 59 WebAppBannerClient* m_client; | 59 WebAppBannerClient* m_client; |
| 60 PersistentWillBeMember<UserChoiceProperty> m_userChoice; | 60 Member<UserChoiceProperty> m_userChoice; |
| 61 bool m_registered; | 61 bool m_registered; |
| 62 }; | 62 }; |
| 63 | 63 |
| 64 DEFINE_TYPE_CASTS(BeforeInstallPromptEvent, Event, event, event->interfaceName()
== EventNames::BeforeInstallPromptEvent, event.interfaceName() == EventNames::B
eforeInstallPromptEvent); | 64 DEFINE_TYPE_CASTS(BeforeInstallPromptEvent, Event, event, event->interfaceName()
== EventNames::BeforeInstallPromptEvent, event.interfaceName() == EventNames::B
eforeInstallPromptEvent); |
| 65 | 65 |
| 66 } // namespace blink | 66 } // namespace blink |
| 67 | 67 |
| 68 #endif // BeforeInstallPromptEvent_h | 68 #endif // BeforeInstallPromptEvent_h |
| OLD | NEW |