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

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

Issue 2126733002: Make ScreenWakeLock ContextLifecycleObserver instead of LocalFrameLifecycleObserver (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: temp 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 | « no previous file | third_party/WebKit/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
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 #ifndef ScreenWakeLock_h 5 #ifndef ScreenWakeLock_h
6 #define ScreenWakeLock_h 6 #define ScreenWakeLock_h
7 7
8 #include "core/frame/LocalFrameLifecycleObserver.h" 8 #include "core/dom/ContextLifecycleObserver.h"
9 #include "core/page/PageLifecycleObserver.h" 9 #include "core/page/PageLifecycleObserver.h"
10 #include "modules/ModulesExport.h" 10 #include "modules/ModulesExport.h"
11 #include "public/platform/modules/wake_lock/wake_lock_service.mojom-blink.h" 11 #include "public/platform/modules/wake_lock/wake_lock_service.mojom-blink.h"
12 #include "wtf/Noncopyable.h" 12 #include "wtf/Noncopyable.h"
13 13
14 namespace blink { 14 namespace blink {
15 15
16 class LocalFrame; 16 class LocalFrame;
17 class Screen; 17 class Screen;
18 class ServiceRegistry; 18 class ServiceRegistry;
19 19
20 class MODULES_EXPORT ScreenWakeLock final : public GarbageCollectedFinalized<Scr eenWakeLock>, public Supplement<LocalFrame>, public PageLifecycleObserver, publi c LocalFrameLifecycleObserver { 20 class MODULES_EXPORT ScreenWakeLock final : public GarbageCollectedFinalized<Scr eenWakeLock>, public Supplement<LocalFrame>, public ContextLifecycleObserver, pu blic PageLifecycleObserver {
21 USING_GARBAGE_COLLECTED_MIXIN(ScreenWakeLock); 21 USING_GARBAGE_COLLECTED_MIXIN(ScreenWakeLock);
22 WTF_MAKE_NONCOPYABLE(ScreenWakeLock); 22 WTF_MAKE_NONCOPYABLE(ScreenWakeLock);
23 public: 23 public:
24 static bool keepAwake(Screen&); 24 static bool keepAwake(Screen&);
25 static void setKeepAwake(Screen&, bool); 25 static void setKeepAwake(Screen&, bool);
26 26
27 static const char* supplementName(); 27 static const char* supplementName();
28 static ScreenWakeLock* from(LocalFrame*); 28 static ScreenWakeLock* from(LocalFrame*);
29 static void provideTo(LocalFrame&, ServiceRegistry*);
30 29
31 ~ScreenWakeLock() = default; 30 ~ScreenWakeLock() = default;
32 31
33 DECLARE_VIRTUAL_TRACE(); 32 DECLARE_VIRTUAL_TRACE();
34 33
35 private: 34 private:
36 ScreenWakeLock(LocalFrame&, ServiceRegistry*); 35 explicit ScreenWakeLock(LocalFrame&);
37 36
38 // Inherited from PageLifecycleObserver. 37 // Inherited from PageLifecycleObserver.
39 void pageVisibilityChanged() override; 38 void pageVisibilityChanged() override;
40 void didCommitLoad(LocalFrame*) override; 39 void contextDestroyed() override;
41
42 // Inherited from LocalFrameLifecycleObserver.
43 void willDetachFrameHost() override;
44 40
45 bool keepAwake() const; 41 bool keepAwake() const;
46 void setKeepAwake(bool); 42 void setKeepAwake(bool);
47 43
48 static ScreenWakeLock* fromScreen(Screen&); 44 static ScreenWakeLock* fromScreen(Screen&);
49 void notifyService(); 45 void notifyService();
50 46
51 mojom::blink::WakeLockServicePtr m_service; 47 mojom::blink::WakeLockServicePtr m_service;
52 bool m_keepAwake; 48 bool m_keepAwake;
53 }; 49 };
54 50
55 } // namespace blink 51 } // namespace blink
56 52
57 #endif // ScreenWakeLock_h 53 #endif // ScreenWakeLock_h
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/modules/wake_lock/ScreenWakeLock.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698