OLD | NEW |
(Empty) | |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef MediaControls_h |
| 6 #define MediaControls_h |
| 7 |
| 8 #include "core/CoreExport.h" |
| 9 #include "platform/heap/Handle.h" |
| 10 #include "platform/heap/Visitor.h" |
| 11 |
| 12 namespace blink { |
| 13 |
| 14 class Document; |
| 15 class HTMLMediaElement; |
| 16 class LayoutObject; |
| 17 class MediaControlCastButtonElement; |
| 18 class MediaControlPanelElement; |
| 19 class MediaControlTimelineElement; |
| 20 class MediaControlVolumeSliderElement; |
| 21 class ShadowRoot; |
| 22 |
| 23 // MediaControls is an interface to abstract the HTMLMediaElement controls. The |
| 24 // implementation will be used using a Factory (see below). |
| 25 class CORE_EXPORT MediaControls : public GarbageCollectedMixin { |
| 26 public: |
| 27 // Factory class that HTMLMediaElement uses to create the MediaControls |
| 28 // instance. MediaControls implementations are expected to implement a factory |
| 29 // class and provide an implementation of it to HTMLMediaElement via |
| 30 // `::registerMediaControlsFactory()`. |
| 31 class Factory { |
| 32 public: |
| 33 virtual MediaControls* create(HTMLMediaElement&, ShadowRoot&) = 0; |
| 34 }; |
| 35 |
| 36 MediaControls(HTMLMediaElement&); |
| 37 virtual ~MediaControls() = default; |
| 38 |
| 39 HTMLMediaElement& mediaElement() const; |
| 40 |
| 41 virtual void show() = 0; |
| 42 virtual void hide() = 0; |
| 43 virtual void reset() = 0; |
| 44 |
| 45 // Notify the media controls that the controlsList attribute has changed. |
| 46 virtual void onControlsListUpdated() = 0; |
| 47 |
| 48 // TODO(mlamouri): this is temporary to notify the controls that an |
| 49 // HTMLTrackElement failed to load because there is no web exposed way to |
| 50 // be notified on the TextTrack object. See https://crbug.com/669977 |
| 51 virtual void onTrackElementFailedToLoad() = 0; |
| 52 |
| 53 // TODO(mlamouri): the following methods will be able to become private when |
| 54 // the controls have moved to modules/ and have access to RemotePlayback. |
| 55 virtual void onRemotePlaybackAvailabilityChanged() = 0; |
| 56 virtual void onRemotePlaybackConnecting() = 0; |
| 57 virtual void onRemotePlaybackDisconnected() = 0; |
| 58 |
| 59 // TODO(mlamouri): this method is needed in order to notify the controls that |
| 60 // the attribute have changed. |
| 61 virtual void onDisableRemotePlaybackAttributeChanged() = 0; |
| 62 |
| 63 // TODO(mlamouri): this method should be moved away from the interface to |
| 64 // become an implementation detail. |
| 65 virtual void networkStateChanged() = 0; |
| 66 |
| 67 // Returns the layout object for the part of the controls that should be |
| 68 // used for overlap checking during text track layout. May be null. |
| 69 // TODO(mlamouri): required by LayoutVTTCue. |
| 70 virtual LayoutObject* panelLayoutObject() = 0; |
| 71 // Returns the layout object of the media controls container. Maybe null. |
| 72 // TODO(mlamouri): required by LayoutVTTCue. |
| 73 virtual LayoutObject* containerLayoutObject() = 0; |
| 74 |
| 75 // TODO: the following are required by other parts of the media controls |
| 76 // implementation and could be removed when the full implementation has moved |
| 77 // to modules. |
| 78 virtual MediaControlPanelElement* panelElement() = 0; |
| 79 virtual MediaControlTimelineElement* timelineElement() = 0; |
| 80 virtual MediaControlCastButtonElement* castButtonElement() = 0; |
| 81 virtual MediaControlVolumeSliderElement* volumeSliderElement() = 0; |
| 82 virtual Document& ownerDocument() = 0; |
| 83 virtual void onVolumeChange() = 0; |
| 84 virtual void onFocusIn() = 0; |
| 85 virtual void onTimeUpdate() = 0; |
| 86 virtual void onDurationChange() = 0; |
| 87 virtual void onPlay() = 0; |
| 88 virtual void onPause() = 0; |
| 89 virtual void onTextTracksAddedOrRemoved() = 0; |
| 90 virtual void onTextTracksChanged() = 0; |
| 91 virtual void onError() = 0; |
| 92 virtual void onLoadedMetadata() = 0; |
| 93 virtual void onEnteredFullscreen() = 0; |
| 94 virtual void onExitedFullscreen() = 0; |
| 95 virtual void beginScrubbing() = 0; |
| 96 virtual void endScrubbing() = 0; |
| 97 virtual void updateCurrentTimeDisplay() = 0; |
| 98 virtual void toggleTextTrackList() = 0; |
| 99 virtual void showTextTrackAtIndex(unsigned indexToEnable) = 0; |
| 100 virtual void disableShowingTextTracks() = 0; |
| 101 virtual void enterFullscreen() = 0; |
| 102 virtual void exitFullscreen() = 0; |
| 103 virtual void showOverlayCastButtonIfNeeded() = 0; |
| 104 virtual void toggleOverflowMenu() = 0; |
| 105 virtual bool overflowMenuVisible() = 0; |
| 106 virtual void onMediaControlsEnabledChange() = 0; |
| 107 |
| 108 DECLARE_VIRTUAL_TRACE(); |
| 109 |
| 110 private: |
| 111 Member<HTMLMediaElement> m_mediaElement; |
| 112 }; |
| 113 |
| 114 } // namespace blink |
| 115 |
| 116 #endif // MediaControls_h |
OLD | NEW |