| OLD | NEW |
| 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 Loading... |
| 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 |
| OLD | NEW |