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

Unified Diff: chromeos/dbus/power_policy_controller.h

Issue 12775019: chromeos: Remove PowerStateOverride. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: more feedback Created 7 years, 9 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 | « chromeos/dbus/power_manager_client.cc ('k') | chromeos/dbus/power_policy_controller.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chromeos/dbus/power_policy_controller.h
diff --git a/chromeos/dbus/power_policy_controller.h b/chromeos/dbus/power_policy_controller.h
index d0c0b46e912c04d9ef15c294055e3077a042aa83..3d45769b3e8384e90f2b00b829d835466481ea69 100644
--- a/chromeos/dbus/power_policy_controller.h
+++ b/chromeos/dbus/power_policy_controller.h
@@ -5,6 +5,9 @@
#ifndef CHROMEOS_DBUS_POWER_POLICY_CONTROLLER_H_
#define CHROMEOS_DBUS_POWER_POLICY_CONTROLLER_H_
+#include <map>
+#include <string>
+
#include "base/basictypes.h"
#include "base/compiler_specific.h"
#include "base/prefs/pref_service.h"
@@ -53,6 +56,17 @@ class CHROMEOS_EXPORT PowerPolicyController
const PrefService::Preference& use_video_activity_pref,
const PrefService::Preference& presentation_idle_delay_factor_pref);
+ // Registers a request to temporarily prevent the screen from getting
+ // dimmed or turned off or the system from suspending in response to user
+ // inactivity. Returns a unique ID that can be passed to RemoveBlock()
+ // later.
+ int AddScreenBlock(const std::string& reason);
+ int AddSuspendBlock(const std::string& reason);
+
+ // Unregisters a request previously created via AddScreenBlock() or
+ // AddSuspendBlock().
+ void RemoveBlock(int id);
+
// DBusThreadManagerObserver implementation:
virtual void OnDBusThreadManagerDestroying(DBusThreadManager* manager)
OVERRIDE;
@@ -61,6 +75,8 @@ class CHROMEOS_EXPORT PowerPolicyController
virtual void PowerManagerRestarted() OVERRIDE;
private:
+ typedef std::map<int, std::string> BlockMap;
+
// Sends a policy based on |prefs_policy_| to the power manager.
void SendCurrentPolicy();
@@ -74,6 +90,18 @@ class CHROMEOS_EXPORT PowerPolicyController
// UpdatePolicyFromPrefs().
power_manager::PowerManagementPolicy prefs_policy_;
+ // Are one or more fields set in |prefs_policy_|?
+ bool prefs_were_set_;
+
+ // Maps from an ID representing a request to prevent the screen from
+ // getting dimmed or turned off or to prevent the system from suspending
+ // to the reason for the request.
+ BlockMap screen_blocks_;
+ BlockMap suspend_blocks_;
+
+ // Next ID to be used by AddScreenBlock() or AddSuspendBlock().
+ int next_block_id_;
+
DISALLOW_COPY_AND_ASSIGN(PowerPolicyController);
};
« no previous file with comments | « chromeos/dbus/power_manager_client.cc ('k') | chromeos/dbus/power_policy_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698