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

Side by Side Diff: third_party/WebKit/Source/modules/wake_lock/ScreenWakeLock.cpp

Issue 1631063002: Add isPageVisible to Page (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@my-origin
Patch Set: Clean up 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/wake_lock/ScreenWakeLock.h" 5 #include "modules/wake_lock/ScreenWakeLock.h"
6 6
7 #include "core/frame/LocalFrame.h" 7 #include "core/frame/LocalFrame.h"
8 #include "core/frame/Screen.h" 8 #include "core/frame/Screen.h"
9 #include "core/page/PageVisibilityState.h" 9 #include "core/page/PageVisibilityState.h"
10 #include "platform/RuntimeEnabledFeatures.h" 10 #include "platform/RuntimeEnabledFeatures.h"
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 ScreenWakeLock* ScreenWakeLock::fromScreen(Screen& screen) 97 ScreenWakeLock* ScreenWakeLock::fromScreen(Screen& screen)
98 { 98 {
99 return screen.frame() ? ScreenWakeLock::from(screen.frame()) : nullptr; 99 return screen.frame() ? ScreenWakeLock::from(screen.frame()) : nullptr;
100 } 100 }
101 101
102 void ScreenWakeLock::notifyClient() 102 void ScreenWakeLock::notifyClient()
103 { 103 {
104 if (!m_client) 104 if (!m_client)
105 return; 105 return;
106 106
107 bool visible = page() && page()->visibilityState() == PageVisibilityStateVis ible; 107 m_client->requestKeepScreenAwake(m_keepAwake && page() && page()->isPageVisi ble());
108 m_client->requestKeepScreenAwake(m_keepAwake && visible);
109 } 108 }
110 109
111 } // namespace blink 110 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698