Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1987)

Unified Diff: Source/modules/app_banner/AppBannerController.cpp

Issue 942913002: [AppBanner] Blink implementation of an event when an install banner is shown. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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

Powered by Google App Engine
This is Rietveld 408576698