Make RenderFrameProxy a WebRemoteFrameClient
[chromium-blink-merge.git] / athena / system / power_button_controller.h
blob0d4bd0e50b609069573f45c7df9a08bab221681d
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"
13 namespace athena {
15 // Shuts down in response to the power button being pressed.
16 class PowerButtonController : public chromeos::PowerManagerClient::Observer,
17 public ui::ImplicitAnimationObserver {
18 public:
19 PowerButtonController();
20 virtual ~PowerButtonController();
22 private:
23 enum State {
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,
30 STATE_OTHER
33 // Animates the screen's grayscale and brightness to |target|.
34 void StartGrayscaleAndBrightnessAnimation(float target,
35 int duration_ms,
36 gfx::Tween::Type tween_type);
38 // chromeos::PowerManagerClient::Observer:
39 virtual void BrightnessChanged(int level, bool user_initiated) OVERRIDE;
40 virtual void PowerButtonEventReceived(
41 bool down,
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_;
53 State state_;
55 DISALLOW_COPY_AND_ASSIGN(PowerButtonController);
58 } // namespace athena
60 #endif // ATHENA_SYSTEM_POWER_BUTTON_CONTROLLER_H_