Chromium Code Reviews| Index: third_party/WebKit/Source/modules/app_banner/BeforeInstallPromptEvent.h |
| diff --git a/third_party/WebKit/Source/modules/app_banner/BeforeInstallPromptEvent.h b/third_party/WebKit/Source/modules/app_banner/BeforeInstallPromptEvent.h |
| index c245656243a394bc9fe94c10bd6daa5450a808e9..ce20ce7c53b703f3f358dff806c1333e4852daf1 100644 |
| --- a/third_party/WebKit/Source/modules/app_banner/BeforeInstallPromptEvent.h |
| +++ b/third_party/WebKit/Source/modules/app_banner/BeforeInstallPromptEvent.h |
| @@ -7,34 +7,40 @@ |
| #include "bindings/core/v8/ScriptPromise.h" |
| #include "bindings/core/v8/ScriptPromiseProperty.h" |
| +#include "core/frame/LocalFrame.h" |
| #include "modules/EventModules.h" |
| #include "modules/app_banner/AppBannerPromptResult.h" |
| -#include "platform/heap/Handle.h" |
| +#include "mojo/public/cpp/bindings/binding.h" |
| +#include "mojo/public/cpp/system/message_pipe.h" |
| +#include "public/platform/modules/app_banner/app_banner.mojom-blink.h" |
| +#include <utility> |
| namespace blink { |
| class BeforeInstallPromptEvent; |
| class BeforeInstallPromptEventInit; |
| -class WebAppBannerClient; |
| using UserChoiceProperty = |
| ScriptPromiseProperty<Member<BeforeInstallPromptEvent>, |
| Member<AppBannerPromptResult>, |
| ToV8UndefinedGenerator>; |
| -class BeforeInstallPromptEvent final : public Event { |
| +class BeforeInstallPromptEvent final : public Event, |
| + public mojom::blink::AppBannerEvent { |
| DEFINE_WRAPPERTYPEINFO(); |
| + USING_PRE_FINALIZER(BeforeInstallPromptEvent, dispose); |
|
haraken
2016/10/07 07:09:40
The reason we need to add the pre-finalizer is tha
dominickn
2016/10/13 00:18:15
I believe this has landed now.
dominickn
2016/10/17 05:38:45
Follow up: we have both an InterfacePtr and a bind
|
| public: |
| ~BeforeInstallPromptEvent() override; |
| - static BeforeInstallPromptEvent* create(const AtomicString& name, |
| - ExecutionContext* executionContext, |
| - const Vector<String>& platforms, |
| - int requestId, |
| - WebAppBannerClient* client) { |
| - return new BeforeInstallPromptEvent(name, executionContext, platforms, |
| - requestId, client); |
| + static BeforeInstallPromptEvent* create( |
| + const AtomicString& name, |
| + LocalFrame* frame, |
|
dcheng
2016/10/07 07:03:16
Nit: LocalFrame, as |frame| can't be null here.
dominickn
2016/10/13 00:18:15
Do you mean LocalFrame&?
|
| + mojo::ScopedMessagePipeHandle serviceHandle, |
| + mojo::ScopedMessagePipeHandle eventHandle, |
| + const Vector<String>& platforms) { |
| + return new BeforeInstallPromptEvent(name, frame, std::move(serviceHandle), |
| + std::move(eventHandle), platforms); |
| } |
| static BeforeInstallPromptEvent* create( |
| @@ -43,6 +49,8 @@ class BeforeInstallPromptEvent final : public Event { |
| return new BeforeInstallPromptEvent(name, init); |
| } |
| + void dispose(); |
| + |
| Vector<String> platforms() const; |
| ScriptPromise userChoice(ScriptState*); |
| ScriptPromise prompt(ScriptState*); |
| @@ -54,19 +62,22 @@ class BeforeInstallPromptEvent final : public Event { |
| private: |
| BeforeInstallPromptEvent(const AtomicString& name, |
| - ExecutionContext*, |
| - const Vector<String>& platforms, |
| - int requestId, |
| - WebAppBannerClient*); |
| + LocalFrame*, |
| + mojo::ScopedMessagePipeHandle serviceHandle, |
| + mojo::ScopedMessagePipeHandle eventHandle, |
| + const Vector<String>& platforms); |
| BeforeInstallPromptEvent(const AtomicString& name, |
| const BeforeInstallPromptEventInit&); |
| - Vector<String> m_platforms; |
| + // mojom::blink::AppBannerEvent methods: |
| + void BannerAccepted(const WTF::String& platform) override; |
| + void BannerDismissed() override; |
| - int m_requestId; |
| - WebAppBannerClient* m_client; |
| + mojom::blink::AppBannerServicePtr m_bannerService; |
| + mojo::Binding<mojom::blink::AppBannerEvent> m_binding; |
|
esprehn
2016/10/07 00:39:52
What is a Binding vs a ServicePtr? Why do we need
dcheng
2016/10/07 07:03:16
ServicePtr is an InterfacePtr and manages a messag
dominickn
2016/10/17 05:38:45
As dcheng said, we need both of these here so that
|
| + Vector<String> m_platforms; |
| Member<UserChoiceProperty> m_userChoice; |
| - bool m_registered; |
| + bool m_promptCalled; |
| }; |
| DEFINE_TYPE_CASTS(BeforeInstallPromptEvent, |