| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 ASH_ACCELERATORS_EXIT_WARNING_HANDLER_H_ | 5 #ifndef ASH_ACCELERATORS_EXIT_WARNING_HANDLER_H_ |
| 6 #define ASH_ACCELERATORS_EXIT_WARNING_HANDLER_H_ | 6 #define ASH_ACCELERATORS_EXIT_WARNING_HANDLER_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 | 9 |
| 10 #include "ash/ash_export.h" | 10 #include "ash/ash_export.h" |
| 11 #include "base/macros.h" | 11 #include "base/macros.h" |
| 12 #include "base/timer/timer.h" | 12 #include "base/timer/timer.h" |
| 13 #include "ui/base/accelerators/accelerator.h" | 13 #include "ui/base/accelerators/accelerator.h" |
| 14 | 14 |
| 15 namespace views { | 15 namespace views { |
| 16 class Widget; | 16 class Widget; |
| 17 } | 17 } |
| 18 | 18 |
| 19 namespace ash { | 19 namespace ash { |
| 20 | 20 |
| 21 // In order to avoid accidental exits when the user presses the exit | 21 // In order to avoid accidental exits when the user presses the exit shortcut by |
| 22 // shortcut by mistake, we require the user press it twice within a | 22 // mistake, we require that the user press it twice within a short period of |
| 23 // period of time. During that time we show a popup informing the | 23 // time. During that time we show a popup informing the user of this. |
| 24 // user of this. | |
| 25 // | 24 // |
| 26 // Notes: | 25 // Notes: |
| 27 // | 26 // |
| 28 // The corresponding accelerator must be non-repeatable (see | 27 // The corresponding accelerator must not be repeatable (see kRepeatableActions |
| 29 // kNonrepeatableActions in accelerator_table.cc). Otherwise the "Double Press | 28 // in accelerator_table.cc). Otherwise, the "Double Press Exit" will be |
| 30 // Exit" will be activated just by holding it down, i.e. probably every time. | 29 // activated just by holding it down, i.e. probably every time. |
| 31 // | 30 // |
| 32 // State Transition Diagrams: | 31 // State Transition Diagrams: |
| 33 // | 32 // |
| 34 // IDLE | 33 // IDLE |
| 35 // | Press | 34 // | Press |
| 36 // WAIT_FOR_DOUBLE_PRESS action: show ui & start timers | 35 // WAIT_FOR_DOUBLE_PRESS action: show ui & start timers |
| 37 // | Press (before time limit ) | 36 // | Press (before time limit ) |
| 38 // EXITING action: hide ui, stop timer, exit | 37 // EXITING action: hide ui, stop timer, exit |
| 39 // | 38 // |
| 40 // IDLE | 39 // IDLE |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 76 // Flag to suppress starting the timer for testing. For test we call | 75 // Flag to suppress starting the timer for testing. For test we call |
| 77 // TimerAction() directly to simulate the expiration of the timer. | 76 // TimerAction() directly to simulate the expiration of the timer. |
| 78 bool stub_timer_for_test_; | 77 bool stub_timer_for_test_; |
| 79 | 78 |
| 80 DISALLOW_COPY_AND_ASSIGN(ExitWarningHandler); | 79 DISALLOW_COPY_AND_ASSIGN(ExitWarningHandler); |
| 81 }; | 80 }; |
| 82 | 81 |
| 83 } // namespace ash | 82 } // namespace ash |
| 84 | 83 |
| 85 #endif // ASH_ACCELERATORS_EXIT_WARNING_HANDLER_H_ | 84 #endif // ASH_ACCELERATORS_EXIT_WARNING_HANDLER_H_ |
| OLD | NEW |