Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(161)

Side by Side Diff: ui/views/repeat_controller.h

Issue 851853002: It is time. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Trying to reup because the last upload failed. Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « ui/views/rect_based_targeting_utils_unittest.cc ('k') | ui/views/repeat_controller.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef UI_VIEWS_REPEAT_CONTROLLER_H_
6 #define UI_VIEWS_REPEAT_CONTROLLER_H_
7
8 #include "base/callback.h"
9 #include "base/timer/timer.h"
10
11 namespace views {
12
13 ///////////////////////////////////////////////////////////////////////////////
14 //
15 // RepeatController
16 //
17 // An object that handles auto-repeating UI actions. There is a longer initial
18 // delay after which point repeats become constant. Users provide a callback
19 // that is notified when each repeat occurs so that they can perform the
20 // associated action.
21 //
22 ///////////////////////////////////////////////////////////////////////////////
23 class RepeatController {
24 public:
25 // The RepeatController takes ownership of this callback object.
26 explicit RepeatController(const base::Closure& callback);
27 virtual ~RepeatController();
28
29 // Start repeating.
30 void Start();
31
32 // Stop repeating.
33 void Stop();
34
35 private:
36 // Called when the timer expires.
37 void Run();
38
39 // The current timer.
40 base::OneShotTimer<RepeatController> timer_;
41
42 base::Closure callback_;
43
44 DISALLOW_COPY_AND_ASSIGN(RepeatController);
45 };
46
47 } // namespace views
48
49 #endif // UI_VIEWS_REPEAT_CONTROLLER_H_
OLDNEW
« no previous file with comments | « ui/views/rect_based_targeting_utils_unittest.cc ('k') | ui/views/repeat_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698