| OLD | NEW |
| (Empty) |
| 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. | |
| 4 | |
| 5 #ifndef ATHENA_SYSTEM_SHUTDOWN_DIALOG_H_ | |
| 6 #define ATHENA_SYSTEM_SHUTDOWN_DIALOG_H_ | |
| 7 | |
| 8 #include "athena/input/public/input_manager.h" | |
| 9 #include "base/memory/scoped_ptr.h" | |
| 10 #include "base/time/time.h" | |
| 11 #include "base/timer/timer.h" | |
| 12 | |
| 13 namespace aura { | |
| 14 class Window; | |
| 15 } | |
| 16 | |
| 17 namespace views { | |
| 18 class Widget; | |
| 19 } | |
| 20 | |
| 21 namespace athena { | |
| 22 | |
| 23 // Shuts down in response to the power button being pressed. | |
| 24 class ShutdownDialog : public PowerButtonObserver { | |
| 25 public: | |
| 26 explicit ShutdownDialog(); | |
| 27 ~ShutdownDialog() override; | |
| 28 | |
| 29 private: | |
| 30 enum State { | |
| 31 // Releasing the power button sends a suspend request. | |
| 32 STATE_SUSPEND_ON_RELEASE, | |
| 33 | |
| 34 // A warning that the device is about to be shutdown is visible. Releasing | |
| 35 // the power button does not send a suspend or a shutdown request. | |
| 36 STATE_SHUTDOWN_WARNING_VISIBLE, | |
| 37 | |
| 38 // A D-Bus shutdown request has been sent. Shutdown cannot be canceled. | |
| 39 STATE_SHUTDOWN_REQUESTED, | |
| 40 | |
| 41 STATE_OTHER | |
| 42 }; | |
| 43 | |
| 44 // Shows the shutdown warning dialog. | |
| 45 void ShowShutdownWarningDialog(); | |
| 46 | |
| 47 // Requests shutdown. | |
| 48 void Shutdown(); | |
| 49 | |
| 50 // PowerButtonObserver: | |
| 51 void OnPowerButtonStateChanged(PowerButtonObserver::State state) override; | |
| 52 | |
| 53 // |shutdown_warning_message_|'s parent container. | |
| 54 aura::Window* warning_message_container_; | |
| 55 | |
| 56 // Shows a warning that the device is about to be shutdown. | |
| 57 scoped_ptr<views::Widget> shutdown_warning_message_; | |
| 58 | |
| 59 State state_; | |
| 60 | |
| 61 base::OneShotTimer<ShutdownDialog> timer_; | |
| 62 | |
| 63 DISALLOW_COPY_AND_ASSIGN(ShutdownDialog); | |
| 64 }; | |
| 65 | |
| 66 } // namespace athena | |
| 67 | |
| 68 #endif // ATHENA_SYSTEM_SHUTDOWN_DIALOG_H_ | |
| OLD | NEW |