1 // Copyright 2014 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 #ifndef ATHENA_SYSTEM_POWER_BUTTON_CONTROLLER_H_
6 #define ATHENA_SYSTEM_POWER_BUTTON_CONTROLLER_H_
8 #include "base/time/time.h"
9 #include "chromeos/dbus/power_manager_client.h"
10 #include "ui/compositor/layer_animation_observer.h"
11 #include "ui/gfx/animation/tween.h"
15 // Shuts down in response to the power button being pressed.
16 class PowerButtonController
: public chromeos::PowerManagerClient::Observer
,
17 public ui::ImplicitAnimationObserver
{
19 PowerButtonController();
20 virtual ~PowerButtonController();
24 // The screen is animating prior to shutdown. Shutdown can be canceled.
25 STATE_PRE_SHUTDOWN_ANIMATION
,
27 // A D-Bus shutdown request has been sent. Shutdown cannot be canceled.
28 STATE_SHUTDOWN_REQUESTED
,
33 // Animates the screen's grayscale and brightness to |target|.
34 void StartGrayscaleAndBrightnessAnimation(float target
,
36 gfx::Tween::Type tween_type
);
38 // chromeos::PowerManagerClient::Observer:
39 virtual void BrightnessChanged(int level
, bool user_initiated
) OVERRIDE
;
40 virtual void PowerButtonEventReceived(
42 const base::TimeTicks
& timestamp
) OVERRIDE
;
44 // ui::ImplicitAnimationObserver:
45 virtual void OnImplicitAnimationsCompleted() OVERRIDE
;
47 // Whether the screen brightness was reduced to 0%.
48 bool brightness_is_zero_
;
50 // The last time at which the screen brightness was 0%.
51 base::TimeTicks zero_brightness_end_time_
;
55 DISALLOW_COPY_AND_ASSIGN(PowerButtonController
);
60 #endif // ATHENA_SYSTEM_POWER_BUTTON_CONTROLLER_H_