OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 "chrome/browser/ui/views/ash/tab_scrubber.h" | 5 #include "chrome/browser/ui/views/ash/tab_scrubber.h" |
6 | 6 |
7 #include "ash/shell.h" | 7 #include "ash/shell.h" |
8 #include "ash/wm/window_util.h" | 8 #include "ash/wm/window_util.h" |
9 #include "base/metrics/histogram.h" | 9 #include "base/metrics/histogram.h" |
10 #include "chrome/browser/chrome_notification_types.h" | 10 #include "chrome/browser/chrome_notification_types.h" |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
102 | 102 |
103 if (tab_strip->IsAnimating()) { | 103 if (tab_strip->IsAnimating()) { |
104 FinishScrub(false); | 104 FinishScrub(false); |
105 return; | 105 return; |
106 } | 106 } |
107 | 107 |
108 // We are handling the event. | 108 // We are handling the event. |
109 event->StopPropagation(); | 109 event->StopPropagation(); |
110 | 110 |
111 float x_offset = event->x_offset(); | 111 float x_offset = event->x_offset(); |
| 112 if (!ui::IsNaturalScrollEnabled()) |
| 113 x_offset = -x_offset; |
112 int last_tab_index = highlighted_tab_ == -1 ? | 114 int last_tab_index = highlighted_tab_ == -1 ? |
113 browser->tab_strip_model()->active_index() : highlighted_tab_; | 115 browser->tab_strip_model()->active_index() : highlighted_tab_; |
114 if (!scrubbing_) { | 116 if (!scrubbing_) { |
115 swipe_direction_ = (x_offset < 0) ? LEFT : RIGHT; | 117 swipe_direction_ = (x_offset < 0) ? LEFT : RIGHT; |
116 const gfx::Point start_point = | 118 const gfx::Point start_point = |
117 GetStartPoint(tab_strip, | 119 GetStartPoint(tab_strip, |
118 browser->tab_strip_model()->active_index(), | 120 browser->tab_strip_model()->active_index(), |
119 swipe_direction_); | 121 swipe_direction_); |
120 browser_ = browser; | 122 browser_ = browser; |
121 scrubbing_ = true; | 123 scrubbing_ = true; |
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
277 UMA_HISTOGRAM_CUSTOM_COUNTS("Tabs.ScrubDistance", distance, 0, 20, 20); | 279 UMA_HISTOGRAM_CUSTOM_COUNTS("Tabs.ScrubDistance", distance, 0, 20, 20); |
278 browser_->tab_strip_model()->ActivateTabAt(highlighted_tab_, true); | 280 browser_->tab_strip_model()->ActivateTabAt(highlighted_tab_, true); |
279 } | 281 } |
280 tab_strip->RemoveObserver(this); | 282 tab_strip->RemoveObserver(this); |
281 } | 283 } |
282 swipe_x_ = -1; | 284 swipe_x_ = -1; |
283 swipe_y_ = -1; | 285 swipe_y_ = -1; |
284 scrubbing_ = false; | 286 scrubbing_ = false; |
285 highlighted_tab_ = -1; | 287 highlighted_tab_ = -1; |
286 } | 288 } |
OLD | NEW |