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/frame/DOMWindow.h" | 9 #include "core/frame/DOMWindow.h" |
10 #include "core/frame/LocalFrame.h" | 10 #include "core/frame/LocalFrame.h" |
11 #include "modules/app_banner/BeforeInstallPromptEvent.h" | 11 #include "modules/app_banner/BeforeInstallPromptEvent.h" |
12 #include "platform/RuntimeEnabledFeatures.h" | 12 #include "platform/RuntimeEnabledFeatures.h" |
| 13 #include "public/platform/WebVector.h" |
13 #include "public/platform/modules/app_banner/WebAppBannerPromptReply.h" | 14 #include "public/platform/modules/app_banner/WebAppBannerPromptReply.h" |
14 | 15 |
15 namespace blink { | 16 namespace blink { |
16 | 17 |
17 // static | 18 // static |
18 void AppBannerController::willShowInstallBannerPrompt(LocalFrame* frame, const W
ebString& platform, WebAppBannerPromptReply* reply) | 19 void AppBannerController::willShowInstallBannerPrompt(LocalFrame* frame, const W
ebVector<WebString>& platforms, WebAppBannerPromptReply* reply) |
19 { | 20 { |
20 ASSERT(RuntimeEnabledFeatures::appBannerEnabled()); | 21 ASSERT(RuntimeEnabledFeatures::appBannerEnabled()); |
21 | 22 |
| 23 Vector<String> wtfPlatforms; |
| 24 for (const WebString& platform : platforms) |
| 25 wtfPlatforms.append(platform); |
22 // dispatchEvent() returns whether the default behavior can happen. In other | 26 // dispatchEvent() returns whether the default behavior can happen. In other |
23 // words, it returns false if preventDefault() was called. | 27 // words, it returns false if preventDefault() was called. |
24 *reply = frame->domWindow()->dispatchEvent(BeforeInstallPromptEvent::create(
EventTypeNames::beforeinstallprompt, platform)) | 28 *reply = frame->domWindow()->dispatchEvent(BeforeInstallPromptEvent::create(
EventTypeNames::beforeinstallprompt, wtfPlatforms)) |
25 ? WebAppBannerPromptReply::None : WebAppBannerPromptReply::Cancel; | 29 ? WebAppBannerPromptReply::None : WebAppBannerPromptReply::Cancel; |
26 } | 30 } |
27 | 31 |
28 } // namespace blink | 32 } // namespace blink |
OLD | NEW |