This source file includes following definitions.
- start_x_
- OnMove
#include "ash/wm/workspace/two_step_edge_cycler.h"
#include <cmath>
namespace ash {
namespace {
const int kMaxDelay = 500;
const int kMaxPixels = 100;
const int kMaxMoves = 25;
}
TwoStepEdgeCycler::TwoStepEdgeCycler(const gfx::Point& start)
: second_mode_(false),
time_last_move_(base::TimeTicks::Now()),
num_moves_(0),
start_x_(start.x()) {
}
TwoStepEdgeCycler::~TwoStepEdgeCycler() {
}
void TwoStepEdgeCycler::OnMove(const gfx::Point& location) {
if (second_mode_)
return;
++num_moves_;
second_mode_ =
(base::TimeTicks::Now() - time_last_move_).InMilliseconds() >
kMaxDelay ||
std::abs(location.x() - start_x_) >= kMaxPixels ||
num_moves_ >= kMaxMoves;
time_last_move_ = base::TimeTicks::Now();
}
}