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

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

Issue 613373004: Adopt ui::GestureConfiguration on Android (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Move all the methods to superclass Created 6 years, 2 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 (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"
11 #include "chrome/browser/ui/browser.h" 11 #include "chrome/browser/ui/browser.h"
12 #include "chrome/browser/ui/browser_finder.h" 12 #include "chrome/browser/ui/browser_finder.h"
13 #include "chrome/browser/ui/tabs/tab_strip_model.h" 13 #include "chrome/browser/ui/tabs/tab_strip_model.h"
14 #include "chrome/browser/ui/views/frame/browser_view.h" 14 #include "chrome/browser/ui/views/frame/browser_view.h"
15 #include "chrome/browser/ui/views/tabs/tab.h" 15 #include "chrome/browser/ui/views/tabs/tab.h"
16 #include "chrome/browser/ui/views/tabs/tab_strip.h" 16 #include "chrome/browser/ui/views/tabs/tab_strip.h"
17 #include "chrome/common/pref_names.h" 17 #include "chrome/common/pref_names.h"
18 #include "content/public/browser/notification_service.h" 18 #include "content/public/browser/notification_service.h"
19 #include "content/public/browser/notification_source.h" 19 #include "content/public/browser/notification_source.h"
20 #include "ui/aura/window.h" 20 #include "ui/aura/window.h"
21 #include "ui/events/event.h" 21 #include "ui/events/event.h"
22 #include "ui/events/event_utils.h" 22 #include "ui/events/event_utils.h"
23 #include "ui/events/gestures/gesture_configuration.h" 23 #include "ui/events/gesture_detection/gesture_configuration.h"
24 #include "ui/views/controls/glow_hover_controller.h" 24 #include "ui/views/controls/glow_hover_controller.h"
25 25
26 namespace { 26 namespace {
27 const int64 kActivationDelayMS = 200; 27 const int64 kActivationDelayMS = 200;
28 } 28 }
29 29
30 // static 30 // static
31 TabScrubber* TabScrubber::GetInstance() { 31 TabScrubber* TabScrubber::GetInstance() {
32 static TabScrubber* instance = NULL; 32 static TabScrubber* instance = NULL;
33 if (!instance) 33 if (!instance)
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 161
162 int new_index = tab_strip->GetModelIndexOfTab(new_tab); 162 int new_index = tab_strip->GetModelIndexOfTab(new_tab);
163 if (highlighted_tab_ == -1 && 163 if (highlighted_tab_ == -1 &&
164 new_index == browser->tab_strip_model()->active_index()) 164 new_index == browser->tab_strip_model()->active_index())
165 return; 165 return;
166 166
167 if (new_index != highlighted_tab_) { 167 if (new_index != highlighted_tab_) {
168 if (activate_timer_.IsRunning()) { 168 if (activate_timer_.IsRunning()) {
169 activate_timer_.Reset(); 169 activate_timer_.Reset();
170 } else { 170 } else {
171 int delay = use_default_activation_delay_ ? 171 int delay = use_default_activation_delay_
172 ui::GestureConfiguration::tab_scrub_activation_delay_in_ms() : 172 ? ui::GestureConfiguration::GetInstance()
173 activation_delay_; 173 ->tab_scrub_activation_delay_in_ms()
174 : activation_delay_;
174 if (delay >= 0) { 175 if (delay >= 0) {
175 activate_timer_.Start(FROM_HERE, 176 activate_timer_.Start(FROM_HERE,
176 base::TimeDelta::FromMilliseconds(delay), 177 base::TimeDelta::FromMilliseconds(delay),
177 base::Bind(&TabScrubber::FinishScrub, 178 base::Bind(&TabScrubber::FinishScrub,
178 weak_ptr_factory_.GetWeakPtr(), 179 weak_ptr_factory_.GetWeakPtr(),
179 true)); 180 true));
180 } 181 }
181 } 182 }
182 if (highlighted_tab_ != -1) { 183 if (highlighted_tab_ != -1) {
183 Tab* tab = tab_strip->tab_at(highlighted_tab_); 184 Tab* tab = tab_strip->tab_at(highlighted_tab_);
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
277 UMA_HISTOGRAM_CUSTOM_COUNTS("Tabs.ScrubDistance", distance, 0, 20, 21); 278 UMA_HISTOGRAM_CUSTOM_COUNTS("Tabs.ScrubDistance", distance, 0, 20, 21);
278 browser_->tab_strip_model()->ActivateTabAt(highlighted_tab_, true); 279 browser_->tab_strip_model()->ActivateTabAt(highlighted_tab_, true);
279 } 280 }
280 tab_strip->RemoveObserver(this); 281 tab_strip->RemoveObserver(this);
281 } 282 }
282 swipe_x_ = -1; 283 swipe_x_ = -1;
283 swipe_y_ = -1; 284 swipe_y_ = -1;
284 scrubbing_ = false; 285 scrubbing_ = false;
285 highlighted_tab_ = -1; 286 highlighted_tab_ = -1;
286 } 287 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698