Chromium Code Reviews| Index: chromeos/dbus/power_policy_controller.h |
| diff --git a/chromeos/dbus/power_policy_controller.h b/chromeos/dbus/power_policy_controller.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..a025114adafdcb453bfe3490b7da43bc4d8b6ed6 |
| --- /dev/null |
| +++ b/chromeos/dbus/power_policy_controller.h |
| @@ -0,0 +1,84 @@ |
| +// Copyright (c) 2013 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef CHROMEOS_DBUS_POWER_POLICY_CONTROLLER_H_ |
| +#define CHROMEOS_DBUS_POWER_POLICY_CONTROLLER_H_ |
| + |
| +#include "base/basictypes.h" |
| +#include "base/compiler_specific.h" |
| +#include "base/time.h" |
| +#include "chromeos/chromeos_export.h" |
| + |
| +namespace chromeos { |
| + |
| +class PowerManagerClient; |
| + |
| +class CHROMEOS_EXPORT PowerPolicyController { |
| + public: |
| + // Note: Do not change these values; they are used by preferences. |
| + enum OptionalAction { |
| + ACTION_UNSET = -1, |
|
bartfab (slow)
2013/02/04 10:04:35
This value is not needed.
Daniel Erat
2013/02/04 13:35:45
I added this because the pref code needed to use i
|
| + ACTION_SUSPEND = 0, |
| + ACTION_STOP_SESSION = 1, |
| + ACTION_SHUT_DOWN = 2, |
| + ACTION_DO_NOTHING = 3, |
| + }; |
| + |
| + // Note: Do not change these values; they are used by preferences. |
| + enum OptionalBool { |
|
bartfab (slow)
2013/02/04 10:04:35
Not needed.
|
| + BOOL_UNSET = -1, |
| + BOOL_FALSE = 0, |
| + BOOL_TRUE = 1, |
| + }; |
| + |
| + // Delay in milliseconds that can be used to signify an unset value. |
| + static const int kUnsetDelayMs; |
|
bartfab (slow)
2013/02/04 10:04:35
Not needed.
|
| + |
| + // Presentation idle-delay scaling factor that can be used to signify an |
| + // unset value. |
| + static const double kUnsetPresentationIdleDelayFactor; |
|
bartfab (slow)
2013/02/04 10:04:35
Not needed.
|
| + |
| + struct PolicyPrefs { |
| + PolicyPrefs(); |
| + |
| + base::TimeDelta ac_screen_dim_delay; |
| + base::TimeDelta ac_screen_off_delay; |
| + base::TimeDelta ac_screen_lock_delay; |
| + base::TimeDelta ac_idle_delay; |
| + base::TimeDelta battery_screen_dim_delay; |
| + base::TimeDelta battery_screen_off_delay; |
| + base::TimeDelta battery_screen_lock_delay; |
| + base::TimeDelta battery_idle_delay; |
| + OptionalAction idle_action; |
| + OptionalAction lid_closed_action; |
| + OptionalBool use_audio_activity; |
| + OptionalBool use_video_activity; |
| + double presentation_idle_delay_factor; |
| + }; |
| + |
| + explicit PowerPolicyController(PowerManagerClient* client); |
| + ~PowerPolicyController(); |
| + |
| + // Sends an updated policy based on |prefs| to the power manager. |
| + void UpdatePolicyFromPrefs(const PolicyPrefs& prefs); |
|
Daniel Erat
2013/02/04 03:10:07
(My intent is that this class will later become re
bartfab (slow)
2013/02/04 10:04:35
Why not reference the actual prefs? The PolicyPref
Daniel Erat
2013/02/04 13:35:45
I didn't realize that the prefs code derives from
bartfab (slow)
2013/02/04 14:43:52
Either pass a number of Preferences to this class
|
| + |
| + // Resets |prefs_| and calls SendPolicy(). This resets the power |
| + // manager's behavior to the defaults. |
| + void ResetPolicy(); |
| + |
| + private: |
| + // Generates a policy based on |prefs_| and sends it to the power |
| + // manager. |
| + void SendPolicy(); |
| + |
| + PowerManagerClient* client_; // not owned |
| + |
| + PolicyPrefs prefs_; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(PowerPolicyController); |
| +}; |
| + |
| +} // namespace chromeos |
| + |
| +#endif // CHROMEOS_DBUS_POWER_POLICY_CONTROLLER_H_ |