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..567a11810279733eb016601d0d194e088ac8cca0 100644 |
--- a/chrome/browser/ui/views/tabs/tab_strip.cc |
+++ b/chrome/browser/ui/views/tabs/tab_strip.cc |
@@ -1507,6 +1507,15 @@ void TabStrip::OnGestureEvent(ui::GestureEvent* event) { |
drag_controller_->SetMoveBehavior(TabDragController::REORDER); |
break; |
+ case ui::ET_GESTURE_LONG_TAP: { |
+ gfx::Point local_point = event->location(); |
+ Tab* tab = FindTabForEvent(local_point); |
+ if (tab) { |
+ ConvertPointToScreen(this, &local_point); |
+ ShowContextMenuForTab(tab, local_point); |
+ } |
+ } |
sadrul
2013/03/20 02:15:52
Missing a break; here
Yufeng Shen (Slow to review)
2013/03/20 02:22:47
Done.
|
+ |
case ui::ET_GESTURE_SCROLL_UPDATE: |
ContinueDrag(this, *event); |
break; |
@@ -2493,15 +2502,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 = 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); |
+ } |
+ } else { |
+ for (int i = 0; i < tab_count(); ++i) { |
+ if (IsPointInTab(tab_at(i), point)) { |
+ tab = tab_at(i); |
+ break; |
+ } |
+ } |
} |
return tab; |
} |