Chromium Code Reviews| Index: Source/modules/wake_lock/ScreenWakeLock.h |
| diff --git a/Source/modules/wake_lock/ScreenWakeLock.h b/Source/modules/wake_lock/ScreenWakeLock.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..d0af09328e0136b564a2ee3c1a9fa6211f46315c |
| --- /dev/null |
| +++ b/Source/modules/wake_lock/ScreenWakeLock.h |
| @@ -0,0 +1,59 @@ |
| +// Copyright 2015 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef ScreenWakeLock_h |
| +#define ScreenWakeLock_h |
| + |
| +#include "core/frame/LocalFrameLifecycleObserver.h" |
| +#include "core/page/PageLifecycleObserver.h" |
| +#include "modules/ModulesExport.h" |
| +#include "wtf/Noncopyable.h" |
| + |
| +namespace blink { |
| + |
| +class LocalFrame; |
| +class Screen; |
| +class WebWakeLockClient; |
| + |
| +class MODULES_EXPORT ScreenWakeLock final |
|
jochen (gone - plz use gerrit)
2015/07/24 11:25:43
all the inherited stuff on one line please, there'
alogvinov
2015/07/24 13:36:01
Acknowledged.
|
| + : public NoBaseWillBeGarbageCollected<ScreenWakeLock> |
| + , public WillBeHeapSupplement<LocalFrame> |
|
sof
2015/07/24 12:01:51
Question: ScreenWakeLock.idl is defined to be a Sc
|
| + , PageLifecycleObserver |
|
jochen (gone - plz use gerrit)
2015/07/24 11:25:43
always add public
alogvinov
2015/07/24 13:36:01
Acknowledged.
|
| + , LocalFrameLifecycleObserver { |
| + WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(ScreenWakeLock); |
|
jochen (gone - plz use gerrit)
2015/07/24 11:25:43
why WILL_BE? modules are already in oilpan
sof
2015/07/24 12:01:51
A bit confusing, but WILL_BE is relative to LocalF
|
| + WTF_MAKE_NONCOPYABLE(ScreenWakeLock); |
| +public: |
| + // IDL-bound functions |
|
mlamouri (slow - plz ping)
2015/07/24 10:47:57
nit: we usually don't add that kind of comments.
alogvinov
2015/07/24 13:36:01
Acknowledged.
|
| + static bool keepAwake(Screen&); |
| + static void setKeepAwake(Screen&, bool); |
| + |
| + bool keepAwake() const { return m_keepAwake; } |
| + void setKeepAwake(bool); |
| + |
| + static const char* supplementName(); |
| + static ScreenWakeLock* from(LocalFrame*); |
| + static void provideTo(LocalFrame&, WebWakeLockClient*); |
| + |
| + // Inherited from PageLifecycleObserver |
|
mlamouri (slow - plz ping)
2015/07/24 10:47:57
nit: period at the end of the sentence.
alogvinov
2015/07/24 13:36:01
Acknowledged.
|
| + virtual void pageVisibilityChanged() override; |
| + virtual void didCommitLoad(LocalFrame*) override; |
|
sof
2015/07/24 12:01:51
Blink is now aligned with http://code.google.com/p
alogvinov
2015/07/24 13:36:01
Acknowledged.
|
| + |
| + // Inherited from LocalFrameLifecycleObserver |
|
mlamouri (slow - plz ping)
2015/07/24 10:47:57
ditto.
alogvinov
2015/07/24 13:36:01
Acknowledged.
|
| + virtual void willDetachFrameHost() override; |
| + |
| + DECLARE_VIRTUAL_TRACE(); |
| + |
| +private: |
| + ScreenWakeLock(LocalFrame&, WebWakeLockClient*); |
| + |
| + static ScreenWakeLock* fromScreen(Screen&); |
| + void notifyClient(); |
| + |
| + bool m_keepAwake; |
| + WebWakeLockClient* m_client; |
|
sof
2015/07/24 12:01:51
nit: have m_keepAwake last.
alogvinov
2015/07/24 13:36:01
Acknowledged.
|
| +}; |
| + |
| +} // namespace blink |
| + |
| +#endif // ScreenWakeLock_h |