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

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

Issue 2095193002: clang-format all of //ash (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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
« no previous file with comments | « ash/wm/event_client_impl.cc ('k') | ash/wm/gestures/overview_gesture_handler_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/common/wm_shell.h" 8 #include "ash/common/wm_shell.h"
9 #include "ui/events/event.h" 9 #include "ui/events/event.h"
10 #include "ui/events/event_constants.h" 10 #include "ui/events/event_constants.h"
11 11
12 namespace ash { 12 namespace ash {
13 namespace { 13 namespace {
14 14
15 // 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
16 // touchpad. 16 // touchpad.
17 const float kSwipeThresholdPixels = 300; 17 const float kSwipeThresholdPixels = 300;
18 18
19 } // namespace 19 } // namespace
20 20
21 OverviewGestureHandler::OverviewGestureHandler() : scroll_x_(0), scroll_y_(0) {} 21 OverviewGestureHandler::OverviewGestureHandler() : scroll_x_(0), scroll_y_(0) {}
22 22
23 OverviewGestureHandler::~OverviewGestureHandler() { 23 OverviewGestureHandler::~OverviewGestureHandler() {}
24 }
25 24
26 bool OverviewGestureHandler::ProcessScrollEvent(const ui::ScrollEvent& event) { 25 bool OverviewGestureHandler::ProcessScrollEvent(const ui::ScrollEvent& event) {
27 if (event.type() == ui::ET_SCROLL_FLING_START || 26 if (event.type() == ui::ET_SCROLL_FLING_START ||
28 event.type() == ui::ET_SCROLL_FLING_CANCEL || 27 event.type() == ui::ET_SCROLL_FLING_CANCEL || event.finger_count() != 3) {
29 event.finger_count() != 3) {
30 scroll_x_ = scroll_y_ = 0; 28 scroll_x_ = scroll_y_ = 0;
31 return false; 29 return false;
32 } 30 }
33 31
34 scroll_x_ += event.x_offset(); 32 scroll_x_ += event.x_offset();
35 scroll_y_ += event.y_offset(); 33 scroll_y_ += event.y_offset();
36 34
37 // Horizontal swiping is ignored. 35 // Horizontal swiping is ignored.
38 if (std::fabs(scroll_x_) >= std::fabs(scroll_y_)) { 36 if (std::fabs(scroll_x_) >= std::fabs(scroll_y_)) {
39 scroll_x_ = scroll_y_ = 0; 37 scroll_x_ = scroll_y_ = 0;
(...skipping 17 matching lines...) Expand all
57 } 55 }
58 56
59 // Reset scroll amount on toggling. 57 // Reset scroll amount on toggling.
60 scroll_x_ = scroll_y_ = 0; 58 scroll_x_ = scroll_y_ = 0;
61 WmShell::Get()->RecordUserMetricsAction(UMA_TOUCHPAD_GESTURE_OVERVIEW); 59 WmShell::Get()->RecordUserMetricsAction(UMA_TOUCHPAD_GESTURE_OVERVIEW);
62 window_selector_controller->ToggleOverview(); 60 window_selector_controller->ToggleOverview();
63 return true; 61 return true;
64 } 62 }
65 63
66 } // namespace ash 64 } // namespace ash
OLDNEW
« no previous file with comments | « ash/wm/event_client_impl.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