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..5cfa2490fdffd39b9d74a56ef5d420b5bb856701 |
| --- /dev/null |
| +++ b/chromeos/dbus/power_policy_controller.h |
| @@ -0,0 +1,61 @@ |
| +// 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" |
|
Mattias Nissler (ping if slow)
2013/02/05 13:16:18
needed?
Daniel Erat
2013/02/05 14:05:58
Shouldn't be. Thanks, removed.
|
| +#include "base/prefs/public/pref_service_base.h" |
| +#include "base/time.h" |
|
Mattias Nissler (ping if slow)
2013/02/05 13:16:18
needed?
Daniel Erat
2013/02/05 14:05:58
Removed.
|
| +#include "chromeos/chromeos_export.h" |
| +#include "chromeos/dbus/power_manager/policy.pb.h" |
| + |
| +namespace chromeos { |
| + |
| +class PowerManagerClient; |
| + |
| +class CHROMEOS_EXPORT PowerPolicyController { |
| + public: |
| + // Note: Do not change these values; they are used by preferences. |
| + enum Action { |
| + ACTION_SUSPEND = 0, |
| + ACTION_STOP_SESSION = 1, |
| + ACTION_SHUT_DOWN = 2, |
| + ACTION_DO_NOTHING = 3, |
| + }; |
| + |
| + explicit PowerPolicyController(PowerManagerClient* client); |
| + ~PowerPolicyController(); |
| + |
| + // Sends an updated policy to the power manager based on the current |
| + // values of the passed-in prefs. |
| + void UpdatePolicyFromPrefs( |
| + const PrefServiceBase::Preference& ac_screen_dim_delay_ms_pref, |
| + const PrefServiceBase::Preference& ac_screen_off_delay_ms_pref, |
| + const PrefServiceBase::Preference& ac_screen_lock_delay_ms_pref, |
| + const PrefServiceBase::Preference& ac_idle_delay_ms_pref, |
| + const PrefServiceBase::Preference& battery_screen_dim_delay_ms_pref, |
| + const PrefServiceBase::Preference& battery_screen_off_delay_ms_pref, |
| + const PrefServiceBase::Preference& battery_screen_lock_delay_ms_pref, |
| + const PrefServiceBase::Preference& battery_idle_delay_ms_pref, |
| + const PrefServiceBase::Preference& idle_action_pref, |
| + const PrefServiceBase::Preference& lid_closed_action_pref, |
| + const PrefServiceBase::Preference& use_audio_activity_pref, |
| + const PrefServiceBase::Preference& use_video_activity_pref, |
| + const PrefServiceBase::Preference& presentation_idle_delay_factor_pref); |
| + |
| + private: |
| + PowerManagerClient* client_; // not owned |
| + |
| + // Policy specified by the prefs that were last passed to |
| + // UpdatePolicyFromPrefs(). |
| + power_manager::PowerManagementPolicy prefs_policy_; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(PowerPolicyController); |
| +}; |
| + |
| +} // namespace chromeos |
| + |
| +#endif // CHROMEOS_DBUS_POWER_POLICY_CONTROLLER_H_ |