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

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

Issue 2138663003: Rename PageLifecycleObserver to PageVisibilityObserver (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 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
« no previous file with comments | « third_party/WebKit/Source/modules/wake_lock/ScreenWakeLock.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/dom/Document.h" 7 #include "core/dom/Document.h"
8 #include "core/frame/LocalFrame.h" 8 #include "core/frame/LocalFrame.h"
9 #include "core/frame/Screen.h" 9 #include "core/frame/Screen.h"
10 #include "core/page/PageVisibilityState.h" 10 #include "core/page/PageVisibilityState.h"
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 } 56 }
57 57
58 void ScreenWakeLock::contextDestroyed() 58 void ScreenWakeLock::contextDestroyed()
59 { 59 {
60 setKeepAwake(false); 60 setKeepAwake(false);
61 } 61 }
62 62
63 DEFINE_TRACE(ScreenWakeLock) 63 DEFINE_TRACE(ScreenWakeLock)
64 { 64 {
65 Supplement<LocalFrame>::trace(visitor); 65 Supplement<LocalFrame>::trace(visitor);
66 PageLifecycleObserver::trace(visitor); 66 PageVisibilityObserver::trace(visitor);
67 ContextLifecycleObserver::trace(visitor); 67 ContextLifecycleObserver::trace(visitor);
68 } 68 }
69 69
70 ScreenWakeLock::ScreenWakeLock(LocalFrame& frame) 70 ScreenWakeLock::ScreenWakeLock(LocalFrame& frame)
71 : ContextLifecycleObserver(frame.document()) 71 : ContextLifecycleObserver(frame.document())
72 , PageLifecycleObserver(frame.page()) 72 , PageVisibilityObserver(frame.page())
73 , m_keepAwake(false) 73 , m_keepAwake(false)
74 { 74 {
75 DCHECK(!m_service.is_bound()); 75 DCHECK(!m_service.is_bound());
76 DCHECK(frame.serviceRegistry()); 76 DCHECK(frame.serviceRegistry());
77 frame.serviceRegistry()->connectToRemoteService(mojo::GetProxy(&m_service)); 77 frame.serviceRegistry()->connectToRemoteService(mojo::GetProxy(&m_service));
78 } 78 }
79 79
80 bool ScreenWakeLock::keepAwake() const 80 bool ScreenWakeLock::keepAwake() const
81 { 81 {
82 return m_keepAwake; 82 return m_keepAwake;
(...skipping 16 matching lines...) Expand all
99 if (!m_service) 99 if (!m_service)
100 return; 100 return;
101 101
102 if (m_keepAwake && page() && page()->isPageVisible()) 102 if (m_keepAwake && page() && page()->isPageVisible())
103 m_service->RequestWakeLock(); 103 m_service->RequestWakeLock();
104 else 104 else
105 m_service->CancelWakeLock(); 105 m_service->CancelWakeLock();
106 } 106 }
107 107
108 } // namespace blink 108 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/modules/wake_lock/ScreenWakeLock.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698