Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(371)

Unified Diff: content/browser/power_save_blocker.h

Issue 8251008: Add screen power save block level. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: build fix Created 9 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/browser/download/base_file.cc ('k') | content/browser/power_save_blocker_common.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
};
« no previous file with comments | « content/browser/download/base_file.cc ('k') | content/browser/power_save_blocker_common.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698