| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium OS Authors. All rights reserved. | 1 // Copyright (c) 2010 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/backlight_controller.h" | 5 #include "power_manager/backlight_controller.h" |
| 6 | 6 |
| 7 #include <gdk/gdkx.h> | 7 #include <gdk/gdkx.h> |
| 8 #include <math.h> | 8 #include <math.h> |
| 9 #include <X11/extensions/dpms.h> | 9 #include <X11/extensions/dpms.h> |
| 10 | 10 |
| 11 #include "base/logging.h" | 11 #include "base/logging.h" |
| 12 | 12 |
| 13 namespace power_manager { | 13 namespace power_manager { |
| 14 | 14 |
| 15 BacklightController::BacklightController(BacklightInterface* backlight, | 15 BacklightController::BacklightController(BacklightInterface* backlight, |
| 16 PowerPrefsInterface *prefs) | 16 PowerPrefsInterface* prefs) |
| 17 : backlight_(backlight), | 17 : backlight_(backlight), |
| 18 prefs_(prefs), | 18 prefs_(prefs), |
| 19 als_brightness_level_(0), | 19 als_brightness_level_(0), |
| 20 plugged_brightness_offset_(-1), | 20 plugged_brightness_offset_(-1), |
| 21 unplugged_brightness_offset_(-1), | 21 unplugged_brightness_offset_(-1), |
| 22 brightness_offset_(NULL), | 22 brightness_offset_(NULL), |
| 23 state_(BACKLIGHT_ACTIVE), | 23 state_(BACKLIGHT_ACTIVE), |
| 24 plugged_state_(POWER_UNKNOWN), | 24 plugged_state_(POWER_UNKNOWN), |
| 25 system_brightness_(0), | 25 system_brightness_(0), |
| 26 min_(0), | 26 min_(0), |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 130 if (plugged_state_ == POWER_CONNECTED) { | 130 if (plugged_state_ == POWER_CONNECTED) { |
| 131 CHECK(prefs_->WriteSetting("plugged_brightness_offset", | 131 CHECK(prefs_->WriteSetting("plugged_brightness_offset", |
| 132 plugged_brightness_offset_)); | 132 plugged_brightness_offset_)); |
| 133 } else if (plugged_state_ == POWER_DISCONNECTED) { | 133 } else if (plugged_state_ == POWER_DISCONNECTED) { |
| 134 CHECK(prefs_->WriteSetting("unplugged_brightness_offset", | 134 CHECK(prefs_->WriteSetting("unplugged_brightness_offset", |
| 135 unplugged_brightness_offset_)); | 135 unplugged_brightness_offset_)); |
| 136 } | 136 } |
| 137 } | 137 } |
| 138 | 138 |
| 139 } // namespace power_manager | 139 } // namespace power_manager |
| OLD | NEW |