Pin Chrome's shortcut to the Win10 Start menu on install and OS upgrade.
[chromium-blink-merge.git] / ui / views / repeat_controller.h
blob3a93ea5c0ec943b90bc210b11742e35774b7684e
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.
5 #ifndef UI_VIEWS_REPEAT_CONTROLLER_H_
6 #define UI_VIEWS_REPEAT_CONTROLLER_H_
8 #include "base/callback.h"
9 #include "base/timer/timer.h"
11 namespace views {
13 ///////////////////////////////////////////////////////////////////////////////
15 // RepeatController
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.
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();
29 // Start repeating.
30 void Start();
32 // Stop repeating.
33 void Stop();
35 private:
36 // Called when the timer expires.
37 void Run();
39 // The current timer.
40 base::OneShotTimer<RepeatController> timer_;
42 base::Closure callback_;
44 DISALLOW_COPY_AND_ASSIGN(RepeatController);
47 } // namespace views
49 #endif // UI_VIEWS_REPEAT_CONTROLLER_H_