OLD | NEW |
1 // Copyright (c) 2011 The Chromium OS Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium OS Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "power_manager/powerd.h" | 5 #include "power_manager/powerd.h" |
6 | 6 |
7 #include <gdk/gdkx.h> | 7 #include <gdk/gdkx.h> |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 #include <X11/extensions/dpms.h> | 9 #include <X11/extensions/dpms.h> |
10 #include <X11/keysym.h> | 10 #include <X11/keysym.h> |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 // Daemon: Main power manager. Adjusts device status based on whether the | 43 // Daemon: Main power manager. Adjusts device status based on whether the |
44 // user is idle and on video activity indicator from the window manager. | 44 // user is idle and on video activity indicator from the window manager. |
45 // This daemon is responsible for dimming of the backlight, turning | 45 // This daemon is responsible for dimming of the backlight, turning |
46 // the screen off, and suspending to RAM. The daemon also has the | 46 // the screen off, and suspending to RAM. The daemon also has the |
47 // capability of shutting the system down. | 47 // capability of shutting the system down. |
48 | 48 |
49 Daemon::Daemon(BacklightController* backlight_controller, | 49 Daemon::Daemon(BacklightController* backlight_controller, |
50 PowerPrefs* prefs, | 50 PowerPrefs* prefs, |
51 MetricsLibraryInterface* metrics_lib, | 51 MetricsLibraryInterface* metrics_lib, |
52 VideoDetectorInterface* video_detector, | 52 VideoDetectorInterface* video_detector, |
| 53 MonitorReconfigureMain* monitor_reconfigure, |
53 const FilePath& run_dir) | 54 const FilePath& run_dir) |
54 : backlight_controller_(backlight_controller), | 55 : backlight_controller_(backlight_controller), |
55 prefs_(prefs), | 56 prefs_(prefs), |
56 metrics_lib_(metrics_lib), | 57 metrics_lib_(metrics_lib), |
57 video_detector_(video_detector), | 58 video_detector_(video_detector), |
| 59 monitor_reconfigure_(monitor_reconfigure), |
58 low_battery_suspend_percent_(0), | 60 low_battery_suspend_percent_(0), |
59 clean_shutdown_initiated_(false), | 61 clean_shutdown_initiated_(false), |
60 low_battery_(false), | 62 low_battery_(false), |
61 enforce_lock_(false), | 63 enforce_lock_(false), |
62 use_xscreensaver_(false), | 64 use_xscreensaver_(false), |
63 plugged_state_(kPowerUnknown), | 65 plugged_state_(kPowerUnknown), |
64 idle_state_(kIdleUnknown), | 66 idle_state_(kIdleUnknown), |
65 file_tagger_(FilePath(kTaggedFilePath)), | 67 file_tagger_(FilePath(kTaggedFilePath)), |
66 shutdown_state_(kShutdownNone), | 68 shutdown_state_(kShutdownNone), |
67 suspender_(&locker_, &file_tagger_), | 69 suspender_(&locker_, &file_tagger_), |
(...skipping 628 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
696 dbus_message_append_args(signal, | 698 dbus_message_append_args(signal, |
697 DBUS_TYPE_INT32, &brightness, | 699 DBUS_TYPE_INT32, &brightness, |
698 DBUS_TYPE_BOOLEAN, &user_initiated_int, | 700 DBUS_TYPE_BOOLEAN, &user_initiated_int, |
699 DBUS_TYPE_INVALID); | 701 DBUS_TYPE_INVALID); |
700 dbus_g_proxy_send(proxy.gproxy(), signal, NULL); | 702 dbus_g_proxy_send(proxy.gproxy(), signal, NULL); |
701 dbus_message_unref(signal); | 703 dbus_message_unref(signal); |
702 } | 704 } |
703 | 705 |
704 void Daemon::HandleResume() { | 706 void Daemon::HandleResume() { |
705 file_tagger_.HandleResumeEvent(); | 707 file_tagger_.HandleResumeEvent(); |
706 backlight_controller_->SetPowerState(BACKLIGHT_ACTIVE_ON); | 708 // Monitor reconfigure will set the backlight if needed. |
| 709 monitor_reconfigure_->Run(); |
707 } | 710 } |
708 | 711 |
709 } // namespace power_manager | 712 } // namespace power_manager |
OLD | NEW |