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

Side by Side Diff: Source/modules/wake_lock/WakeLockController.cpp

Issue 1084923002: Wake Lock API implementation (Blink part) (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Applied review comments Created 5 years, 7 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
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 "modules/wake_lock/WakeLockController.h"
7
8 #include "public/platform/modules/wake_lock/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)
mlamouri (slow - plz ping) 2015/05/05 13:45:44 You only use this method in ::provideTo(). It seem
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));
mlamouri (slow - plz ping) 2015/05/05 13:45:44 Could you add an ASSERT() checking that RuntimeEna
39 }
40
41 void WakeLockController::requestKeepScreenAwake(bool keepScreenAwake)
42 {
43 if (m_client) {
44 m_client->requestKeepScreenAwake(keepScreenAwake);
mlamouri (slow - plz ping) 2015/05/05 13:45:44 It seems that you will have problems when the fram
alogvinov 2015/05/06 09:12:34 Could you please elaborate? It seems that e.g. Geo
mlamouri (slow - plz ping) 2015/05/06 10:03:42 Geolocation.cpp will do early returns if there is
45 }
mlamouri (slow - plz ping) 2015/05/05 13:45:44 nit: no need for {}
46 }
47
48 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698