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

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: 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
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/time.h"
11 #include "chromeos/chromeos_export.h"
12
13 namespace chromeos {
14
15 class PowerManagerClient;
16
17 class CHROMEOS_EXPORT PowerPolicyController {
18 public:
19 // Note: Do not change these values; they are used by preferences.
20 enum OptionalAction {
21 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
22 ACTION_SUSPEND = 0,
23 ACTION_STOP_SESSION = 1,
24 ACTION_SHUT_DOWN = 2,
25 ACTION_DO_NOTHING = 3,
26 };
27
28 // Note: Do not change these values; they are used by preferences.
29 enum OptionalBool {
bartfab (slow) 2013/02/04 10:04:35 Not needed.
30 BOOL_UNSET = -1,
31 BOOL_FALSE = 0,
32 BOOL_TRUE = 1,
33 };
34
35 // Delay in milliseconds that can be used to signify an unset value.
36 static const int kUnsetDelayMs;
bartfab (slow) 2013/02/04 10:04:35 Not needed.
37
38 // Presentation idle-delay scaling factor that can be used to signify an
39 // unset value.
40 static const double kUnsetPresentationIdleDelayFactor;
bartfab (slow) 2013/02/04 10:04:35 Not needed.
41
42 struct PolicyPrefs {
43 PolicyPrefs();
44
45 base::TimeDelta ac_screen_dim_delay;
46 base::TimeDelta ac_screen_off_delay;
47 base::TimeDelta ac_screen_lock_delay;
48 base::TimeDelta ac_idle_delay;
49 base::TimeDelta battery_screen_dim_delay;
50 base::TimeDelta battery_screen_off_delay;
51 base::TimeDelta battery_screen_lock_delay;
52 base::TimeDelta battery_idle_delay;
53 OptionalAction idle_action;
54 OptionalAction lid_closed_action;
55 OptionalBool use_audio_activity;
56 OptionalBool use_video_activity;
57 double presentation_idle_delay_factor;
58 };
59
60 explicit PowerPolicyController(PowerManagerClient* client);
61 ~PowerPolicyController();
62
63 // Sends an updated policy based on |prefs| to the power manager.
64 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
65
66 // Resets |prefs_| and calls SendPolicy(). This resets the power
67 // manager's behavior to the defaults.
68 void ResetPolicy();
69
70 private:
71 // Generates a policy based on |prefs_| and sends it to the power
72 // manager.
73 void SendPolicy();
74
75 PowerManagerClient* client_; // not owned
76
77 PolicyPrefs prefs_;
78
79 DISALLOW_COPY_AND_ASSIGN(PowerPolicyController);
80 };
81
82 } // namespace chromeos
83
84 #endif // CHROMEOS_DBUS_POWER_POLICY_CONTROLLER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698