Chromium Code Reviews| 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..77c1523b5dd9bc0d75181c78e2bc5905600b5958 100644 |
| --- a/content/browser/power_save_blocker.h |
| +++ b/content/browser/power_save_blocker.h |
| @@ -6,35 +6,45 @@ |
| #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(); |
| + kPowerSaveBlockPreventStateCount |
|
Mark Mentovai
2011/10/13 04:29:18
Can you make this be a constant that’s not part of
|
| + }; |
| + |
| + 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(std::vector<int> deltas); |
|
jam
2011/10/13 16:40:29
const ref
Avi (use Gerrit)
2011/10/13 17:52:44
The reason I didn't was because I have a question.
jam
2011/10/13 18:38:35
yep it makes a copy
|
| // 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); |
| }; |