Chromium Code Reviews| Index: content/renderer/wake_lock/wake_lock_dispatcher.cc |
| diff --git a/content/renderer/wake_lock/wake_lock_dispatcher.cc b/content/renderer/wake_lock/wake_lock_dispatcher.cc |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..954fc85f7ce690be59c295e7f4ee7b38a3248e69 |
| --- /dev/null |
| +++ b/content/renderer/wake_lock/wake_lock_dispatcher.cc |
| @@ -0,0 +1,27 @@ |
| +// Copyright 2014 The Chromium Authors. All rights reserved. |
|
nasko
2015/04/28 23:57:37
2015
|
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#include "content/renderer/wake_lock/wake_lock_dispatcher.h" |
| + |
| +#include "content/public/common/service_registry.h" |
| +#include "content/public/renderer/render_frame.h" |
| + |
| +namespace content { |
| + |
| +WakeLockDispatcher::WakeLockDispatcher(RenderFrame* render_frame) |
| + : RenderFrameObserver(render_frame), |
| + blink::WebWakeLockClient() { |
| +} |
| + |
| +WakeLockDispatcher::~WakeLockDispatcher() {} |
| + |
| +void WakeLockDispatcher::requestKeepScreenAwake(bool intention) { |
| + if (!wake_lock_service_) { |
| + render_frame()->GetServiceRegistry()->ConnectToRemoteService( |
| + &wake_lock_service_); |
| + } |
| + wake_lock_service_->KeepScreenAwake(intention); |
| +} |
| + |
| +} // namespace content |