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

Unified Diff: Source/modules/app_banner/BeforeInstallPromptEvent.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: review comments Created 5 years, 9 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/BeforeInstallPromptEvent.cpp
diff --git a/Source/modules/app_banner/BeforeInstallPromptEvent.cpp b/Source/modules/app_banner/BeforeInstallPromptEvent.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..47f5b7739b21a376f2f9a25cb723dd4bf9534b84
--- /dev/null
+++ b/Source/modules/app_banner/BeforeInstallPromptEvent.cpp
@@ -0,0 +1,50 @@
+// 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/BeforeInstallPromptEvent.h"
+
+#include "bindings/core/v8/ScriptPromise.h"
+#include "core/dom/DOMException.h"
+#include "core/dom/ExceptionCode.h"
+#include "modules/app_banner/BeforeInstallPromptEventInit.h"
+
+namespace blink {
+
+BeforeInstallPromptEvent::BeforeInstallPromptEvent()
+{
+}
+
+BeforeInstallPromptEvent::BeforeInstallPromptEvent(const AtomicString& name, const String& platform)
+ : Event(name, false, true)
+ , m_platform(platform)
+{
+}
+
+BeforeInstallPromptEvent::BeforeInstallPromptEvent(const AtomicString& name, const BeforeInstallPromptEventInit& init)
+ : Event(name, false, true)
+ , m_platform(init.platform())
+{
+}
+
+BeforeInstallPromptEvent::~BeforeInstallPromptEvent()
+{
+}
+
+String BeforeInstallPromptEvent::platform() const
+{
+ return m_platform;
+}
+
+ScriptPromise BeforeInstallPromptEvent::userChoice(ScriptState* scriptState) const
+{
+ return ScriptPromise::rejectWithDOMException(scriptState, DOMException::create(NotSupportedError, "Subscription failed - no active Service Worker"));
+}
+
+const AtomicString& BeforeInstallPromptEvent::interfaceName() const
+{
+ return EventNames::BeforeInstallPromptEvent;
+}
+
+} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698