| 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 #include "config.h" | 5 #include "config.h" |
| 6 #include "modules/app_banner/AppBannerController.h" | 6 #include "modules/app_banner/AppBannerController.h" |
| 7 | 7 |
| 8 #include "core/EventTypeNames.h" | 8 #include "core/EventTypeNames.h" |
| 9 #include "core/dom/Document.h" | 9 #include "core/dom/Document.h" |
| 10 #include "core/frame/DOMWindow.h" | 10 #include "core/frame/DOMWindow.h" |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 void AppBannerController::willShowInstallBannerPrompt(int requestId, WebAppBanne
rClient* client, LocalFrame* frame, const WebVector<WebString>& platforms, WebAp
pBannerPromptReply* reply) | 21 void AppBannerController::willShowInstallBannerPrompt(int requestId, WebAppBanne
rClient* client, LocalFrame* frame, const WebVector<WebString>& platforms, WebAp
pBannerPromptReply* reply) |
| 22 { | 22 { |
| 23 ASSERT(RuntimeEnabledFeatures::appBannerEnabled()); | 23 ASSERT(RuntimeEnabledFeatures::appBannerEnabled()); |
| 24 | 24 |
| 25 Vector<String> wtfPlatforms; | 25 Vector<String> wtfPlatforms; |
| 26 for (const WebString& platform : platforms) | 26 for (const WebString& platform : platforms) |
| 27 wtfPlatforms.append(platform); | 27 wtfPlatforms.append(platform); |
| 28 | 28 |
| 29 // dispatchEvent() returns whether the default behavior can happen. In other | 29 // dispatchEvent() returns whether the default behavior can happen. In other |
| 30 // words, it returns false if preventDefault() was called. | 30 // words, it returns false if preventDefault() was called. |
| 31 *reply = frame->domWindow()->dispatchEvent(BeforeInstallPromptEvent::create(
EventTypeNames::beforeinstallprompt, frame->document(), wtfPlatforms, requestId,
client)) | 31 *reply = frame->domWindow()->dispatchEvent(BeforeInstallPromptEvent::create(
EventTypeNames::beforeinstallprompt, frame->document(), wtfPlatforms, requestId,
client)) == WebInputEventResult::NotHandled |
| 32 ? WebAppBannerPromptReply::None : WebAppBannerPromptReply::Cancel; | 32 ? WebAppBannerPromptReply::None |
| 33 : WebAppBannerPromptReply::Cancel; |
| 33 } | 34 } |
| 34 | 35 |
| 35 } // namespace blink | 36 } // namespace blink |
| OLD | NEW |