| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 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 | 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 "chromeos/dbus/fake_power_manager_client.h" | 5 #include "chromeos/dbus/fake_power_manager_client.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
| 9 #include "base/location.h" | 9 #include "base/location.h" |
| 10 #include "base/threading/thread_task_runner_handle.h" | 10 #include "base/threading/thread_task_runner_handle.h" |
| (...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 178 observer.BrightnessChanged(level, user_initiated); | 178 observer.BrightnessChanged(level, user_initiated); |
| 179 } | 179 } |
| 180 | 180 |
| 181 void FakePowerManagerClient::SendPowerButtonEvent( | 181 void FakePowerManagerClient::SendPowerButtonEvent( |
| 182 bool down, | 182 bool down, |
| 183 const base::TimeTicks& timestamp) { | 183 const base::TimeTicks& timestamp) { |
| 184 for (auto& observer : observers_) | 184 for (auto& observer : observers_) |
| 185 observer.PowerButtonEventReceived(down, timestamp); | 185 observer.PowerButtonEventReceived(down, timestamp); |
| 186 } | 186 } |
| 187 | 187 |
| 188 void FakePowerManagerClient::SetLidState(LidState state, |
| 189 const base::TimeTicks& timestamp) { |
| 190 lid_state_ = state; |
| 191 for (auto& observer : observers_) |
| 192 observer.LidEventReceived(state, timestamp); |
| 193 } |
| 194 |
| 188 void FakePowerManagerClient::UpdatePowerProperties( | 195 void FakePowerManagerClient::UpdatePowerProperties( |
| 189 const power_manager::PowerSupplyProperties& power_props) { | 196 const power_manager::PowerSupplyProperties& power_props) { |
| 190 props_ = power_props; | 197 props_ = power_props; |
| 191 NotifyObservers(); | 198 NotifyObservers(); |
| 192 } | 199 } |
| 193 | 200 |
| 194 void FakePowerManagerClient::NotifyObservers() { | 201 void FakePowerManagerClient::NotifyObservers() { |
| 195 for (auto& observer : observers_) | 202 for (auto& observer : observers_) |
| 196 observer.PowerChanged(props_); | 203 observer.PowerChanged(props_); |
| 197 } | 204 } |
| 198 | 205 |
| 199 void FakePowerManagerClient::HandleSuspendReadiness() { | 206 void FakePowerManagerClient::HandleSuspendReadiness() { |
| 200 CHECK(num_pending_suspend_readiness_callbacks_ > 0); | 207 CHECK(num_pending_suspend_readiness_callbacks_ > 0); |
| 201 | 208 |
| 202 --num_pending_suspend_readiness_callbacks_; | 209 --num_pending_suspend_readiness_callbacks_; |
| 203 } | 210 } |
| 204 | 211 |
| 205 } // namespace chromeos | 212 } // namespace chromeos |
| OLD | NEW |