Disable some more flaky AppWindowInterceptAllKeysTest.* on Windows
[chromium-blink-merge.git] / athena / input / power_button_controller.h
blob8a693581f6b23d9236f1e1eb37a39f08cbbdc3d7
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_INPUT_POWER_BUTTON_CONTROLLER_H_
6 #define ATHENA_INPUT_POWER_BUTTON_CONTROLLER_H_
8 #include "athena/input/public/accelerator_manager.h"
9 #include "athena/input/public/input_manager.h"
10 #include "base/observer_list.h"
11 #include "base/timer/timer.h"
12 #include "chromeos/dbus/power_manager_client.h"
14 namespace athena {
16 class PowerButtonController : public chromeos::PowerManagerClient::Observer,
17 public AcceleratorHandler {
18 public:
19 PowerButtonController();
20 ~PowerButtonController() override;
22 void AddPowerButtonObserver(PowerButtonObserver* observer);
23 void RemovePowerButtonObserver(PowerButtonObserver* observer);
25 void InstallAccelerators();
27 // A timer callabck to notify the long press event.
28 int SetPowerButtonTimeoutMsForTest(int timeout);
30 private:
31 // chromeos::PowerManagerClient::Observer:
32 virtual void BrightnessChanged(int level, bool user_initiated) override;
33 virtual void PowerButtonEventReceived(
34 bool down,
35 const base::TimeTicks& timestamp) override;
37 // AcceleratorHandler:
38 virtual bool IsCommandEnabled(int command_id) const override;
39 virtual bool OnAcceleratorFired(int command_id,
40 const ui::Accelerator& accelerator) override;
42 void NotifyLongPress();
44 int power_button_timeout_ms_;
45 ObserverList<PowerButtonObserver> observers_;
46 // The last time at which the screen brightness was 0%.
47 base::TimeTicks zero_brightness_end_time_;
48 bool brightness_is_zero_;
49 base::OneShotTimer<PowerButtonController> timer_;
51 DISALLOW_COPY_AND_ASSIGN(PowerButtonController);
54 } // namespace athena
56 #endif // ATHENA_INPUT_POWER_BUTTON_CONTROLLER_H_