1 // Copyright 2014 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 #include "ash/wm/workspace/two_step_edge_cycler.h"
12 // We cycle to the second mode if any of the following happens while the mouse
13 // is on the edge of the workspace:
14 // . The user stops moving the mouse for |kMaxDelay| and then moves the mouse
16 // . The mouse moves |kMaxPixels| horizontal pixels.
17 // . The mouse is moved |kMaxMoves| times.
18 const int kMaxDelay
= 500;
19 const int kMaxPixels
= 100;
20 const int kMaxMoves
= 25;
24 TwoStepEdgeCycler::TwoStepEdgeCycler(const gfx::Point
& start
)
25 : second_mode_(false),
26 time_last_move_(base::TimeTicks::Now()),
31 TwoStepEdgeCycler::~TwoStepEdgeCycler() {
34 void TwoStepEdgeCycler::OnMove(const gfx::Point
& location
) {
40 (base::TimeTicks::Now() - time_last_move_
).InMilliseconds() >
42 std::abs(location
.x() - start_x_
) >= kMaxPixels
||
43 num_moves_
>= kMaxMoves
;
44 time_last_move_
= base::TimeTicks::Now();