OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 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_ACCELERATOR_KEY_HOLD_DETECTOR_H_ | 5 #ifndef ASH_ACCELERATOR_KEY_HOLD_DETECTOR_H_ |
6 #define ASH_ACCELERATOR_KEY_HOLD_DETECTOR_H_ | 6 #define ASH_ACCELERATOR_KEY_HOLD_DETECTOR_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 | 9 |
10 #include "ash/ash_export.h" | 10 #include "ash/ash_export.h" |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
52 private: | 52 private: |
53 // A state to keep track of one click and click and hold operation. | 53 // A state to keep track of one click and click and hold operation. |
54 // | 54 // |
55 // One click: | 55 // One click: |
56 // INITIAL --(first press)--> PRESSED --(release)--> INITIAL[SEND PRESS] | 56 // INITIAL --(first press)--> PRESSED --(release)--> INITIAL[SEND PRESS] |
57 // | 57 // |
58 // Click and hold: | 58 // Click and hold: |
59 // INITIAL --(first press)--> PRESSED --(press)--> | 59 // INITIAL --(first press)--> PRESSED --(press)--> |
60 // HOLD[OnKeyHold] --(press)--> HOLD[OnKeyHold] --(release)--> | 60 // HOLD[OnKeyHold] --(press)--> HOLD[OnKeyHold] --(release)--> |
61 // INITIAL[OnKeyUnhold] | 61 // INITIAL[OnKeyUnhold] |
62 enum State { | 62 enum State { INITIAL, PRESSED, HOLD }; |
63 INITIAL, | |
64 PRESSED, | |
65 HOLD | |
66 }; | |
67 | 63 |
68 State state_; | 64 State state_; |
69 std::unique_ptr<Delegate> delegate_; | 65 std::unique_ptr<Delegate> delegate_; |
70 | 66 |
71 DISALLOW_COPY_AND_ASSIGN(KeyHoldDetector); | 67 DISALLOW_COPY_AND_ASSIGN(KeyHoldDetector); |
72 }; | 68 }; |
73 | 69 |
74 } // namespace ash | 70 } // namespace ash |
75 | 71 |
76 #endif // ASH_ACCELERATOR_KEY_HOLD_DETECTOR_H_ | 72 #endif // ASH_ACCELERATOR_KEY_HOLD_DETECTOR_H_ |
OLD | NEW |