OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CONTENT_PUBLIC_BROWSER_POWER_SAVE_BLOCKER_H_ | 5 #ifndef CONTENT_PUBLIC_BROWSER_POWER_SAVE_BLOCKER_H_ |
6 #define CONTENT_PUBLIC_BROWSER_POWER_SAVE_BLOCKER_H_ | 6 #define CONTENT_PUBLIC_BROWSER_POWER_SAVE_BLOCKER_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 14 matching lines...) Expand all Loading... |
25 // Example use cases: downloading a file, playing audio. | 25 // Example use cases: downloading a file, playing audio. |
26 kPowerSaveBlockPreventAppSuspension, | 26 kPowerSaveBlockPreventAppSuspension, |
27 | 27 |
28 // Prevent the display from going to sleep. This also has the side effect of | 28 // Prevent the display from going to sleep. This also has the side effect of |
29 // preventing the system from sleeping, but does not necessarily prevent the | 29 // preventing the system from sleeping, but does not necessarily prevent the |
30 // app from being suspended on some platforms if the user hides it. | 30 // app from being suspended on some platforms if the user hides it. |
31 // Example use case: playing video. | 31 // Example use case: playing video. |
32 kPowerSaveBlockPreventDisplaySleep, | 32 kPowerSaveBlockPreventDisplaySleep, |
33 }; | 33 }; |
34 | 34 |
| 35 // Reasons why power-saving features may be blocked. |
| 36 enum Reason { |
| 37 // Audio is being played. |
| 38 kReasonAudioPlayback, |
| 39 // Video is being played. |
| 40 kReasonVideoPlayback, |
| 41 // Power-saving is blocked for some other reason. |
| 42 kReasonOther, |
| 43 }; |
| 44 |
35 virtual ~PowerSaveBlocker() = 0; | 45 virtual ~PowerSaveBlocker() = 0; |
36 | 46 |
37 // Pass in the type of power save blocking desired. If multiple types of | 47 // Pass in the type of power save blocking desired. If multiple types of |
38 // blocking are desired, instantiate one PowerSaveBlocker for each type. | 48 // blocking are desired, instantiate one PowerSaveBlocker for each type. |
39 // |reason| may be provided to the underlying system APIs on some platforms. | 49 // |reason| and |description| (a more-verbose, human-readable justification of |
| 50 // the blocking) may be provided to the underlying system APIs on some |
| 51 // platforms. |
40 static scoped_ptr<PowerSaveBlocker> Create(PowerSaveBlockerType type, | 52 static scoped_ptr<PowerSaveBlocker> Create(PowerSaveBlockerType type, |
41 const std::string& reason); | 53 Reason reason, |
| 54 const std::string& description); |
42 }; | 55 }; |
43 | 56 |
44 } // namespace content | 57 } // namespace content |
45 | 58 |
46 #endif // CONTENT_PUBLIC_BROWSER_POWER_SAVE_BLOCKER_H_ | 59 #endif // CONTENT_PUBLIC_BROWSER_POWER_SAVE_BLOCKER_H_ |
OLD | NEW |