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

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 "athena/screen/public/screen_animator.h"
9 #include "base/memory/scoped_ptr.h"
10 #include "base/time/time.h"
8 #include "chromeos/dbus/power_manager_client.h" 11 #include "chromeos/dbus/power_manager_client.h"
12 #include "ui/compositor/layer_animation_observer.h"
9 13
10 namespace athena { 14 namespace athena {
15 class ScreenAnimator;
11 16
12 // Shuts down in response to the power button being pressed. 17 // Shuts down in response to the power button being pressed.
13 class PowerButtonController : public chromeos::PowerManagerClient::Observer { 18 class PowerButtonController : public chromeos::PowerManagerClient::Observer,
19 public ui::ImplicitAnimationObserver {
14 public: 20 public:
15 PowerButtonController(); 21 PowerButtonController();
16 virtual ~PowerButtonController(); 22 virtual ~PowerButtonController();
17 23
24 private:
25 enum State {
26 // The screen is animating prior to shutdown. Shutdown can be canceled.
27 STATE_PRE_SHUTDOWN_ANIMATION,
28
29 // A D-Bus shutdown request has been sent. Shutdown cannot be canceled.
30 STATE_SHUTDOWN_REQUESTED,
31
32 STATE_OTHER
33 };
34
18 // chromeos::PowerManagerClient::Observer: 35 // chromeos::PowerManagerClient::Observer:
19 virtual void BrightnessChanged(int level, bool user_initiated) OVERRIDE; 36 virtual void BrightnessChanged(int level, bool user_initiated) OVERRIDE;
20 virtual void PowerButtonEventReceived( 37 virtual void PowerButtonEventReceived(
21 bool down, 38 bool down,
22 const base::TimeTicks& timestamp) OVERRIDE; 39 const base::TimeTicks& timestamp) OVERRIDE;
23 40
24 private: 41 // ui::ImplicitAnimationObserver:
42 virtual void OnImplicitAnimationsCompleted() OVERRIDE;
43
44 scoped_ptr<ScreenAnimator> animator_;
45
25 // Whether the screen brightness was reduced to 0%. 46 // Whether the screen brightness was reduced to 0%.
26 bool brightness_is_zero_; 47 bool brightness_is_zero_;
27 48
28 // The last time at which the screen brightness was 0%. 49 // The last time at which the screen brightness was 0%.
29 base::TimeTicks zero_brightness_end_time_; 50 base::TimeTicks zero_brightness_end_time_;
30 51
31 // Whether shutdown was requested. 52 State state_;
32 bool shutdown_requested_;
33 53
34 DISALLOW_COPY_AND_ASSIGN(PowerButtonController); 54 DISALLOW_COPY_AND_ASSIGN(PowerButtonController);
35 }; 55 };
36 56
37 } // namespace athena 57 } // namespace athena
38 58
39 #endif // ATHENA_SYSTEM_POWER_BUTTON_CONTROLLER_H_ 59 #endif // ATHENA_SYSTEM_POWER_BUTTON_CONTROLLER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698