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

Unified Diff: chrome/browser/ui/views/tabs/tab_strip.cc

Issue 12660016: Make long press & release to trigger context menu on tab (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: addressed sky's comments Created 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/views/tabs/tab_strip.cc
diff --git a/chrome/browser/ui/views/tabs/tab_strip.cc b/chrome/browser/ui/views/tabs/tab_strip.cc
index 7660eed2f5b61697c39d721a64f58e3bf499c1b9..d21afef22bae8906623c2768bba086edbf11fb05 100644
--- a/chrome/browser/ui/views/tabs/tab_strip.cc
+++ b/chrome/browser/ui/views/tabs/tab_strip.cc
@@ -1507,6 +1507,16 @@ void TabStrip::OnGestureEvent(ui::GestureEvent* event) {
drag_controller_->SetMoveBehavior(TabDragController::REORDER);
break;
+ case ui::ET_GESTURE_LONG_TAP: {
+ gfx::Point local_point = event->location();
sky 2013/03/20 16:42:08 One more question. If we get here, is drag_control
Yufeng Shen (Slow to review) 2013/03/20 17:18:29 I assume if you get LONG_TAP, it means you did not
+ Tab* tab = FindTabForEvent(local_point);
+ if (tab) {
+ ConvertPointToScreen(this, &local_point);
+ ShowContextMenuForTab(tab, local_point);
+ }
+ break;
+ }
+
case ui::ET_GESTURE_SCROLL_UPDATE:
ContinueDrag(this, *event);
break;
@@ -2493,17 +2503,23 @@ int TabStrip::GetStartXForNormalTabs() const {
}
Tab* TabStrip::FindTabForEvent(const gfx::Point& point) {
- DCHECK(touch_layout_.get());
- int active_tab_index = touch_layout_->active_index();
- Tab* tab = NULL;
- if (active_tab_index != -1) {
- tab = FindTabForEventFrom(point, active_tab_index, -1);
- if (!tab)
- tab = FindTabForEventFrom(point, active_tab_index + 1, 1);
- } else if (tab_count()) {
- tab = FindTabForEventFrom(point, 0, 1);
+ if (touch_layout_.get()) {
+ int active_tab_index = touch_layout_->active_index();
+ if (active_tab_index != -1) {
+ Tab* tab = FindTabForEventFrom(point, active_tab_index, -1);
+ if (!tab)
+ tab = FindTabForEventFrom(point, active_tab_index + 1, 1);
+ return tab;
+ } else if (tab_count()) {
+ return FindTabForEventFrom(point, 0, 1);
+ }
+ } else {
+ for (int i = 0; i < tab_count(); ++i) {
+ if (IsPointInTab(tab_at(i), point))
+ return tab_at(i);
+ }
}
- return tab;
+ return NULL;
}
Tab* TabStrip::FindTabForEventFrom(const gfx::Point& point,
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698