Mailbox support for texture layers.
[chromium-blink-merge.git] / ash / wm / power_button_controller.h
blob3c0127b8f0ec372b628bcffe4a8897dce868c33a
1 // Copyright (c) 2012 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 ASH_WM_POWER_BUTTON_CONTROLLER_H_
6 #define ASH_WM_POWER_BUTTON_CONTROLLER_H_
8 #include "ash/ash_export.h"
9 #include "ash/wm/session_state_animator.h"
10 #include "base/basictypes.h"
12 namespace gfx {
13 class Rect;
14 class Size;
17 namespace ui {
18 class Layer;
21 namespace ash {
23 namespace test {
24 class PowerButtonControllerTest;
27 class SessionStateController;
29 // Displays onscreen animations and locks or suspends the system in response to
30 // the power button being pressed or released.
31 class ASH_EXPORT PowerButtonController {
32 public:
34 explicit PowerButtonController(SessionStateController* controller);
35 virtual ~PowerButtonController();
37 void set_has_legacy_power_button_for_test(bool legacy) {
38 has_legacy_power_button_ = legacy;
41 // Called when the current screen brightness changes.
42 void OnScreenBrightnessChanged(double percent);
44 // Called when the power or lock buttons are pressed or released.
45 void OnPowerButtonEvent(bool down, const base::TimeTicks& timestamp);
46 void OnLockButtonEvent(bool down, const base::TimeTicks& timestamp);
48 private:
49 friend class test::PowerButtonControllerTest;
51 // Are the power or lock buttons currently held?
52 bool power_button_down_;
53 bool lock_button_down_;
55 // Is the screen currently turned off?
56 bool screen_is_off_;
58 // Was a command-line switch set telling us that we're running on hardware
59 // that misreports power button releases?
60 bool has_legacy_power_button_;
62 SessionStateController* controller_; // Not owned.
64 DISALLOW_COPY_AND_ASSIGN(PowerButtonController);
67 } // namespace ash
69 #endif // ASH_WM_POWER_BUTTON_CONTROLLER_H_