Index: Source/modules/wake_lock/WakeLockController.cpp |
diff --git a/Source/modules/wake_lock/WakeLockController.cpp b/Source/modules/wake_lock/WakeLockController.cpp |
new file mode 100644 |
index 0000000000000000000000000000000000000000..2203e08d61ee414aacd7a6f8f27cdc73f29419ae |
--- /dev/null |
+++ b/Source/modules/wake_lock/WakeLockController.cpp |
@@ -0,0 +1,48 @@ |
+// 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. |
+ |
+#include "config.h" |
+#include "modules/wake_lock/WakeLockController.h" |
+ |
+#include "public/platform/modules/wake_lock/WebWakeLockClient.h" |
+ |
+namespace blink { |
+ |
+WakeLockController::WakeLockController(LocalFrame& frame, WebWakeLockClient* client) |
+ : m_client(client) |
+{ |
+} |
+ |
+// static |
+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
|
+{ |
+ return adoptPtrWillBeNoop(new WakeLockController(frame, client)); |
+} |
+ |
+// static |
+const char* WakeLockController::supplementName() |
+{ |
+ return "WakeLockController"; |
+} |
+ |
+// static |
+WakeLockController* WakeLockController::from(LocalFrame* frame) |
+{ |
+ return static_cast<WakeLockController*>(WillBeHeapSupplement<LocalFrame>::from(frame, supplementName())); |
+} |
+ |
+// static |
+void WakeLockController::provideTo(LocalFrame& frame, WebWakeLockClient* client) |
+{ |
+ WillBeHeapSupplement<LocalFrame>::provideTo(frame, WakeLockController::supplementName(), WakeLockController::create(frame, client)); |
mlamouri (slow - plz ping)
2015/05/05 13:45:44
Could you add an ASSERT() checking that RuntimeEna
|
+} |
+ |
+void WakeLockController::requestKeepScreenAwake(bool keepScreenAwake) |
+{ |
+ if (m_client) { |
+ 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
|
+ } |
mlamouri (slow - plz ping)
2015/05/05 13:45:44
nit: no need for {}
|
+} |
+ |
+} // namespace blink |