Chromium Code Reviews| Index: Source/modules/app_banner/BeforeInstallPromptEvent.cpp |
| diff --git a/Source/modules/app_banner/BeforeInstallPromptEvent.cpp b/Source/modules/app_banner/BeforeInstallPromptEvent.cpp |
| index a11e7cd5a000f3bdb356628b4544d541f294dc86..4b9df061afcd3a32979b359c614712c73d0cee16 100644 |
| --- a/Source/modules/app_banner/BeforeInstallPromptEvent.cpp |
| +++ b/Source/modules/app_banner/BeforeInstallPromptEvent.cpp |
| @@ -22,6 +22,7 @@ BeforeInstallPromptEvent::BeforeInstallPromptEvent(const AtomicString& name, con |
| , m_platforms(platforms) |
| , m_requestId(requestId) |
| , m_client(client) |
| + , m_redispatched(false) |
| { |
| } |
| @@ -30,6 +31,7 @@ BeforeInstallPromptEvent::BeforeInstallPromptEvent(const AtomicString& name, con |
| , m_platforms(init.platforms()) |
| , m_requestId(-1) |
| , m_client(nullptr) |
| + , m_redispatched(false) |
| { |
| } |
| @@ -59,4 +61,16 @@ const AtomicString& BeforeInstallPromptEvent::interfaceName() const |
| return EventNames::BeforeInstallPromptEvent; |
| } |
| +void BeforeInstallPromptEvent::prompt() |
| +{ |
| + // This will silently fail if preventDefault() has not previously been |
| + // called (the event cannot be redispatched if it has not been stopped). |
| + // It will also silently fail if the event has already been redispatched. |
|
mlamouri (slow - plz ping)
2015/06/06 21:40:55
Why silently failing? Why not having prompt() retu
|
| + if (m_client && defaultPrevented() && !m_redispatched) { |
| + ASSERT(m_requestId != -1); |
| + m_redispatched = true; |
| + m_client->resolveEventRedispatch(m_requestId); |
| + } |
| +} |
| + |
| } // namespace blink |