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

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: with unit tests 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 15 matching lines...) Expand all
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/shadow/MediaControlsMediaEventListener.h" 35 #include "core/html/shadow/MediaControlsMediaEventListener.h"
36 #include "core/html/shadow/MediaControlsOrientationLockDelegate.h"
36 #include "core/html/shadow/MediaControlsWindowEventListener.h" 37 #include "core/html/shadow/MediaControlsWindowEventListener.h"
37 #include "core/html/track/TextTrackContainer.h" 38 #include "core/html/track/TextTrackContainer.h"
38 #include "core/html/track/TextTrackList.h" 39 #include "core/html/track/TextTrackList.h"
39 #include "core/layout/LayoutObject.h" 40 #include "core/layout/LayoutObject.h"
40 #include "core/layout/LayoutTheme.h" 41 #include "core/layout/LayoutTheme.h"
41 #include "platform/EventDispatchForbiddenScope.h" 42 #include "platform/EventDispatchForbiddenScope.h"
42 43
43 namespace blink { 44 namespace blink {
44 45
45 // If you change this value, then also update the corresponding value in 46 // 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), 121 m_toggleClosedCaptionsButton(nullptr),
121 m_textTrackList(nullptr), 122 m_textTrackList(nullptr),
122 m_overflowList(nullptr), 123 m_overflowList(nullptr),
123 m_castButton(nullptr), 124 m_castButton(nullptr),
124 m_fullscreenButton(nullptr), 125 m_fullscreenButton(nullptr),
125 m_downloadButton(nullptr), 126 m_downloadButton(nullptr),
126 m_mediaEventListener(new MediaControlsMediaEventListener(this)), 127 m_mediaEventListener(new MediaControlsMediaEventListener(this)),
127 m_windowEventListener(MediaControlsWindowEventListener::create( 128 m_windowEventListener(MediaControlsWindowEventListener::create(
128 this, 129 this,
129 WTF::bind(&MediaControls::hideAllMenus, wrapWeakPersistent(this)))), 130 WTF::bind(&MediaControls::hideAllMenus, wrapWeakPersistent(this)))),
131 m_orientationLockDelegate(nullptr),
130 m_hideMediaControlsTimer(this, 132 m_hideMediaControlsTimer(this,
131 &MediaControls::hideMediaControlsTimerFired), 133 &MediaControls::hideMediaControlsTimerFired),
132 m_hideTimerBehaviorFlags(IgnoreNone), 134 m_hideTimerBehaviorFlags(IgnoreNone),
133 m_isMouseOverControls(false), 135 m_isMouseOverControls(false),
134 m_isPausedForScrubbing(false), 136 m_isPausedForScrubbing(false),
135 m_panelWidthChangedTimer(this, 137 m_panelWidthChangedTimer(this,
136 &MediaControls::panelWidthChangedTimerFired), 138 &MediaControls::panelWidthChangedTimerFired),
137 m_panelWidth(0), 139 m_panelWidth(0),
138 m_keepShowingUntilTimerFires(false) {} 140 m_keepShowingUntilTimerFires(false) {}
139 141
140 MediaControls* MediaControls::create(HTMLMediaElement& mediaElement) { 142 MediaControls* MediaControls::create(HTMLMediaElement& mediaElement) {
141 MediaControls* controls = new MediaControls(mediaElement); 143 MediaControls* controls = new MediaControls(mediaElement);
142 controls->setShadowPseudoId(AtomicString("-webkit-media-controls")); 144 controls->setShadowPseudoId(AtomicString("-webkit-media-controls"));
143 controls->initializeControls(); 145 controls->initializeControls();
146
147 // Initialize the orientation lock when going fullscreen feature.
148 if (RuntimeEnabledFeatures::videoFullscreenOrientationLockEnabled() &&
149 mediaElement.isHTMLVideoElement()) {
150 controls->m_orientationLockDelegate =
151 new MediaControlsOrientationLockDelegate(controls);
152 }
153
144 return controls; 154 return controls;
145 } 155 }
146 156
147 // The media controls DOM structure looks like: 157 // The media controls DOM structure looks like:
148 // 158 //
149 // MediaControls 159 // MediaControls
150 // (-webkit-media-controls) 160 // (-webkit-media-controls)
151 // +-MediaControlOverlayEnclosureElement 161 // +-MediaControlOverlayEnclosureElement
152 // | (-webkit-media-controls-overlay-enclosure) 162 // | (-webkit-media-controls-overlay-enclosure)
153 // | +-MediaControlOverlayPlayButtonElement 163 // | +-MediaControlOverlayPlayButtonElement
(...skipping 765 matching lines...) Expand 10 before | Expand all | Expand 10 after
919 visitor->trace(m_downloadButton); 929 visitor->trace(m_downloadButton);
920 visitor->trace(m_durationDisplay); 930 visitor->trace(m_durationDisplay);
921 visitor->trace(m_enclosure); 931 visitor->trace(m_enclosure);
922 visitor->trace(m_textTrackList); 932 visitor->trace(m_textTrackList);
923 visitor->trace(m_overflowMenu); 933 visitor->trace(m_overflowMenu);
924 visitor->trace(m_overflowList); 934 visitor->trace(m_overflowList);
925 visitor->trace(m_castButton); 935 visitor->trace(m_castButton);
926 visitor->trace(m_overlayCastButton); 936 visitor->trace(m_overlayCastButton);
927 visitor->trace(m_mediaEventListener); 937 visitor->trace(m_mediaEventListener);
928 visitor->trace(m_windowEventListener); 938 visitor->trace(m_windowEventListener);
939 visitor->trace(m_orientationLockDelegate);
929 HTMLDivElement::trace(visitor); 940 HTMLDivElement::trace(visitor);
930 } 941 }
931 942
932 } // namespace blink 943 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698