|
OLD | NEW |
---|---|
(Empty) | |
1 // Copyright (c) 2012 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 #ifndef CONTENT_BROWSER_POWER_SAVE_BLOCKER2_H_ | |
6 #define CONTENT_BROWSER_POWER_SAVE_BLOCKER2_H_ | |
7 #pragma once | |
8 | |
9 #include "base/basictypes.h" | |
10 #include "content/common/content_export.h" | |
11 | |
12 // A RAII-style class to block the system from entering low-power (sleep) mode. | |
13 class CONTENT_EXPORT PowerSaveBlocker2 { | |
14 public: | |
15 enum PowerSaveBlockerType { | |
16 // Prevent the application from being suspended. On some platforms, apps may | |
17 // be suspended when they are not visible to the user. This type of block | |
18 // requests that the app continue to run in that case, and on all platforms | |
19 // prevents the system from sleeping. | |
20 // Example use cases: downloading a file, playing audio. | |
21 kPowerSaveBlockPreventAppSuspension, | |
22 | |
23 // Prevent the display from going to sleep. This also has the side effect of | |
24 // preventing the system from sleeping, but does not necessarily prevent the | |
25 // app from being suspended on some platforms if the user hides it. | |
26 // Example use case: playing video. | |
27 kPowerSaveBlockPreventDisplaySleep, | |
28 }; | |
29 | |
30 // Pass in the type of power save blocking desired. If multiple types of | |
31 // blocking are desired, instantiate one PowerSaveBlocker for each type. | |
32 explicit PowerSaveBlocker2(PowerSaveBlockerType type); | |
Avi (use Gerrit)
2012/06/04 21:58:52
Can we get a string to describe why?
Mike Mammarella
2012/06/04 22:21:28
Done.
| |
33 ~PowerSaveBlocker2(); | |
34 | |
35 private: | |
36 class PowerSaveBlockerImpl; | |
37 | |
38 // Implementations of this class may need a second object with different | |
39 // lifetime than the RAII container, or additional storage. This member is | |
40 // here for that purpose. | |
41 PowerSaveBlockerImpl* impl; | |
Avi (use Gerrit)
2012/06/04 21:58:52
Huh. I was going to go for #ifdef-ed member variab
Mike Mammarella
2012/06/04 22:21:28
We could do that too I suppose. In the Linux versi
| |
42 | |
43 DISALLOW_COPY_AND_ASSIGN(PowerSaveBlocker2); | |
44 }; | |
45 | |
46 #endif // CONTENT_BROWSER_POWER_SAVE_BLOCKER2_H_ | |
OLD | NEW |