| Index: Source/core/dom/WakeLockController.cpp
|
| diff --git a/Source/core/dom/WakeLockController.cpp b/Source/core/dom/WakeLockController.cpp
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..695cfe2664fff2bf66359883201c758fc51f26b3
|
| --- /dev/null
|
| +++ b/Source/core/dom/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 "core/dom/WakeLockController.h"
|
| +
|
| +#include "public/platform/WebWakeLockClient.h"
|
| +
|
| +namespace blink {
|
| +
|
| +WakeLockController::WakeLockController(LocalFrame& frame, WebWakeLockClient* client)
|
| + : m_client(client)
|
| +{
|
| +}
|
| +
|
| +// static
|
| +PassOwnPtrWillBeRawPtr<WakeLockController> WakeLockController::create(LocalFrame& frame, WebWakeLockClient* client)
|
| +{
|
| + 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));
|
| +}
|
| +
|
| +void WakeLockController::requestKeepScreenAwake(bool keepScreenAwake)
|
| +{
|
| + if (m_client) {
|
| + m_client->requestKeepScreenAwake(keepScreenAwake);
|
| + }
|
| +}
|
| +
|
| +} // namespace blink
|
|
|