Index: third_party/WebKit/Source/modules/app_banner/BeforeInstallPromptEvent.cpp |
diff --git a/third_party/WebKit/Source/modules/app_banner/BeforeInstallPromptEvent.cpp b/third_party/WebKit/Source/modules/app_banner/BeforeInstallPromptEvent.cpp |
index c1c839b4b738c4945c24f876de8c26bef9b937af..f8b979b1bb44b9c153093907a73f0480b765f34a 100644 |
--- a/third_party/WebKit/Source/modules/app_banner/BeforeInstallPromptEvent.cpp |
+++ b/third_party/WebKit/Source/modules/app_banner/BeforeInstallPromptEvent.cpp |
@@ -7,6 +7,7 @@ |
#include "bindings/core/v8/ScriptPromise.h" |
#include "core/dom/DOMException.h" |
#include "core/dom/ExceptionCode.h" |
+#include "core/frame/UseCounter.h" |
#include "modules/app_banner/AppBannerCallbacks.h" |
#include "modules/app_banner/BeforeInstallPromptEventInit.h" |
#include "public/platform/modules/app_banner/WebAppBannerClient.h" |
@@ -25,6 +26,7 @@ BeforeInstallPromptEvent::BeforeInstallPromptEvent(const AtomicString& name, Exe |
, m_userChoice(new UserChoiceProperty(executionContext, this, UserChoiceProperty::UserChoice)) |
, m_registered(false) |
{ |
+ UseCounter::count(executionContext, UseCounter::BeforeInstallPromptEvent); |
} |
BeforeInstallPromptEvent::BeforeInstallPromptEvent(const AtomicString& name, const BeforeInstallPromptEventInit& init) |
@@ -47,6 +49,7 @@ Vector<String> BeforeInstallPromptEvent::platforms() const |
ScriptPromise BeforeInstallPromptEvent::userChoice(ScriptState* scriptState) |
{ |
+ UseCounter::count(scriptState->getExecutionContext(), UseCounter::BeforeInstallPromptEventUserChoice); |
if (m_userChoice && m_client && m_requestId != -1) { |
if (!m_registered) { |
m_registered = true; |
@@ -57,13 +60,10 @@ ScriptPromise BeforeInstallPromptEvent::userChoice(ScriptState* scriptState) |
return ScriptPromise::rejectWithDOMException(scriptState, DOMException::create(InvalidStateError, "userChoice cannot be accessed on this event.")); |
} |
-const AtomicString& BeforeInstallPromptEvent::interfaceName() const |
-{ |
- return EventNames::BeforeInstallPromptEvent; |
-} |
- |
ScriptPromise BeforeInstallPromptEvent::prompt(ScriptState* scriptState) |
{ |
+ UseCounter::count(scriptState->getExecutionContext(), UseCounter::BeforeInstallPromptEventPrompt); |
+ |
// |m_registered| will be true if userChoice has already been accessed |
// or prompt() has already been called. Return a rejected promise in both |
// these cases, as well as if we have a null client or invalid requestId. |
@@ -76,6 +76,17 @@ ScriptPromise BeforeInstallPromptEvent::prompt(ScriptState* scriptState) |
return ScriptPromise::castUndefined(scriptState); |
} |
+const AtomicString& BeforeInstallPromptEvent::interfaceName() const |
+{ |
+ return EventNames::BeforeInstallPromptEvent; |
+} |
+ |
+void BeforeInstallPromptEvent::preventDefault() |
+{ |
+ Event::preventDefault(); |
+ UseCounter::count(target()->getExecutionContext(), UseCounter::BeforeInstallPromptEventPreventDefault); |
+} |
+ |
DEFINE_TRACE(BeforeInstallPromptEvent) |
{ |
visitor->trace(m_userChoice); |