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, |