| Index: third_party/WebKit/Source/core/html/MediaDocument.cpp
|
| diff --git a/third_party/WebKit/Source/core/html/MediaDocument.cpp b/third_party/WebKit/Source/core/html/MediaDocument.cpp
|
| index 5d36b40caebdd1caa4e416f8f26e4811707f98ba..362a48fc43986c4f032da51fc60bad4b63d87aa9 100644
|
| --- a/third_party/WebKit/Source/core/html/MediaDocument.cpp
|
| +++ b/third_party/WebKit/Source/core/html/MediaDocument.cpp
|
| @@ -27,13 +27,16 @@
|
|
|
| #include "bindings/core/v8/ExceptionState.h"
|
| #include "core/HTMLNames.h"
|
| +#include "core/dom/DocumentUserGestureToken.h"
|
| #include "core/dom/ElementTraversal.h"
|
| +#include "core/dom/GetRootNodeOptions.h"
|
| #include "core/dom/RawDataDocumentParser.h"
|
| #include "core/dom/shadow/ShadowRoot.h"
|
| #include "core/events/Event.h"
|
| #include "core/events/EventListener.h"
|
| #include "core/events/KeyboardEvent.h"
|
| #include "core/frame/LocalFrame.h"
|
| +#include "core/frame/Settings.h"
|
| #include "core/frame/UseCounter.h"
|
| #include "core/html/HTMLAnchorElement.h"
|
| #include "core/html/HTMLBodyElement.h"
|
| @@ -50,6 +53,7 @@
|
| #include "core/loader/FrameLoaderClient.h"
|
| #include "platform/Histogram.h"
|
| #include "platform/KeyboardCodes.h"
|
| +#include "platform/UserGestureIndicator.h"
|
| #include "platform/text/PlatformLocale.h"
|
|
|
| namespace blink {
|
| @@ -113,6 +117,28 @@ class MediaDownloadEventListener final : public EventListener {
|
| bool m_clicked;
|
| };
|
|
|
| +class MediaLoadedEventListener final : public EventListener {
|
| + public:
|
| + static MediaLoadedEventListener* create() {
|
| + return new MediaLoadedEventListener();
|
| + }
|
| +
|
| + bool operator==(const EventListener& other) const override {
|
| + return this == &other;
|
| + }
|
| +
|
| + private:
|
| + MediaLoadedEventListener() : EventListener(CPPEventListenerType) {}
|
| +
|
| + void handleEvent(ExecutionContext* context, Event* event) override {
|
| + HTMLVideoElement* media = Traversal<HTMLVideoElement>::firstWithin(
|
| + *event->target()->toNode()->getRootNode(GetRootNodeOptions()));
|
| + UserGestureIndicator gesture(
|
| + DocumentUserGestureToken::create(&media->document()));
|
| + media->webkitEnterFullscreen();
|
| + }
|
| +};
|
| +
|
| void MediaDocumentParser::createDocumentStructure() {
|
| DCHECK(document());
|
| HTMLHtmlElement* rootElement = HTMLHtmlElement::create(*document());
|
| @@ -163,6 +189,12 @@ void MediaDocumentParser::createDocumentStructure() {
|
| HTMLContentElement* content = HTMLContentElement::create(*document());
|
| div->appendChild(content);
|
|
|
| + if (document()->settings() &&
|
| + document()->settings()->getEmbeddedMediaExperienceEnabled()) {
|
| + EventListener* listener = MediaLoadedEventListener::create();
|
| + media->addEventListener(EventTypeNames::loadedmetadata, listener, false);
|
| + }
|
| +
|
| if (RuntimeEnabledFeatures::mediaDocumentDownloadButtonEnabled()) {
|
| HTMLAnchorElement* anchor = HTMLAnchorElement::create(*document());
|
| anchor->setAttribute(downloadAttr, "");
|
|
|