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

Side by Side Diff: chromeos/dbus/power_policy_controller.h

Issue 12186010: chromeos: Add power management policy prefs. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix observer registration and bool prefs Created 7 years, 10 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chromeos/dbus/power_manager_client.cc ('k') | chromeos/dbus/power_policy_controller.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef CHROMEOS_DBUS_POWER_POLICY_CONTROLLER_H_
6 #define CHROMEOS_DBUS_POWER_POLICY_CONTROLLER_H_
7
8 #include "base/basictypes.h"
9 #include "base/compiler_specific.h"
10 #include "base/prefs/public/pref_service_base.h"
11 #include "chromeos/chromeos_export.h"
12 #include "chromeos/dbus/dbus_thread_manager_observer.h"
13 #include "chromeos/dbus/power_manager/policy.pb.h"
14 #include "chromeos/dbus/power_manager_client.h"
15
16 namespace chromeos {
17
18 class DBusThreadManager;
19
20 // PowerPolicyController is responsible for sending Chrome's assorted power
21 // management preferences to the Chrome OS power manager.
22 class CHROMEOS_EXPORT PowerPolicyController
23 : public DBusThreadManagerObserver,
24 public PowerManagerClient::Observer {
25 public:
26 // Note: Do not change these values; they are used by preferences.
27 enum Action {
28 ACTION_SUSPEND = 0,
29 ACTION_STOP_SESSION = 1,
30 ACTION_SHUT_DOWN = 2,
31 ACTION_DO_NOTHING = 3,
32 };
33
34 PowerPolicyController(DBusThreadManager* manager, PowerManagerClient* client);
35 ~PowerPolicyController();
36
37 // Sends an updated policy to the power manager based on the current
38 // values of the passed-in prefs.
39 void UpdatePolicyFromPrefs(
40 const PrefServiceBase::Preference& ac_screen_dim_delay_ms_pref,
41 const PrefServiceBase::Preference& ac_screen_off_delay_ms_pref,
42 const PrefServiceBase::Preference& ac_screen_lock_delay_ms_pref,
43 const PrefServiceBase::Preference& ac_idle_delay_ms_pref,
44 const PrefServiceBase::Preference& battery_screen_dim_delay_ms_pref,
45 const PrefServiceBase::Preference& battery_screen_off_delay_ms_pref,
46 const PrefServiceBase::Preference& battery_screen_lock_delay_ms_pref,
47 const PrefServiceBase::Preference& battery_idle_delay_ms_pref,
48 const PrefServiceBase::Preference& idle_action_pref,
49 const PrefServiceBase::Preference& lid_closed_action_pref,
50 const PrefServiceBase::Preference& use_audio_activity_pref,
51 const PrefServiceBase::Preference& use_video_activity_pref,
52 const PrefServiceBase::Preference& presentation_idle_delay_factor_pref);
53
54 // DBusThreadManagerObserver implementation:
55 virtual void OnDBusThreadManagerDestroying(DBusThreadManager* manager);
56
57 // PowerManagerClient::Observer implementation:
58 virtual void PowerManagerRestarted() OVERRIDE;
59
60 private:
61 // Sends a policy based on |prefs_policy_| to the power manager.
62 void SendCurrentPolicy();
63
64 // Sends an empty policy to the power manager to reset its configuration.
65 void SendEmptyPolicy();
66
67 DBusThreadManager* manager_; // not owned
68 PowerManagerClient* client_; // not owned
69
70 // Policy specified by the prefs that were last passed to
71 // UpdatePolicyFromPrefs().
72 power_manager::PowerManagementPolicy prefs_policy_;
73
74 DISALLOW_COPY_AND_ASSIGN(PowerPolicyController);
75 };
76
77 } // namespace chromeos
78
79 #endif // CHROMEOS_DBUS_POWER_POLICY_CONTROLLER_H_
OLDNEW
« 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