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

Side by Side Diff: third_party/WebKit/Source/modules/media_controls/MediaControlsRotateToFullscreenDelegate.cpp

Issue 2855843002: Reland "Sync requestFullscreen() and exitFullscreen() algorithms with the spec" (Closed)
Patch Set: Reland "Sync requestFullscreen() and exitFullscreen() algorithms with the spec" Created 3 years, 6 months 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 // Copyright 2017 The Chromium Authors. All rights reserved. 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 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 #include "modules/media_controls/MediaControlsRotateToFullscreenDelegate.h" 5 #include "modules/media_controls/MediaControlsRotateToFullscreenDelegate.h"
6 6
7 #include "core/dom/ElementVisibilityObserver.h" 7 #include "core/dom/ElementVisibilityObserver.h"
8 #include "core/dom/Fullscreen.h" 8 #include "core/dom/Fullscreen.h"
9 #include "core/dom/UserGestureIndicator.h" 9 #include "core/dom/UserGestureIndicator.h"
10 #include "core/events/Event.h" 10 #include "core/events/Event.h"
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
133 current_screen_orientation_ = ComputeScreenOrientation(); 133 current_screen_orientation_ = ComputeScreenOrientation();
134 DVLOG(3) << __func__ << " " << static_cast<int>(previous_screen_orientation) 134 DVLOG(3) << __func__ << " " << static_cast<int>(previous_screen_orientation)
135 << " -> " << static_cast<int>(current_screen_orientation_); 135 << " -> " << static_cast<int>(current_screen_orientation_);
136 136
137 // Only enable if native media controls are used. 137 // Only enable if native media controls are used.
138 if (!video_element_->ShouldShowControls()) 138 if (!video_element_->ShouldShowControls())
139 return; 139 return;
140 140
141 // Don't enter/exit fullscreen if some other element is fullscreen. 141 // Don't enter/exit fullscreen if some other element is fullscreen.
142 Element* fullscreen_element = 142 Element* fullscreen_element =
143 Fullscreen::CurrentFullScreenElementFrom(video_element_->GetDocument()); 143 Fullscreen::FullscreenElementFrom(video_element_->GetDocument());
144 if (fullscreen_element && fullscreen_element != video_element_) 144 if (fullscreen_element && fullscreen_element != video_element_)
145 return; 145 return;
146 146
147 // To enter fullscreen, video must be visible and playing. 147 // To enter fullscreen, video must be visible and playing.
148 // TODO(johnme): If orientation changes whilst this tab is in the background, 148 // TODO(johnme): If orientation changes whilst this tab is in the background,
149 // we'll get an orientationchange event when this tab next becomes active. 149 // we'll get an orientationchange event when this tab next becomes active.
150 // Check that those events don't trigger rotate-to-fullscreen. 150 // Check that those events don't trigger rotate-to-fullscreen.
151 if (!video_element_->IsFullscreen() && 151 if (!video_element_->IsFullscreen() &&
152 (!is_visible_ || video_element_->paused())) { 152 (!is_visible_ || video_element_->paused())) {
153 return; 153 return;
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
223 return SimpleOrientation::kUnknown; 223 return SimpleOrientation::kUnknown;
224 } 224 }
225 225
226 DEFINE_TRACE(MediaControlsRotateToFullscreenDelegate) { 226 DEFINE_TRACE(MediaControlsRotateToFullscreenDelegate) {
227 EventListener::Trace(visitor); 227 EventListener::Trace(visitor);
228 visitor->Trace(video_element_); 228 visitor->Trace(video_element_);
229 visitor->Trace(visibility_observer_); 229 visitor->Trace(visibility_observer_);
230 } 230 }
231 231
232 } // namespace blink 232 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698