| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "ash/wm/workspace/two_step_edge_cycler.h" | 5 #include "ash/wm/workspace/two_step_edge_cycler.h" |
| 6 | 6 |
| 7 #include <cmath> | 7 #include <cmath> |
| 8 | 8 |
| 9 namespace ash { | 9 namespace ash { |
| 10 namespace internal { | |
| 11 | |
| 12 namespace { | 10 namespace { |
| 13 | 11 |
| 14 // We cycle to the second mode if any of the following happens while the mouse | 12 // We cycle to the second mode if any of the following happens while the mouse |
| 15 // is on the edge of the workspace: | 13 // is on the edge of the workspace: |
| 16 // . The user stops moving the mouse for |kMaxDelay| and then moves the mouse | 14 // . The user stops moving the mouse for |kMaxDelay| and then moves the mouse |
| 17 // again. | 15 // again. |
| 18 // . The mouse moves |kMaxPixels| horizontal pixels. | 16 // . The mouse moves |kMaxPixels| horizontal pixels. |
| 19 // . The mouse is moved |kMaxMoves| times. | 17 // . The mouse is moved |kMaxMoves| times. |
| 20 const int kMaxDelay = 500; | 18 const int kMaxDelay = 500; |
| 21 const int kMaxPixels = 100; | 19 const int kMaxPixels = 100; |
| (...skipping 17 matching lines...) Expand all Loading... |
| 39 | 37 |
| 40 ++num_moves_; | 38 ++num_moves_; |
| 41 second_mode_ = | 39 second_mode_ = |
| 42 (base::TimeTicks::Now() - time_last_move_).InMilliseconds() > | 40 (base::TimeTicks::Now() - time_last_move_).InMilliseconds() > |
| 43 kMaxDelay || | 41 kMaxDelay || |
| 44 std::abs(location.x() - start_x_) >= kMaxPixels || | 42 std::abs(location.x() - start_x_) >= kMaxPixels || |
| 45 num_moves_ >= kMaxMoves; | 43 num_moves_ >= kMaxMoves; |
| 46 time_last_move_ = base::TimeTicks::Now(); | 44 time_last_move_ = base::TimeTicks::Now(); |
| 47 } | 45 } |
| 48 | 46 |
| 49 } // namespace internal | |
| 50 } // namespace ash | 47 } // namespace ash |
| OLD | NEW |