Commit e419b525 authored by mgiuca's avatar mgiuca Committed by Commit bot

Rework use counter for navigator.share to use [MeasureAs].

Use automatic functionality instead of manually calling
UseCounter::count.

BUG=636288

Review-Url: https://codereview.chromium.org/2250613002
Cr-Commit-Position: refs/heads/master@{#417228}
parent 37d52645
...@@ -9,7 +9,6 @@ ...@@ -9,7 +9,6 @@
#include "core/dom/ExceptionCode.h" #include "core/dom/ExceptionCode.h"
#include "core/frame/LocalFrame.h" #include "core/frame/LocalFrame.h"
#include "core/frame/Navigator.h" #include "core/frame/Navigator.h"
#include "core/frame/UseCounter.h"
#include "modules/webshare/ShareData.h" #include "modules/webshare/ShareData.h"
#include "platform/UserGestureIndicator.h" #include "platform/UserGestureIndicator.h"
#include "platform/mojo/MojoHelper.h" #include "platform/mojo/MojoHelper.h"
...@@ -83,16 +82,14 @@ const char* NavigatorShare::supplementName() ...@@ -83,16 +82,14 @@ const char* NavigatorShare::supplementName()
ScriptPromise NavigatorShare::share(ScriptState* scriptState, const ShareData& shareData) ScriptPromise NavigatorShare::share(ScriptState* scriptState, const ShareData& shareData)
{ {
Document* doc = toDocument(scriptState->getExecutionContext());
DCHECK(doc);
UseCounter::count(*doc, UseCounter::WebShareShare);
if (!UserGestureIndicator::utilizeUserGesture()) { if (!UserGestureIndicator::utilizeUserGesture()) {
DOMException* error = DOMException::create(SecurityError, "Must be handling a user gesture to perform a share request."); DOMException* error = DOMException::create(SecurityError, "Must be handling a user gesture to perform a share request.");
return ScriptPromise::rejectWithDOMException(scriptState, error); return ScriptPromise::rejectWithDOMException(scriptState, error);
} }
if (!m_service) { if (!m_service) {
Document* doc = toDocument(scriptState->getExecutionContext());
DCHECK(doc);
LocalFrame* frame = doc->frame(); LocalFrame* frame = doc->frame();
DCHECK(frame); DCHECK(frame);
frame->interfaceProvider()->getInterface(mojo::GetProxy(&m_service)); frame->interfaceProvider()->getInterface(mojo::GetProxy(&m_service));
......
...@@ -7,5 +7,6 @@ ...@@ -7,5 +7,6 @@
[ [
OriginTrialEnabled=WebShare, OriginTrialEnabled=WebShare,
] partial interface Navigator { ] partial interface Navigator {
[CallWith=ScriptState] Promise<void> share(ShareData data); [CallWith=ScriptState, MeasureAs=WebShareShare]
Promise<void> share(ShareData data);
}; };
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment