| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 UI_VIEWS_REPEAT_CONTROLLER_H_ | 5 #ifndef UI_VIEWS_REPEAT_CONTROLLER_H_ |
| 6 #define UI_VIEWS_REPEAT_CONTROLLER_H_ | 6 #define UI_VIEWS_REPEAT_CONTROLLER_H_ |
| 7 | 7 |
| 8 #include "base/callback.h" | 8 #include "base/callback.h" |
| 9 #include "base/macros.h" | 9 #include "base/macros.h" |
| 10 #include "base/timer/timer.h" | 10 #include "base/timer/timer.h" |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 // The RepeatController takes ownership of this callback object. | 26 // The RepeatController takes ownership of this callback object. |
| 27 explicit RepeatController(const base::Closure& callback); | 27 explicit RepeatController(const base::Closure& callback); |
| 28 virtual ~RepeatController(); | 28 virtual ~RepeatController(); |
| 29 | 29 |
| 30 // Start repeating. | 30 // Start repeating. |
| 31 void Start(); | 31 void Start(); |
| 32 | 32 |
| 33 // Stop repeating. | 33 // Stop repeating. |
| 34 void Stop(); | 34 void Stop(); |
| 35 | 35 |
| 36 const base::OneShotTimer& timer_for_testing() const { return timer_; } |
| 37 |
| 36 private: | 38 private: |
| 37 // Called when the timer expires. | 39 // Called when the timer expires. |
| 38 void Run(); | 40 void Run(); |
| 39 | 41 |
| 40 // The current timer. | 42 // The current timer. |
| 41 base::OneShotTimer timer_; | 43 base::OneShotTimer timer_; |
| 42 | 44 |
| 43 base::Closure callback_; | 45 base::Closure callback_; |
| 44 | 46 |
| 45 DISALLOW_COPY_AND_ASSIGN(RepeatController); | 47 DISALLOW_COPY_AND_ASSIGN(RepeatController); |
| 46 }; | 48 }; |
| 47 | 49 |
| 48 } // namespace views | 50 } // namespace views |
| 49 | 51 |
| 50 #endif // UI_VIEWS_REPEAT_CONTROLLER_H_ | 52 #endif // UI_VIEWS_REPEAT_CONTROLLER_H_ |
| OLD | NEW |