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 #ifndef ASH_WM_WORKSPACE_TWO_STEP_EDGE_CYCLER_H_
6 #define ASH_WM_WORKSPACE_TWO_STEP_EDGE_CYCLER_H_
8 #include "ash/ash_export.h"
9 #include "base/basictypes.h"
10 #include "base/time/time.h"
11 #include "ui/gfx/geometry/point.h"
15 // TwoStepEdgeCycler is responsible for cycling between two modes when the mouse
16 // is at the edge of the workspace. The cycler does not loop so it is impossible
17 // to get back to the first mode once the second mode is reached.
18 // TwoStepEdgeCycler should be destroyed once the mouse moves off the edge of
20 class ASH_EXPORT TwoStepEdgeCycler
{
22 explicit TwoStepEdgeCycler(const gfx::Point
& start
);
25 // Update which mode should be used as a result of a mouse / touch move.
26 // |location| is the location of the event.
27 void OnMove(const gfx::Point
& location
);
29 bool use_second_mode() const { return second_mode_
; }
32 // Whether the second mode should be used.
35 // Time OnMove() was last invoked.
36 base::TimeTicks time_last_move_
;
38 // The number of moves since the cycler was constructed.
41 // Initial x-coordinate.
44 DISALLOW_COPY_AND_ASSIGN(TwoStepEdgeCycler
);
49 #endif // ASH_WM_WORKSPACE_TWO_STEP_EDGE_CYCLER_H_