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" |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
51 ExitWarningHandler(); | 51 ExitWarningHandler(); |
52 | 52 |
53 ~ExitWarningHandler(); | 53 ~ExitWarningHandler(); |
54 | 54 |
55 // Handles accelerator for exit (Ctrl-Shift-Q). | 55 // Handles accelerator for exit (Ctrl-Shift-Q). |
56 void HandleAccelerator(); | 56 void HandleAccelerator(); |
57 | 57 |
58 private: | 58 private: |
59 friend class AcceleratorControllerTest; | 59 friend class AcceleratorControllerTest; |
60 | 60 |
61 enum State { | 61 enum State { IDLE, WAIT_FOR_DOUBLE_PRESS, EXITING }; |
62 IDLE, | |
63 WAIT_FOR_DOUBLE_PRESS, | |
64 EXITING | |
65 }; | |
66 | 62 |
67 // Performs actions when the time limit is exceeded. | 63 // Performs actions when the time limit is exceeded. |
68 void TimerAction(); | 64 void TimerAction(); |
69 | 65 |
70 void StartTimer(); | 66 void StartTimer(); |
71 void CancelTimer(); | 67 void CancelTimer(); |
72 | 68 |
73 void Show(); | 69 void Show(); |
74 void Hide(); | 70 void Hide(); |
75 | 71 |
76 State state_; | 72 State state_; |
77 std::unique_ptr<views::Widget> widget_; | 73 std::unique_ptr<views::Widget> widget_; |
78 base::OneShotTimer timer_; | 74 base::OneShotTimer timer_; |
79 | 75 |
80 // Flag to suppress starting the timer for testing. For test we call | 76 // Flag to suppress starting the timer for testing. For test we call |
81 // TimerAction() directly to simulate the expiration of the timer. | 77 // TimerAction() directly to simulate the expiration of the timer. |
82 bool stub_timer_for_test_; | 78 bool stub_timer_for_test_; |
83 | 79 |
84 DISALLOW_COPY_AND_ASSIGN(ExitWarningHandler); | 80 DISALLOW_COPY_AND_ASSIGN(ExitWarningHandler); |
85 }; | 81 }; |
86 | 82 |
87 } // namespace ash | 83 } // namespace ash |
88 | 84 |
89 #endif // ASH_ACCELERATORS_EXIT_WARNING_HANDLER_H_ | 85 #endif // ASH_ACCELERATORS_EXIT_WARNING_HANDLER_H_ |
OLD | NEW |