[Password Generation] Enable new UI
[chromium-blink-merge.git] / chromeos / dbus / fake_power_manager_client.cc
blob6007d753409c87c8c58387744f589003d345a908
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.
5 #include "chromeos/dbus/fake_power_manager_client.h"
6 #include "chromeos/dbus/power_manager/policy.pb.h"
8 namespace chromeos {
10 FakePowerManagerClient::FakePowerManagerClient()
11 : num_request_restart_calls_(0),
12 num_set_policy_calls_(0) {
15 FakePowerManagerClient::~FakePowerManagerClient() {
18 void FakePowerManagerClient::Init(dbus::Bus* bus) {
21 void FakePowerManagerClient::AddObserver(Observer* observer) {
22 observers_.AddObserver(observer);
25 void FakePowerManagerClient::RemoveObserver(Observer* observer) {
26 observers_.RemoveObserver(observer);
29 void FakePowerManagerClient::RequestStatusUpdate() {
32 void FakePowerManagerClient::SetPolicy(
33 const power_manager::PowerManagementPolicy& policy) {
34 policy_ = policy;
35 ++num_set_policy_calls_;
38 void FakePowerManagerClient::RequestShutdown() {
41 void FakePowerManagerClient::DecreaseScreenBrightness(bool allow_off) {
44 void FakePowerManagerClient::SetScreenBrightnessPercent(double percent,
45 bool gradual) {
48 void FakePowerManagerClient::GetScreenBrightnessPercent(
49 const GetScreenBrightnessPercentCallback& callback) {
52 base::Closure FakePowerManagerClient::GetSuspendReadinessCallback() {
53 return base::Closure();
56 int FakePowerManagerClient::GetNumPendingSuspendReadinessCallbacks() {
57 return 0;
60 bool FakePowerManagerClient::HasObserver(Observer* observer) {
61 return false;
64 void FakePowerManagerClient::RequestRestart() {
65 ++num_request_restart_calls_;
68 void FakePowerManagerClient::IncreaseKeyboardBrightness() {
71 void FakePowerManagerClient::IncreaseScreenBrightness() {
74 void FakePowerManagerClient::NotifyVideoActivity(bool is_fullscreen) {
77 void FakePowerManagerClient::DecreaseKeyboardBrightness() {
80 void FakePowerManagerClient::SetIsProjecting(bool is_projecting) {
83 void FakePowerManagerClient::NotifyUserActivity(
84 power_manager::UserActivityType type) {
87 void FakePowerManagerClient::SendSuspendImminent() {
88 FOR_EACH_OBSERVER(Observer, observers_, SuspendImminent());
91 void FakePowerManagerClient::SendSuspendStateChanged(
92 const power_manager::SuspendState& suspend_state) {
93 base::Time wall_time =
94 base::Time::FromInternalValue(suspend_state.wall_time());
95 switch (suspend_state.type()) {
96 case power_manager::SuspendState_Type_SUSPEND_TO_MEMORY:
97 last_suspend_wall_time_ = wall_time;
98 break;
99 case power_manager::SuspendState_Type_RESUME:
100 FOR_EACH_OBSERVER(Observer, observers_,
101 SystemResumed(wall_time - last_suspend_wall_time_));
102 break;
106 } // namespace chromeos