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 "modules/EventModules.h" | 10 #include "modules/EventModules.h" |
11 #include "modules/app_banner/AppBannerPromptResult.h" | |
10 #include "platform/heap/Handle.h" | 12 #include "platform/heap/Handle.h" |
11 | 13 |
12 namespace blink { | 14 namespace blink { |
13 | 15 |
14 class BeforeInstallPromptEventInit; | 16 class BeforeInstallPromptEventInit; |
15 class WebAppBannerClient; | 17 class WebAppBannerClient; |
16 | 18 |
17 class BeforeInstallPromptEvent final : public Event { | 19 class BeforeInstallPromptEvent final : public Event { |
18 DEFINE_WRAPPERTYPEINFO(); | 20 DEFINE_WRAPPERTYPEINFO(); |
19 public: | 21 public: |
20 ~BeforeInstallPromptEvent() override; | 22 ~BeforeInstallPromptEvent() override; |
21 | 23 |
22 // For EventModules.cpp | 24 // For EventModules.cpp |
23 static PassRefPtrWillBeRawPtr<BeforeInstallPromptEvent> create() | 25 static PassRefPtrWillBeRawPtr<BeforeInstallPromptEvent> create() |
24 { | 26 { |
25 return adoptRefWillBeNoop(new BeforeInstallPromptEvent()); | 27 return adoptRefWillBeNoop(new BeforeInstallPromptEvent()); |
26 } | 28 } |
27 | 29 |
28 static PassRefPtrWillBeRawPtr<BeforeInstallPromptEvent> create(const AtomicS tring& name, const Vector<String>& platforms, int requestId, WebAppBannerClient* client) | 30 static PassRefPtrWillBeRawPtr<BeforeInstallPromptEvent> create(const AtomicS tring& name, ScriptState* scriptState, const Vector<String>& platforms, int requ estId, WebAppBannerClient* client) |
29 { | 31 { |
30 return adoptRefWillBeNoop(new BeforeInstallPromptEvent(name, platforms, requestId, client)); | 32 return adoptRefWillBeNoop(new BeforeInstallPromptEvent(name, scriptState , platforms, requestId, client)); |
31 } | 33 } |
32 | 34 |
33 static PassRefPtrWillBeRawPtr<BeforeInstallPromptEvent> create(const AtomicS tring& name, const BeforeInstallPromptEventInit& init) | 35 static PassRefPtrWillBeRawPtr<BeforeInstallPromptEvent> create(const AtomicS tring& name, const BeforeInstallPromptEventInit& init) |
34 { | 36 { |
35 return adoptRefWillBeNoop(new BeforeInstallPromptEvent(name, init)); | 37 return adoptRefWillBeNoop(new BeforeInstallPromptEvent(name, init)); |
36 } | 38 } |
37 | 39 |
38 Vector<String> platforms() const; | 40 Vector<String> platforms() const; |
39 ScriptPromise userChoice(ScriptState*); | 41 ScriptPromise userChoice(ScriptState*); |
42 ScriptPromise prompt(ScriptState*); | |
40 | 43 |
41 const AtomicString& interfaceName() const override; | 44 const AtomicString& interfaceName() const override; |
42 | 45 |
43 ScriptPromise prompt(ScriptState*); | 46 void resolveUserChoice(AppBannerPromptResult*); |
44 | 47 |
yhirano
2015/07/23 12:25:02
+ trace
dominickn
2015/07/23 13:13:48
Done.
| |
45 private: | 48 private: |
46 BeforeInstallPromptEvent(); | 49 BeforeInstallPromptEvent(); |
47 BeforeInstallPromptEvent(const AtomicString& name, const Vector<String>& pla tforms, int requestId, WebAppBannerClient*); | 50 BeforeInstallPromptEvent(const AtomicString& name, ScriptState*, const Vecto r<String>& platforms, int requestId, WebAppBannerClient*); |
48 BeforeInstallPromptEvent(const AtomicString& name, const BeforeInstallPrompt EventInit&); | 51 BeforeInstallPromptEvent(const AtomicString& name, const BeforeInstallPrompt EventInit&); |
49 | 52 |
53 typedef ScriptPromiseProperty<RawPtrWillBeMember<BeforeInstallPromptEvent>, Member<AppBannerPromptResult>, ToV8UndefinedGenerator> UserChoiceProperty; | |
54 typedef ScriptPromiseProperty<RawPtrWillBeMember<BeforeInstallPromptEvent>, ToV8UndefinedGenerator, Member<DOMException>> PromptProperty; | |
55 | |
50 Vector<String> m_platforms; | 56 Vector<String> m_platforms; |
51 ScriptPromise m_userChoice; | |
52 | 57 |
53 int m_requestId; | 58 int m_requestId; |
54 WebAppBannerClient* m_client; | 59 WebAppBannerClient* m_client; |
55 bool m_redispatched; | 60 bool m_redispatched; |
61 PersistentWillBeMember<UserChoiceProperty> m_userChoice; | |
62 PersistentWillBeMember<PromptProperty> m_prompt; | |
56 }; | 63 }; |
57 | 64 |
58 DEFINE_TYPE_CASTS(BeforeInstallPromptEvent, Event, event, event->interfaceName() == EventNames::BeforeInstallPromptEvent, event.interfaceName() == EventNames::B eforeInstallPromptEvent); | 65 DEFINE_TYPE_CASTS(BeforeInstallPromptEvent, Event, event, event->interfaceName() == EventNames::BeforeInstallPromptEvent, event.interfaceName() == EventNames::B eforeInstallPromptEvent); |
59 | 66 |
60 } // namespace blink | 67 } // namespace blink |
61 | 68 |
62 #endif // BeforeInstallPromptEvent_h | 69 #endif // BeforeInstallPromptEvent_h |
OLD | NEW |