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

Side by Side Diff: Source/modules/wake_lock/ScreenWakeLock.h

Issue 1084923002: Wake Lock API implementation (Blink part) (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 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 | « Source/modules/wake_lock/DEPS ('k') | Source/modules/wake_lock/ScreenWakeLock.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef ScreenWakeLock_h
6 #define ScreenWakeLock_h
7
8 #include "core/frame/LocalFrameLifecycleObserver.h"
9 #include "core/page/PageLifecycleObserver.h"
10 #include "modules/ModulesExport.h"
11 #include "wtf/Noncopyable.h"
12
13 namespace blink {
14
15 class LocalFrame;
16 class Screen;
17 class WebWakeLockClient;
18
19 class MODULES_EXPORT ScreenWakeLock final : public NoBaseWillBeGarbageCollected< ScreenWakeLock>, public WillBeHeapSupplement<LocalFrame>, public PageLifecycleOb server, public LocalFrameLifecycleObserver {
20 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(ScreenWakeLock);
21 WTF_MAKE_NONCOPYABLE(ScreenWakeLock);
22 public:
23 static bool keepAwake(Screen&);
24 static void setKeepAwake(Screen&, bool);
25
26 bool keepAwake() const { return m_keepAwake; }
27 void setKeepAwake(bool);
28
29 static const char* supplementName();
30 static ScreenWakeLock* from(LocalFrame*);
31 static void provideTo(LocalFrame&, WebWakeLockClient*);
32
33 // Inherited from PageLifecycleObserver.
34 void pageVisibilityChanged() override;
35 void didCommitLoad(LocalFrame*) override;
36
37 // Inherited from LocalFrameLifecycleObserver.
38 void willDetachFrameHost() override;
39
40 DECLARE_VIRTUAL_TRACE();
41
42 private:
43 ScreenWakeLock(LocalFrame&, WebWakeLockClient*);
44
45 static ScreenWakeLock* fromScreen(Screen&);
46 void notifyClient();
47
48 WebWakeLockClient* m_client;
49 bool m_keepAwake;
50 };
51
52 } // namespace blink
53
54 #endif // ScreenWakeLock_h
OLDNEW
« no previous file with comments | « Source/modules/wake_lock/DEPS ('k') | Source/modules/wake_lock/ScreenWakeLock.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698