Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(368)

Side by Side Diff: third_party/WebKit/Source/core/html/shadow/MediaControls.cpp

Issue 2556573003: Media: lock orientation when <video> goes fullscreen. (Closed)
Patch Set: review comments Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2011, 2012 Apple Inc. All rights reserved. 2 * Copyright (C) 2011, 2012 Apple Inc. All rights reserved.
3 * Copyright (C) 2011, 2012 Google Inc. All rights reserved. 3 * Copyright (C) 2011, 2012 Google Inc. All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 14 matching lines...) Expand all
25 */ 25 */
26 26
27 #include "core/html/shadow/MediaControls.h" 27 #include "core/html/shadow/MediaControls.h"
28 28
29 #include "bindings/core/v8/ExceptionStatePlaceholder.h" 29 #include "bindings/core/v8/ExceptionStatePlaceholder.h"
30 #include "core/dom/ClientRect.h" 30 #include "core/dom/ClientRect.h"
31 #include "core/dom/Fullscreen.h" 31 #include "core/dom/Fullscreen.h"
32 #include "core/events/MouseEvent.h" 32 #include "core/events/MouseEvent.h"
33 #include "core/frame/Settings.h" 33 #include "core/frame/Settings.h"
34 #include "core/html/HTMLMediaElement.h" 34 #include "core/html/HTMLMediaElement.h"
35 #include "core/html/HTMLVideoElement.h"
35 #include "core/html/shadow/MediaControlsMediaEventListener.h" 36 #include "core/html/shadow/MediaControlsMediaEventListener.h"
37 #include "core/html/shadow/MediaControlsOrientationLockDelegate.h"
36 #include "core/html/shadow/MediaControlsWindowEventListener.h" 38 #include "core/html/shadow/MediaControlsWindowEventListener.h"
37 #include "core/html/track/TextTrackContainer.h" 39 #include "core/html/track/TextTrackContainer.h"
38 #include "core/html/track/TextTrackList.h" 40 #include "core/html/track/TextTrackList.h"
39 #include "core/layout/LayoutObject.h" 41 #include "core/layout/LayoutObject.h"
40 #include "core/layout/LayoutTheme.h" 42 #include "core/layout/LayoutTheme.h"
41 #include "platform/EventDispatchForbiddenScope.h" 43 #include "platform/EventDispatchForbiddenScope.h"
42 44
43 namespace blink { 45 namespace blink {
44 46
45 // If you change this value, then also update the corresponding value in 47 // If you change this value, then also update the corresponding value in
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
120 m_toggleClosedCaptionsButton(nullptr), 122 m_toggleClosedCaptionsButton(nullptr),
121 m_textTrackList(nullptr), 123 m_textTrackList(nullptr),
122 m_overflowList(nullptr), 124 m_overflowList(nullptr),
123 m_castButton(nullptr), 125 m_castButton(nullptr),
124 m_fullscreenButton(nullptr), 126 m_fullscreenButton(nullptr),
125 m_downloadButton(nullptr), 127 m_downloadButton(nullptr),
126 m_mediaEventListener(new MediaControlsMediaEventListener(this)), 128 m_mediaEventListener(new MediaControlsMediaEventListener(this)),
127 m_windowEventListener(MediaControlsWindowEventListener::create( 129 m_windowEventListener(MediaControlsWindowEventListener::create(
128 this, 130 this,
129 WTF::bind(&MediaControls::hideAllMenus, wrapWeakPersistent(this)))), 131 WTF::bind(&MediaControls::hideAllMenus, wrapWeakPersistent(this)))),
132 m_orientationLockDelegate(nullptr),
130 m_hideMediaControlsTimer(this, 133 m_hideMediaControlsTimer(this,
131 &MediaControls::hideMediaControlsTimerFired), 134 &MediaControls::hideMediaControlsTimerFired),
132 m_hideTimerBehaviorFlags(IgnoreNone), 135 m_hideTimerBehaviorFlags(IgnoreNone),
133 m_isMouseOverControls(false), 136 m_isMouseOverControls(false),
134 m_isPausedForScrubbing(false), 137 m_isPausedForScrubbing(false),
135 m_panelWidthChangedTimer(this, 138 m_panelWidthChangedTimer(this,
136 &MediaControls::panelWidthChangedTimerFired), 139 &MediaControls::panelWidthChangedTimerFired),
137 m_panelWidth(0), 140 m_panelWidth(0),
138 m_keepShowingUntilTimerFires(false) {} 141 m_keepShowingUntilTimerFires(false) {}
139 142
140 MediaControls* MediaControls::create(HTMLMediaElement& mediaElement) { 143 MediaControls* MediaControls::create(HTMLMediaElement& mediaElement) {
141 MediaControls* controls = new MediaControls(mediaElement); 144 MediaControls* controls = new MediaControls(mediaElement);
142 controls->setShadowPseudoId(AtomicString("-webkit-media-controls")); 145 controls->setShadowPseudoId(AtomicString("-webkit-media-controls"));
143 controls->initializeControls(); 146 controls->initializeControls();
147
148 // Initialize the orientation lock when going fullscreen feature.
149 if (RuntimeEnabledFeatures::videoFullscreenOrientationLockEnabled() &&
150 mediaElement.isHTMLVideoElement()) {
151 controls->m_orientationLockDelegate =
152 new MediaControlsOrientationLockDelegate(
153 toHTMLVideoElement(mediaElement));
154 }
155
144 return controls; 156 return controls;
145 } 157 }
146 158
147 // The media controls DOM structure looks like: 159 // The media controls DOM structure looks like:
148 // 160 //
149 // MediaControls 161 // MediaControls
150 // (-webkit-media-controls) 162 // (-webkit-media-controls)
151 // +-MediaControlOverlayEnclosureElement 163 // +-MediaControlOverlayEnclosureElement
152 // | (-webkit-media-controls-overlay-enclosure) 164 // | (-webkit-media-controls-overlay-enclosure)
153 // | +-MediaControlOverlayPlayButtonElement 165 // | +-MediaControlOverlayPlayButtonElement
(...skipping 763 matching lines...) Expand 10 before | Expand all | Expand 10 after
917 visitor->trace(m_downloadButton); 929 visitor->trace(m_downloadButton);
918 visitor->trace(m_durationDisplay); 930 visitor->trace(m_durationDisplay);
919 visitor->trace(m_enclosure); 931 visitor->trace(m_enclosure);
920 visitor->trace(m_textTrackList); 932 visitor->trace(m_textTrackList);
921 visitor->trace(m_overflowMenu); 933 visitor->trace(m_overflowMenu);
922 visitor->trace(m_overflowList); 934 visitor->trace(m_overflowList);
923 visitor->trace(m_castButton); 935 visitor->trace(m_castButton);
924 visitor->trace(m_overlayCastButton); 936 visitor->trace(m_overlayCastButton);
925 visitor->trace(m_mediaEventListener); 937 visitor->trace(m_mediaEventListener);
926 visitor->trace(m_windowEventListener); 938 visitor->trace(m_windowEventListener);
939 visitor->trace(m_orientationLockDelegate);
927 HTMLDivElement::trace(visitor); 940 HTMLDivElement::trace(visitor);
928 } 941 }
929 942
930 } // namespace blink 943 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698