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

Side by Side Diff: third_party/WebKit/Source/modules/screen_orientation/ScreenOrientationController.cpp

Issue 1631063002: Add isPageVisible to Page (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@my-origin
Patch Set: Remove unnecessary variable Created 4 years, 10 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/screen_orientation/ScreenOrientationController.h" 5 #include "modules/screen_orientation/ScreenOrientationController.h"
6 6
7 #include "core/events/Event.h" 7 #include "core/events/Event.h"
8 #include "core/frame/FrameHost.h" 8 #include "core/frame/FrameHost.h"
9 #include "core/frame/FrameView.h" 9 #include "core/frame/FrameView.h"
10 #include "core/frame/LocalFrame.h" 10 #include "core/frame/LocalFrame.h"
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 orientationType = computeOrientation(chromeClient.screenInfo().rect, eff ectiveAngle(chromeClient)); 99 orientationType = computeOrientation(chromeClient.screenInfo().rect, eff ectiveAngle(chromeClient));
100 } 100 }
101 ASSERT(orientationType != WebScreenOrientationUndefined); 101 ASSERT(orientationType != WebScreenOrientationUndefined);
102 102
103 m_orientation->setType(orientationType); 103 m_orientation->setType(orientationType);
104 m_orientation->setAngle(effectiveAngle(chromeClient)); 104 m_orientation->setAngle(effectiveAngle(chromeClient));
105 } 105 }
106 106
107 bool ScreenOrientationController::isActiveAndVisible() const 107 bool ScreenOrientationController::isActiveAndVisible() const
108 { 108 {
109 return m_orientation && frame() && page() && page()->visibilityState() == Pa geVisibilityStateVisible; 109 return m_orientation && frame() && page() && page()->isPageVisible();
110 } 110 }
111 111
112 void ScreenOrientationController::pageVisibilityChanged() 112 void ScreenOrientationController::pageVisibilityChanged()
113 { 113 {
114 notifyDispatcher(); 114 notifyDispatcher();
115 115
116 if (!isActiveAndVisible()) 116 if (!isActiveAndVisible())
117 return; 117 return;
118 118
119 // The orientation type and angle are tied in a way that if the angle has 119 // The orientation type and angle are tied in a way that if the angle has
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
223 return true; 223 return true;
224 } 224 }
225 225
226 void ScreenOrientationController::willDetachFrameHost() 226 void ScreenOrientationController::willDetachFrameHost()
227 { 227 {
228 m_client = nullptr; 228 m_client = nullptr;
229 } 229 }
230 230
231 void ScreenOrientationController::notifyDispatcher() 231 void ScreenOrientationController::notifyDispatcher()
232 { 232 {
233 if (m_orientation && page()->visibilityState() == PageVisibilityStateVisible ) 233 if (m_orientation && page()->isPageVisible())
234 startUpdating(); 234 startUpdating();
235 else 235 else
236 stopUpdating(); 236 stopUpdating();
237 } 237 }
238 238
239 DEFINE_TRACE(ScreenOrientationController) 239 DEFINE_TRACE(ScreenOrientationController)
240 { 240 {
241 visitor->trace(m_orientation); 241 visitor->trace(m_orientation);
242 LocalFrameLifecycleObserver::trace(visitor); 242 LocalFrameLifecycleObserver::trace(visitor);
243 WillBeHeapSupplement<LocalFrame>::trace(visitor); 243 WillBeHeapSupplement<LocalFrame>::trace(visitor);
244 PlatformEventController::trace(visitor); 244 PlatformEventController::trace(visitor);
245 } 245 }
246 246
247 } // namespace blink 247 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698