Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(642)

Side by Side Diff: athena/system/power_button_controller.h

Issue 451753002: Add fade to white animation when power button is pressed on Athena (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 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 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 #ifndef ATHENA_SYSTEM_POWER_BUTTON_CONTROLLER_H_ 5 #ifndef ATHENA_SYSTEM_POWER_BUTTON_CONTROLLER_H_
6 #define ATHENA_SYSTEM_POWER_BUTTON_CONTROLLER_H_ 6 #define ATHENA_SYSTEM_POWER_BUTTON_CONTROLLER_H_
7 7
8 #include "base/time/time.h"
8 #include "chromeos/dbus/power_manager_client.h" 9 #include "chromeos/dbus/power_manager_client.h"
10 #include "ui/compositor/layer_animation_observer.h"
11 #include "ui/gfx/animation/tween.h"
9 12
10 namespace athena { 13 namespace athena {
11 14
12 // Shuts down in response to the power button being pressed. 15 // Shuts down in response to the power button being pressed.
13 class PowerButtonController : public chromeos::PowerManagerClient::Observer { 16 class PowerButtonController : public chromeos::PowerManagerClient::Observer,
17 public ui::ImplicitAnimationObserver {
14 public: 18 public:
15 PowerButtonController(); 19 PowerButtonController();
16 virtual ~PowerButtonController(); 20 virtual ~PowerButtonController();
17 21
22 private:
23 enum State {
24 // The screen is animating prior to shutdown. Shutdown can be canceled.
25 STATE_PRE_SHUTDOWN_ANIMATION,
26
27 // A D-Bus shutdown request has been sent. Shutdown cannot be canceled.
28 STATE_SHUTDOWN_REQUESTED,
29
30 STATE_OTHER
31 };
32
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);
37
18 // chromeos::PowerManagerClient::Observer: 38 // chromeos::PowerManagerClient::Observer:
19 virtual void BrightnessChanged(int level, bool user_initiated) OVERRIDE; 39 virtual void BrightnessChanged(int level, bool user_initiated) OVERRIDE;
20 virtual void PowerButtonEventReceived( 40 virtual void PowerButtonEventReceived(
21 bool down, 41 bool down,
22 const base::TimeTicks& timestamp) OVERRIDE; 42 const base::TimeTicks& timestamp) OVERRIDE;
23 43
24 private: 44 // ui::ImplicitAnimationObserver:
45 virtual void OnImplicitAnimationsCompleted() OVERRIDE;
46
25 // Whether the screen brightness was reduced to 0%. 47 // Whether the screen brightness was reduced to 0%.
26 bool brightness_is_zero_; 48 bool brightness_is_zero_;
27 49
28 // The last time at which the screen brightness was 0%. 50 // The last time at which the screen brightness was 0%.
29 base::TimeTicks zero_brightness_end_time_; 51 base::TimeTicks zero_brightness_end_time_;
30 52
31 // Whether shutdown was requested. 53 State state_;
32 bool shutdown_requested_;
33 54
34 DISALLOW_COPY_AND_ASSIGN(PowerButtonController); 55 DISALLOW_COPY_AND_ASSIGN(PowerButtonController);
35 }; 56 };
36 57
37 } // namespace athena 58 } // namespace athena
38 59
39 #endif // ATHENA_SYSTEM_POWER_BUTTON_CONTROLLER_H_ 60 #endif // ATHENA_SYSTEM_POWER_BUTTON_CONTROLLER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698