This source file includes following definitions.
- Start
- Stop
- Run
#include "ui/views/repeat_controller.h"
using base::TimeDelta;
namespace views {
const int kInitialRepeatDelay = 250;
const int kRepeatDelay = 50;
RepeatController::RepeatController(const base::Closure& callback)
: callback_(callback) {
}
RepeatController::~RepeatController() {
}
void RepeatController::Start() {
timer_.Start(FROM_HERE, TimeDelta::FromMilliseconds(kInitialRepeatDelay),
this, &RepeatController::Run);
}
void RepeatController::Stop() {
timer_.Stop();
}
void RepeatController::Run() {
timer_.Start(FROM_HERE, TimeDelta::FromMilliseconds(kRepeatDelay), this,
&RepeatController::Run);
callback_.Run();
}
}