Index: Source/modules/app_banner/AppBannerController.cpp |
diff --git a/Source/modules/app_banner/AppBannerController.cpp b/Source/modules/app_banner/AppBannerController.cpp |
new file mode 100644 |
index 0000000000000000000000000000000000000000..6a99bbce937175015fe4d45a2af0d6531d238fee |
--- /dev/null |
+++ b/Source/modules/app_banner/AppBannerController.cpp |
@@ -0,0 +1,26 @@ |
+// Copyright 2015 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#include "config.h" |
+#include "modules/app_banner/AppBannerController.h" |
+ |
+#include "core/EventTypeNames.h" |
+#include "core/frame/DOMWindow.h" |
+#include "core/frame/LocalFrame.h" |
+#include "modules/app_banner/BeforeInstallPromptEvent.h" |
+#include "platform/RuntimeEnabledFeatures.h" |
+ |
+namespace blink { |
+ |
+// static |
+void AppBannerController::willShowInstallBannerPrompt(LocalFrame* frame, const WebString& platform, bool* cancel) |
+{ |
+ ASSERT(RuntimeEnabledFeatures::appBannerEnabled()); |
+ |
+ // dispatchEvent() returns whether the default behavior can happen. In other |
+ // words, it returns false if preventDefault() was called. |
+ *cancel = !frame->domWindow()->dispatchEvent(BeforeInstallPromptEvent::create(EventTypeNames::beforeinstallprompt, platform)); |
+} |
+ |
+} // namespace blink |