summaryrefslogtreecommitdiffstats
path: root/chrome/browser/ui/views/tabs/base_tab.cc
diff options
context:
space:
mode:
Diffstat (limited to 'chrome/browser/ui/views/tabs/base_tab.cc')
-rw-r--r--chrome/browser/ui/views/tabs/base_tab.cc21
1 files changed, 21 insertions, 0 deletions
diff --git a/chrome/browser/ui/views/tabs/base_tab.cc b/chrome/browser/ui/views/tabs/base_tab.cc
index 356019b..11c3def 100644
--- a/chrome/browser/ui/views/tabs/base_tab.cc
+++ b/chrome/browser/ui/views/tabs/base_tab.cc
@@ -31,6 +31,10 @@
#include "ui/gfx/font.h"
#include "ui/views/controls/button/image_button.h"
+#if defined(USE_ASH)
+#include "ui/aura/env.h"
+#endif
+
// How long the pulse throb takes.
static const int kPulseDurationMs = 200;
@@ -47,6 +51,23 @@ class BaseTab::TabCloseButton : public views::ImageButton {
explicit TabCloseButton(BaseTab* tab) : views::ImageButton(tab), tab_(tab) {}
virtual ~TabCloseButton() {}
+ // Overridden from views::View.
+ virtual View* GetEventHandlerForPoint(const gfx::Point& point) OVERRIDE {
+ // Ignore the padding set on the button.
+ gfx::Rect rect = GetContentsBounds();
+
+#if defined(USE_ASH)
+ // Include the padding in hit-test for touch events.
+ if (aura::Env::GetInstance()->is_touch_down())
+ rect = GetLocalBounds();
+#elif defined(OS_WIN)
+ // TODO(sky): Use local-bounds if a touch-point is active.
+ // http://crbug.com/145258
+#endif
+
+ return rect.Contains(point) ? this : NULL;
+ }
+
virtual bool OnMousePressed(const ui::MouseEvent& event) OVERRIDE {
if (tab_->controller())
tab_->controller()->OnMouseEventInTab(this, event);