Index: content/browser/power_save_blocker.h |
diff --git a/content/browser/power_save_blocker.h b/content/browser/power_save_blocker.h |
index 7d04e6ebbdd5f31c8c7ef16a184424e11acd6d6f..48ebbc094db27c58114b9e6bfaa4e1cda2ed8378 100644 |
--- a/content/browser/power_save_blocker.h |
+++ b/content/browser/power_save_blocker.h |
@@ -6,35 +6,48 @@ |
#define CONTENT_BROWSER_POWER_SAVE_BLOCKER_H_ |
#pragma once |
+#include <vector> |
+ |
#include "base/basictypes.h" |
// A RAII-style class to block the system from entering low-power (sleep) mode. |
class PowerSaveBlocker { |
public: |
- explicit PowerSaveBlocker(bool enabled); |
- ~PowerSaveBlocker(); |
+ enum PowerSaveBlockerType { |
+ kPowerSaveBlockPreventNone = -1, |
+ |
+ // Prevent the system from going to sleep; allow display sleep. |
+ kPowerSaveBlockPreventSystemSleep, |
- bool enabled() const { return enabled_; } |
+ // Prevent the system or display from going to sleep. |
+ kPowerSaveBlockPreventDisplaySleep, |
- // Puts the sleep mode block into effect. |
- void Enable(); |
- // Disables the sleep block. |
- void Disable(); |
+ // Count of the values; not valid as a parameter. |
+ kPowerSaveBlockPreventStateCount |
Avi (use Gerrit)
2011/10/14 00:16:06
The pattern of putting a count as the last item in
|
+ }; |
+ |
+ // Pass in the level of sleep prevention desired. kPowerSaveBlockPreventNone |
+ // is not a valid option. |
+ explicit PowerSaveBlocker(PowerSaveBlockerType type); |
+ ~PowerSaveBlocker(); |
private: |
// Platform-specific function called when enable state is changed. |
// Guaranteed to be called only from the UI thread. |
- static void ApplyBlock(bool blocked); |
+ static void ApplyBlock(PowerSaveBlockerType type); |
// Called only from UI thread. |
- static void AdjustBlockCount(int delta); |
+ static void AdjustBlockCount(const std::vector<int>& deltas); |
// Invokes AdjustBlockCount on the UI thread. |
- static void PostAdjustBlockCount(int delta); |
+ static void PostAdjustBlockCount(const std::vector<int>& deltas); |
+ |
+ // Returns the highest-severity block type in use. |
+ static PowerSaveBlockerType HighestBlockType(); |
- bool enabled_; |
+ PowerSaveBlockerType type_; |
- static int blocker_count_; |
+ static int blocker_count_[]; |
DISALLOW_COPY_AND_ASSIGN(PowerSaveBlocker); |
}; |