summaryrefslogtreecommitdiffstats
path: root/chrome/browser/views/tabs/base_tab_strip.cc
diff options
context:
space:
mode:
Diffstat (limited to 'chrome/browser/views/tabs/base_tab_strip.cc')
-rw-r--r--chrome/browser/views/tabs/base_tab_strip.cc17
1 files changed, 17 insertions, 0 deletions
diff --git a/chrome/browser/views/tabs/base_tab_strip.cc b/chrome/browser/views/tabs/base_tab_strip.cc
index 316f038..4e95535 100644
--- a/chrome/browser/views/tabs/base_tab_strip.cc
+++ b/chrome/browser/views/tabs/base_tab_strip.cc
@@ -5,6 +5,7 @@
#include "chrome/browser/views/tabs/base_tab_strip.h"
#include "base/logging.h"
+#include "chrome/browser/view_ids.h"
#include "chrome/browser/views/tabs/dragged_tab_controller.h"
#include "chrome/browser/views/tabs/tab_strip_controller.h"
#include "views/widget/root_view.h"
@@ -308,6 +309,22 @@ bool BaseTabStrip::EndDrag(bool canceled) {
return started_drag;
}
+BaseTab* BaseTabStrip::GetTabAt(BaseTab* tab,
+ const gfx::Point& tab_in_tab_coordinates) {
+ gfx::Point local_point = tab_in_tab_coordinates;
+ ConvertPointToView(tab, this, &local_point);
+ views::View* view = GetViewForPoint(local_point);
+ if (!view)
+ return NULL; // No tab contains the point.
+
+ // Walk up the view hierarchy until we find a tab, or the TabStrip.
+ while (view && view != this && view->GetID() != VIEW_ID_TAB)
+ view = view->GetParent();
+
+ return view && view->GetID() == VIEW_ID_TAB ?
+ static_cast<BaseTab*>(view) : NULL;
+}
+
void BaseTabStrip::Layout() {
StopAnimating(false);