Updating trunk VERSION from 2139.0 to 2140.0
[chromium-blink-merge.git] / content / browser / power_save_blocker_impl.h
blob948aced4cb45151f98f942411f7a0f79af305ba2
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_
8 #include "base/memory/ref_counted.h"
9 #include "content/public/browser/power_save_blocker.h"
10 #include "ui/gfx/native_widget_types.h"
12 namespace content {
14 class PowerSaveBlockerImpl : public PowerSaveBlocker {
15 public:
16 PowerSaveBlockerImpl(PowerSaveBlockerType type, const std::string& reason);
17 virtual ~PowerSaveBlockerImpl();
19 #if defined(OS_ANDROID)
20 // In Android platform, the kPowerSaveBlockPreventDisplaySleep type of
21 // PowerSaveBlocker should associated with the ViewAndroid,
22 // so the blocker could be removed by platform if the view isn't visble
23 void InitDisplaySleepBlocker(gfx::NativeView view_android);
24 #endif
26 private:
27 class Delegate;
29 // Implementations of this class may need a second object with different
30 // lifetime than the RAII container, or additional storage. This member is
31 // here for that purpose. If not used, just define the class as an empty
32 // RefCounted (or RefCountedThreadSafe) like so to make it compile:
33 // class PowerSaveBlocker::Delegate
34 // : public base::RefCounted<PowerSaveBlocker::Delegate> {
35 // private:
36 // friend class base::RefCounted<Delegate>;
37 // ~Delegate() {}
38 // };
39 scoped_refptr<Delegate> delegate_;
41 DISALLOW_COPY_AND_ASSIGN(PowerSaveBlockerImpl);
44 } // namespace content
46 #endif // CONTENT_BROWSER_POWER_SAVE_BLOCKER_IMPL_H_