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

Side by Side Diff: content/browser/wake_lock/wake_lock_service_impl.cc

Issue 2389743002: Content Modularization Project: Move Wake Lock to //device (Closed)
Patch Set: Eliminate frame reference Created 4 years, 2 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 "content/browser/wake_lock/wake_lock_service_impl.h"
6
7 #include <utility>
8
9 #include "content/browser/wake_lock/wake_lock_service_context.h"
10
11 namespace content {
12
13 WakeLockServiceImpl::WakeLockServiceImpl(
14 base::WeakPtr<WakeLockServiceContext> context)
15 : context_(context), wake_lock_request_outstanding_(false) {}
16
17 WakeLockServiceImpl::~WakeLockServiceImpl() {
18 CancelWakeLock();
19 }
20
21 void WakeLockServiceImpl::RequestWakeLock() {
22 if (!context_ || wake_lock_request_outstanding_)
23 return;
24
25 wake_lock_request_outstanding_ = true;
26 context_->RequestWakeLock();
27 }
28
29 void WakeLockServiceImpl::CancelWakeLock() {
30 if (!context_ || !wake_lock_request_outstanding_)
31 return;
32
33 wake_lock_request_outstanding_ = false;
34 context_->CancelWakeLock();
35 }
36
37 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/wake_lock/wake_lock_service_impl.h ('k') | content/browser/web_contents/web_contents_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698