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

Side by Side Diff: chrome/browser/ui/views/ash/tab_scrubber.cc

Issue 212603005: Don't handle NaturalScroll in Chrome but pass it to CMT instead (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 9 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 | Annotate | Revision Log
OLDNEW
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
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;
114 int last_tab_index = highlighted_tab_ == -1 ? 112 int last_tab_index = highlighted_tab_ == -1 ?
115 browser->tab_strip_model()->active_index() : highlighted_tab_; 113 browser->tab_strip_model()->active_index() : highlighted_tab_;
116 if (!scrubbing_) { 114 if (!scrubbing_) {
117 swipe_direction_ = (x_offset < 0) ? LEFT : RIGHT; 115 swipe_direction_ = (x_offset < 0) ? LEFT : RIGHT;
118 const gfx::Point start_point = 116 const gfx::Point start_point =
119 GetStartPoint(tab_strip, 117 GetStartPoint(tab_strip,
120 browser->tab_strip_model()->active_index(), 118 browser->tab_strip_model()->active_index(),
121 swipe_direction_); 119 swipe_direction_);
122 browser_ = browser; 120 browser_ = browser;
123 scrubbing_ = true; 121 scrubbing_ = true;
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
279 UMA_HISTOGRAM_CUSTOM_COUNTS("Tabs.ScrubDistance", distance, 0, 20, 20); 277 UMA_HISTOGRAM_CUSTOM_COUNTS("Tabs.ScrubDistance", distance, 0, 20, 20);
280 browser_->tab_strip_model()->ActivateTabAt(highlighted_tab_, true); 278 browser_->tab_strip_model()->ActivateTabAt(highlighted_tab_, true);
281 } 279 }
282 tab_strip->RemoveObserver(this); 280 tab_strip->RemoveObserver(this);
283 } 281 }
284 swipe_x_ = -1; 282 swipe_x_ = -1;
285 swipe_y_ = -1; 283 swipe_y_ = -1;
286 scrubbing_ = false; 284 scrubbing_ = false;
287 highlighted_tab_ = -1; 285 highlighted_tab_ = -1;
288 } 286 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698