| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef MediaControlsOrientationLockDelegate_h | 5 #ifndef MediaControlsOrientationLockDelegate_h |
| 6 #define MediaControlsOrientationLockDelegate_h | 6 #define MediaControlsOrientationLockDelegate_h |
| 7 | 7 |
| 8 #include "core/CoreExport.h" | 8 #include "core/CoreExport.h" |
| 9 #include "core/events/EventListener.h" | 9 #include "core/events/EventListener.h" |
| 10 #include "public/platform/modules/screen_orientation/WebScreenOrientationLockTyp
e.h" | 10 #include "public/platform/modules/screen_orientation/WebScreenOrientationLockTyp
e.h" |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 // The different states of the class are: | 22 // The different states of the class are: |
| 23 // - PendingFullscreen: the object is created and is waiting for the associated | 23 // - PendingFullscreen: the object is created and is waiting for the associated |
| 24 // <video> to go fullscreen in order to apply an orientation lock; | 24 // <video> to go fullscreen in order to apply an orientation lock; |
| 25 // - PendingMetadata: the <video> is fullscreen but the metadata have not been | 25 // - PendingMetadata: the <video> is fullscreen but the metadata have not been |
| 26 // downloaded yet. It can happen because of network latency or because the | 26 // downloaded yet. It can happen because of network latency or because the |
| 27 // <video> went fullscreen before playback and download started; | 27 // <video> went fullscreen before playback and download started; |
| 28 // - MaybeLockedFullscreen: the <video> is fullscreen and a screen orientation | 28 // - MaybeLockedFullscreen: the <video> is fullscreen and a screen orientation |
| 29 // lock was applied. | 29 // lock was applied. |
| 30 // | 30 // |
| 31 // The possible state transitions are: | 31 // The possible state transitions are: |
| 32 // - PendingFullscreen => PendingMetadata: on fullscreenchange event (entering | 32 // - PendingFullscreen => PendingMetadata: on entering fullscreen when metadata |
| 33 // fullscreen) when metadata are not available; | 33 // are not available; |
| 34 // - PendingFullscreen => MaybeLockedFullscreen: on fullscreenchange event | 34 // - PendingFullscreen => MaybeLockedFullscreen: on entering fullscreen when |
| 35 // (entering fullscreen) when metadata are available; | 35 // metadata are available; |
| 36 // - PendingMetadata => MaybeLockedFullscreen: on loadedmetadata; | 36 // - PendingMetadata => MaybeLockedFullscreen: on loadedmetadata; |
| 37 // - PendingMetadata => PendingFullscreen: on fullscreenchange event (leaving | 37 // - PendingMetadata => PendingFullscreen: on exiting fullscreen; |
| 38 // fullscreen); | 38 // - MaybeLockedFullscreen => PendingFullscreen: on exiting fullscreen. |
| 39 // - MaybeLockedFullscreen => PendingFullscreen: on fullscreenchange event | |
| 40 // (leaving fullscreen). | |
| 41 class CORE_EXPORT MediaControlsOrientationLockDelegate final | 39 class CORE_EXPORT MediaControlsOrientationLockDelegate final |
| 42 : public EventListener { | 40 : public EventListener { |
| 43 public: | 41 public: |
| 44 explicit MediaControlsOrientationLockDelegate(HTMLVideoElement&); | 42 explicit MediaControlsOrientationLockDelegate(HTMLVideoElement&); |
| 45 | 43 |
| 46 // Called by MediaControls when the HTMLMediaElement is added to a document | 44 // Called by MediaControls when the HTMLMediaElement is added to a document. |
| 47 // document. All event listeners should be added. | 45 // All event listeners should be added. |
| 48 void attach(); | 46 void attach(); |
| 49 | 47 |
| 50 // Called by MediaControls when the HTMLMediaElement is no longer in the | 48 // Called by MediaControls when the HTMLMediaElement is no longer in the |
| 51 // document. All event listeners should be removed in order to prepare the | 49 // document. All event listeners should be removed in order to prepare the |
| 52 // object to be garbage collected. | 50 // object to be garbage collected. |
| 53 void detach(); | 51 void detach(); |
| 54 | 52 |
| 53 // Called by MediaControls when the fullscreen element changes. |
| 54 void didEnterFullscreen(); |
| 55 void didExitFullscreen(); |
| 56 |
| 55 // EventListener implementation. | 57 // EventListener implementation. |
| 56 bool operator==(const EventListener&) const override; | 58 bool operator==(const EventListener&) const override; |
| 57 | 59 |
| 58 DECLARE_VIRTUAL_TRACE(); | 60 DECLARE_VIRTUAL_TRACE(); |
| 59 | 61 |
| 60 private: | 62 private: |
| 61 friend class MediaControlsOrientationLockDelegateTest; | 63 friend class MediaControlsOrientationLockDelegateTest; |
| 62 | 64 |
| 63 enum class State { | 65 enum class State { |
| 64 PendingFullscreen, | 66 PendingFullscreen, |
| (...skipping 28 matching lines...) Expand all Loading... |
| 93 // In other words, whether the orientation was locked. | 95 // In other words, whether the orientation was locked. |
| 94 bool m_shouldUnlockOrientation = false; | 96 bool m_shouldUnlockOrientation = false; |
| 95 | 97 |
| 96 // `m_videoElement` owns MediaControls that owns |this|. | 98 // `m_videoElement` owns MediaControls that owns |this|. |
| 97 Member<HTMLVideoElement> m_videoElement; | 99 Member<HTMLVideoElement> m_videoElement; |
| 98 }; | 100 }; |
| 99 | 101 |
| 100 } // namespace blink | 102 } // namespace blink |
| 101 | 103 |
| 102 #endif // MediaControlsOrientationLockDelegate_h | 104 #endif // MediaControlsOrientationLockDelegate_h |
| OLD | NEW |