Chromium Code Reviews| Index: third_party/WebKit/Source/modules/presentation/PresentationRequest.cpp |
| diff --git a/third_party/WebKit/Source/modules/presentation/PresentationRequest.cpp b/third_party/WebKit/Source/modules/presentation/PresentationRequest.cpp |
| index ed5c0ab21d24567c49b6b0288747c292a1276e13..5d773b7b349dc0a24fb8d14c6bb6ed21e244429d 100644 |
| --- a/third_party/WebKit/Source/modules/presentation/PresentationRequest.cpp |
| +++ b/third_party/WebKit/Source/modules/presentation/PresentationRequest.cpp |
| @@ -10,6 +10,7 @@ |
| #include "bindings/core/v8/ScriptPromiseResolver.h" |
| #include "core/dom/Document.h" |
| #include "core/dom/ExecutionContext.h" |
| +#include "core/frame/Settings.h" |
| #include "core/frame/UseCounter.h" |
| #include "modules/EventTargetModules.h" |
| #include "modules/presentation/PresentationAvailability.h" |
| @@ -36,6 +37,14 @@ WebPresentationClient* presentationClient(ExecutionContext* executionContext) |
| return controller ? controller->client() : nullptr; |
| } |
| +Settings* getSettings(ExecutionContext* executionContext) |
| +{ |
| + ASSERT(executionContext && executionContext->isDocument()); |
| + |
| + Document* document = toDocument(executionContext); |
| + return document->settings(); |
| +} |
| + |
| } // anonymous namespace |
| // static |
| @@ -85,7 +94,10 @@ ScriptPromise PresentationRequest::start(ScriptState* scriptState) |
| ScriptPromiseResolver* resolver = ScriptPromiseResolver::create(scriptState); |
| ScriptPromise promise = resolver->promise(); |
| - if (!UserGestureIndicator::processingUserGesture()) { |
| + Settings* settings = getSettings(executionContext()); |
|
whywhat
2016/02/04 20:39:08
I wonder if this can be null? Does similar code ch
Zhiqiang Zhang (Slow)
2016/02/05 16:20:33
See here:
https://code.google.com/p/chromium/codes
|
| + bool bypassGestureCheck = settings && settings->presentationRequiresUserGesture(); |
|
whywhat
2016/02/04 20:39:08
I think the name of the variable means the opposit
Zhiqiang Zhang (Slow)
2016/02/05 16:20:33
Done.
|
| + |
| + if (!bypassGestureCheck && !UserGestureIndicator::processingUserGesture()) { |
| resolver->reject(DOMException::create(InvalidAccessError, "PresentationRequest::start() requires user gesture.")); |
| return promise; |
| } |