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"
12 #include "ui/gfx/native_widget_types.h"
16 class PowerSaveBlockerImpl
: public PowerSaveBlocker
{
18 PowerSaveBlockerImpl(PowerSaveBlockerType type
,
20 const std::string
& description
);
21 ~PowerSaveBlockerImpl() override
;
23 #if defined(OS_ANDROID)
24 // In Android platform, the kPowerSaveBlockPreventDisplaySleep type of
25 // PowerSaveBlocker should associated with the ViewAndroid,
26 // so the blocker could be removed by platform if the view isn't visble
27 void InitDisplaySleepBlocker(gfx::NativeView view_android
);
33 // Implementations of this class may need a second object with different
34 // lifetime than the RAII container, or additional storage. This member is
35 // here for that purpose. If not used, just define the class as an empty
36 // RefCounted (or RefCountedThreadSafe) like so to make it compile:
37 // class PowerSaveBlocker::Delegate
38 // : public base::RefCounted<PowerSaveBlocker::Delegate> {
40 // friend class base::RefCounted<Delegate>;
43 scoped_refptr
<Delegate
> delegate_
;
45 DISALLOW_COPY_AND_ASSIGN(PowerSaveBlockerImpl
);
48 } // namespace content
50 #endif // CONTENT_BROWSER_POWER_SAVE_BLOCKER_IMPL_H_