| 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 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 138 direction); | 138 direction); |
| 139 swipe_x_ = start_point.x(); | 139 swipe_x_ = start_point.x(); |
| 140 swipe_y_ = start_point.y(); | 140 swipe_y_ = start_point.y(); |
| 141 swipe_direction_ = direction; | 141 swipe_direction_ = direction; |
| 142 } | 142 } |
| 143 } | 143 } |
| 144 | 144 |
| 145 swipe_x_ += x_offset; | 145 swipe_x_ += x_offset; |
| 146 Tab* first_tab = tab_strip->tab_at(0); | 146 Tab* first_tab = tab_strip->tab_at(0); |
| 147 int first_tab_center = first_tab->bounds().CenterPoint().x(); | 147 int first_tab_center = first_tab->bounds().CenterPoint().x(); |
| 148 Tab* last_tab = tab_strip->tab_at(tab_strip->tab_count() - 1); | 148 Tab* last_tab = tab_strip->tab_at(tab_strip->GetTabCount() - 1); |
| 149 int last_tab_tab_center = last_tab->bounds().CenterPoint().x(); | 149 int last_tab_tab_center = last_tab->bounds().CenterPoint().x(); |
| 150 if (swipe_x_ < first_tab_center) | 150 if (swipe_x_ < first_tab_center) |
| 151 swipe_x_ = first_tab_center; | 151 swipe_x_ = first_tab_center; |
| 152 if (swipe_x_ > last_tab_tab_center) | 152 if (swipe_x_ > last_tab_tab_center) |
| 153 swipe_x_ = last_tab_tab_center; | 153 swipe_x_ = last_tab_tab_center; |
| 154 | 154 |
| 155 Tab* initial_tab = tab_strip->tab_at(last_tab_index); | 155 Tab* initial_tab = tab_strip->tab_at(last_tab_index); |
| 156 gfx::Point tab_point(swipe_x_, swipe_y_); | 156 gfx::Point tab_point(swipe_x_, swipe_y_); |
| 157 views::View::ConvertPointToTarget(tab_strip, initial_tab, &tab_point); | 157 views::View::ConvertPointToTarget(tab_strip, initial_tab, &tab_point); |
| 158 Tab* new_tab = tab_strip->GetTabAt(initial_tab, tab_point); | 158 Tab* new_tab = tab_strip->GetTabAt(initial_tab, tab_point); |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 277 UMA_HISTOGRAM_CUSTOM_COUNTS("Tabs.ScrubDistance", distance, 0, 20, 20); | 277 UMA_HISTOGRAM_CUSTOM_COUNTS("Tabs.ScrubDistance", distance, 0, 20, 20); |
| 278 browser_->tab_strip_model()->ActivateTabAt(highlighted_tab_, true); | 278 browser_->tab_strip_model()->ActivateTabAt(highlighted_tab_, true); |
| 279 } | 279 } |
| 280 tab_strip->RemoveObserver(this); | 280 tab_strip->RemoveObserver(this); |
| 281 } | 281 } |
| 282 swipe_x_ = -1; | 282 swipe_x_ = -1; |
| 283 swipe_y_ = -1; | 283 swipe_y_ = -1; |
| 284 scrubbing_ = false; | 284 scrubbing_ = false; |
| 285 highlighted_tab_ = -1; | 285 highlighted_tab_ = -1; |
| 286 } | 286 } |
| OLD | NEW |