Chromium Code Reviews

Side by Side Diff: Source/core/dom/WakeLockController.cpp

Issue 1084923002: Wake Lock API implementation (Blink part) (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff |
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 #include "config.h"
6 #include "core/dom/WakeLockController.h"
7
8 #include "public/platform/WebWakeLockClient.h"
9
10 namespace blink {
11
12 WakeLockController::WakeLockController(LocalFrame& frame, WebWakeLockClient* cli ent)
13 : m_client(client)
14 {
15 }
16
17 // static
18 PassOwnPtrWillBeRawPtr<WakeLockController> WakeLockController::create(LocalFrame & frame, WebWakeLockClient* client)
19 {
20 return adoptPtrWillBeNoop(new WakeLockController(frame, client));
21 }
22
23 // static
24 const char* WakeLockController::supplementName()
25 {
26 return "WakeLockController";
27 }
28
29 // static
30 WakeLockController* WakeLockController::from(LocalFrame* frame)
31 {
32 return static_cast<WakeLockController*>(WillBeHeapSupplement<LocalFrame>::fr om(frame, supplementName()));
33 }
34
35 // static
36 void WakeLockController::provideTo(LocalFrame& frame, WebWakeLockClient* client)
37 {
38 WillBeHeapSupplement<LocalFrame>::provideTo(frame, WakeLockController::suppl ementName(), WakeLockController::create(frame, client));
39 }
40
41 void WakeLockController::requestKeepScreenAwake(bool keepScreenAwake)
42 {
43 if (m_client) {
44 m_client->requestKeepScreenAwake(keepScreenAwake);
45 }
46 }
47
48 } // namespace blink
OLDNEW

Powered by Google App Engine