| Index: third_party/WebKit/Source/modules/media_controls/elements/MediaControlOverlayPlayButtonElement.cpp
|
| diff --git a/third_party/WebKit/Source/modules/media_controls/elements/MediaControlOverlayPlayButtonElement.cpp b/third_party/WebKit/Source/modules/media_controls/elements/MediaControlOverlayPlayButtonElement.cpp
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..b9a5e9003282651c6572ac57a6f76ab7530e319d
|
| --- /dev/null
|
| +++ b/third_party/WebKit/Source/modules/media_controls/elements/MediaControlOverlayPlayButtonElement.cpp
|
| @@ -0,0 +1,43 @@
|
| +// Copyright 2017 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 "modules/media_controls/elements/MediaControlOverlayPlayButtonElement.h"
|
| +
|
| +#include "core/InputTypeNames.h"
|
| +#include "core/events/Event.h"
|
| +#include "core/html/HTMLMediaElement.h"
|
| +#include "modules/media_controls/MediaControlsImpl.h"
|
| +#include "modules/media_controls/elements/MediaControlElementsHelper.h"
|
| +#include "public/platform/Platform.h"
|
| +
|
| +namespace blink {
|
| +
|
| +MediaControlOverlayPlayButtonElement::MediaControlOverlayPlayButtonElement(
|
| + MediaControlsImpl& media_controls)
|
| + : MediaControlInputElement(media_controls, kMediaOverlayPlayButton) {
|
| + EnsureUserAgentShadowRoot();
|
| + setType(InputTypeNames::button);
|
| + SetShadowPseudoId(AtomicString("-webkit-media-controls-overlay-play-button"));
|
| +}
|
| +
|
| +void MediaControlOverlayPlayButtonElement::UpdateDisplayType() {
|
| + SetIsWanted(MediaElement().ShouldShowControls() && MediaElement().paused());
|
| +}
|
| +
|
| +void MediaControlOverlayPlayButtonElement::DefaultEventHandler(Event* event) {
|
| + if (event->type() == EventTypeNames::click && MediaElement().paused()) {
|
| + Platform::Current()->RecordAction(
|
| + UserMetricsAction("Media.Controls.PlayOverlay"));
|
| + MediaElement().Play();
|
| + UpdateDisplayType();
|
| + event->SetDefaultHandled();
|
| + }
|
| + // TODO(mlamouri): should call MediaControlInputElement::DefaultEventHandler.
|
| +}
|
| +
|
| +bool MediaControlOverlayPlayButtonElement::KeepEventInNode(Event* event) {
|
| + return MediaControlElementsHelper::IsUserInteractionEvent(event);
|
| +}
|
| +
|
| +} // namespace blink
|
|
|