Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/gestures/overview_gesture_handler.h" | 5 #include "ash/wm/gestures/overview_gesture_handler.h" |
| 6 | 6 |
| 7 #include "ash/common/wm/overview/window_selector_controller.h" | 7 #include "ash/common/wm/overview/window_selector_controller.h" |
| 8 #include "ash/common/wm_shell.h" | |
| 8 #include "ash/metrics/user_metrics_recorder.h" | 9 #include "ash/metrics/user_metrics_recorder.h" |
| 9 #include "ash/shell.h" | 10 #include "ash/shell.h" |
| 10 #include "ui/events/event.h" | 11 #include "ui/events/event.h" |
| 11 #include "ui/events/event_constants.h" | 12 #include "ui/events/event_constants.h" |
| 12 | 13 |
| 13 namespace ash { | 14 namespace ash { |
| 14 namespace { | 15 namespace { |
| 15 | 16 |
| 16 // The threshold before engaging overview on a three finger swipe on the | 17 // The threshold before engaging overview on a three finger swipe on the |
| 17 // touchpad. | 18 // touchpad. |
| (...skipping 18 matching lines...) Expand all Loading... | |
| 36 scroll_y_ += event.y_offset(); | 37 scroll_y_ += event.y_offset(); |
| 37 | 38 |
| 38 // Horizontal swiping is ignored. | 39 // Horizontal swiping is ignored. |
| 39 if (std::fabs(scroll_x_) >= std::fabs(scroll_y_)) { | 40 if (std::fabs(scroll_x_) >= std::fabs(scroll_y_)) { |
| 40 scroll_x_ = scroll_y_ = 0; | 41 scroll_x_ = scroll_y_ = 0; |
| 41 return false; | 42 return false; |
| 42 } | 43 } |
| 43 | 44 |
| 44 // Only allow swipe up to enter overview, down to exit. Ignore extra swiping | 45 // Only allow swipe up to enter overview, down to exit. Ignore extra swiping |
| 45 // in the wrong direction. | 46 // in the wrong direction. |
| 46 Shell* shell = Shell::GetInstance(); | 47 WindowSelectorController* window_selector_controller = |
| 47 if (shell->window_selector_controller()->IsSelecting()) { | 48 WmShell::Get()->window_selector_controller(); |
| 49 if (window_selector_controller->IsSelecting()) { | |
| 48 if (scroll_y_ < 0) | 50 if (scroll_y_ < 0) |
| 49 scroll_x_ = scroll_y_ = 0; | 51 scroll_x_ = scroll_y_ = 0; |
| 50 if (scroll_y_ < kSwipeThresholdPixels) | 52 if (scroll_y_ < kSwipeThresholdPixels) |
| 51 return false; | 53 return false; |
| 52 } else { | 54 } else { |
| 53 if (scroll_y_ > 0) | 55 if (scroll_y_ > 0) |
| 54 scroll_x_ = scroll_y_ = 0; | 56 scroll_x_ = scroll_y_ = 0; |
| 55 if (scroll_y_ > -kSwipeThresholdPixels) | 57 if (scroll_y_ > -kSwipeThresholdPixels) |
| 56 return false; | 58 return false; |
| 57 } | 59 } |
| 58 | 60 |
| 59 // Reset scroll amount on toggling. | 61 // Reset scroll amount on toggling. |
| 60 scroll_x_ = scroll_y_ = 0; | 62 scroll_x_ = scroll_y_ = 0; |
| 61 shell->metrics()->RecordUserMetricsAction(UMA_TOUCHPAD_GESTURE_OVERVIEW); | 63 Shell::GetInstance()->metrics()->RecordUserMetricsAction( |
|
James Cook
2016/06/22 22:46:19
nit: This could become WmShell::Get()->RecordUserM
sky
2016/06/22 23:19:39
Done.
| |
| 62 shell->window_selector_controller()->ToggleOverview(); | 64 UMA_TOUCHPAD_GESTURE_OVERVIEW); |
| 65 window_selector_controller->ToggleOverview(); | |
| 63 return true; | 66 return true; |
| 64 } | 67 } |
| 65 | 68 |
| 66 } // namespace ash | 69 } // namespace ash |
| OLD | NEW |