Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(431)

Side by Side Diff: ash/wm/gestures/overview_gesture_handler.cc

Issue 2084503007: Moves WindowSelectorController onto WmShell (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@move_overview
Patch Set: fix mash Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/metrics/user_metrics_recorder.h" 8 #include "ash/common/wm_shell.h"
9 #include "ash/shell.h"
10 #include "ui/events/event.h" 9 #include "ui/events/event.h"
11 #include "ui/events/event_constants.h" 10 #include "ui/events/event_constants.h"
12 11
13 namespace ash { 12 namespace ash {
14 namespace { 13 namespace {
15 14
16 // The threshold before engaging overview on a three finger swipe on the 15 // The threshold before engaging overview on a three finger swipe on the
17 // touchpad. 16 // touchpad.
18 const float kSwipeThresholdPixels = 300; 17 const float kSwipeThresholdPixels = 300;
19 18
(...skipping 16 matching lines...) Expand all
36 scroll_y_ += event.y_offset(); 35 scroll_y_ += event.y_offset();
37 36
38 // Horizontal swiping is ignored. 37 // Horizontal swiping is ignored.
39 if (std::fabs(scroll_x_) >= std::fabs(scroll_y_)) { 38 if (std::fabs(scroll_x_) >= std::fabs(scroll_y_)) {
40 scroll_x_ = scroll_y_ = 0; 39 scroll_x_ = scroll_y_ = 0;
41 return false; 40 return false;
42 } 41 }
43 42
44 // Only allow swipe up to enter overview, down to exit. Ignore extra swiping 43 // Only allow swipe up to enter overview, down to exit. Ignore extra swiping
45 // in the wrong direction. 44 // in the wrong direction.
46 Shell* shell = Shell::GetInstance(); 45 WindowSelectorController* window_selector_controller =
47 if (shell->window_selector_controller()->IsSelecting()) { 46 WmShell::Get()->window_selector_controller();
47 if (window_selector_controller->IsSelecting()) {
48 if (scroll_y_ < 0) 48 if (scroll_y_ < 0)
49 scroll_x_ = scroll_y_ = 0; 49 scroll_x_ = scroll_y_ = 0;
50 if (scroll_y_ < kSwipeThresholdPixels) 50 if (scroll_y_ < kSwipeThresholdPixels)
51 return false; 51 return false;
52 } else { 52 } else {
53 if (scroll_y_ > 0) 53 if (scroll_y_ > 0)
54 scroll_x_ = scroll_y_ = 0; 54 scroll_x_ = scroll_y_ = 0;
55 if (scroll_y_ > -kSwipeThresholdPixels) 55 if (scroll_y_ > -kSwipeThresholdPixels)
56 return false; 56 return false;
57 } 57 }
58 58
59 // Reset scroll amount on toggling. 59 // Reset scroll amount on toggling.
60 scroll_x_ = scroll_y_ = 0; 60 scroll_x_ = scroll_y_ = 0;
61 shell->metrics()->RecordUserMetricsAction(UMA_TOUCHPAD_GESTURE_OVERVIEW); 61 WmShell::Get()->RecordUserMetricsAction(UMA_TOUCHPAD_GESTURE_OVERVIEW);
62 shell->window_selector_controller()->ToggleOverview(); 62 window_selector_controller->ToggleOverview();
63 return true; 63 return true;
64 } 64 }
65 65
66 } // namespace ash 66 } // namespace ash
OLDNEW
« no previous file with comments | « ash/system/overview/overview_button_tray_unittest.cc ('k') | ash/wm/gestures/overview_gesture_handler_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698