1 // Copyright (c) 2013 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.
5 #ifndef CONTENT_BROWSER_POWER_SAVE_BLOCKER_IMPL_H_
6 #define CONTENT_BROWSER_POWER_SAVE_BLOCKER_IMPL_H_
10 #include "base/memory/ref_counted.h"
11 #include "content/public/browser/power_save_blocker.h"
17 class PowerSaveBlockerImpl
: public PowerSaveBlocker
{
19 PowerSaveBlockerImpl(PowerSaveBlockerType type
,
21 const std::string
& description
);
22 ~PowerSaveBlockerImpl() override
;
24 #if defined(OS_ANDROID)
25 // In Android platform, the kPowerSaveBlockPreventDisplaySleep type of
26 // PowerSaveBlocker should associated with a WebContents, so the blocker
27 // could be removed by platform if the WebContents is hidden.
28 void InitDisplaySleepBlocker(WebContents
* web_contents
);
34 // Implementations of this class may need a second object with different
35 // lifetime than the RAII container, or additional storage. This member is
36 // here for that purpose. If not used, just define the class as an empty
37 // RefCounted (or RefCountedThreadSafe) like so to make it compile:
38 // class PowerSaveBlocker::Delegate
39 // : public base::RefCounted<PowerSaveBlocker::Delegate> {
41 // friend class base::RefCounted<Delegate>;
44 scoped_refptr
<Delegate
> delegate_
;
46 DISALLOW_COPY_AND_ASSIGN(PowerSaveBlockerImpl
);
49 } // namespace content
51 #endif // CONTENT_BROWSER_POWER_SAVE_BLOCKER_IMPL_H_