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

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

Issue 403963002: Remove remaining overrides of View::GetEventHandlerForRect() (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 5 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 | « chrome/browser/ui/views/tabs/tab_strip.h ('k') | ui/message_center/views/notification_view.h » ('j') | 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 42835490b6401cedfaf0876b52a6c1977048510f..c25080761d57a07734094cd71270c39451ef618f 100644
--- a/chrome/browser/ui/views/tabs/tab_strip.cc
+++ b/chrome/browser/ui/views/tabs/tab_strip.cc
@@ -52,6 +52,7 @@
#include "ui/views/mouse_watcher_view_host.h"
#include "ui/views/rect_based_targeting_utils.h"
#include "ui/views/view_model_utils.h"
+#include "ui/views/view_targeter.h"
#include "ui/views/widget/root_view.h"
#include "ui/views/widget/widget.h"
#include "ui/views/window/non_client_view.h"
@@ -537,6 +538,8 @@ TabStrip::TabStrip(TabStripController* controller)
mouse_move_count_(0),
immersive_style_(false) {
Init();
+ SetEventTargeter(
+ scoped_ptr<views::ViewTargeter>(new views::ViewTargeter(this)));
}
TabStrip::~TabStrip() {
@@ -1412,35 +1415,6 @@ void TabStrip::GetAccessibleState(ui::AXViewState* state) {
state->role = ui::AX_ROLE_TAB_LIST;
}
-views::View* TabStrip::GetEventHandlerForRect(const gfx::Rect& rect) {
- if (!views::UsePointBasedTargeting(rect))
- return View::GetEventHandlerForRect(rect);
- const gfx::Point point(rect.CenterPoint());
-
- if (!touch_layout_) {
- // Return any view that isn't a Tab or this TabStrip immediately. We don't
- // want to interfere.
- views::View* v = View::GetEventHandlerForRect(rect);
- if (v && v != this && strcmp(v->GetClassName(), Tab::kViewClassName))
- return v;
-
- views::View* tab = FindTabHitByPoint(point);
- if (tab)
- return tab;
- } else {
- if (newtab_button_->visible()) {
- views::View* view =
- ConvertPointToViewAndGetEventHandler(this, newtab_button_, point);
- if (view)
- return view;
- }
- Tab* tab = FindTabForEvent(point);
- if (tab)
- return ConvertPointToViewAndGetEventHandler(this, tab, point);
- }
- return this;
-}
-
views::View* TabStrip::GetTooltipHandlerForPoint(const gfx::Point& point) {
if (!HitTestPoint(point))
return NULL;
@@ -2720,3 +2694,34 @@ void TabStrip::OnGestureEvent(ui::GestureEvent* event) {
}
event->SetHandled();
}
+
+views::View* TabStrip::TargetForRect(views::View* root, const gfx::Rect& rect) {
+ CHECK_EQ(root, this);
+
+ if (!views::UsePointBasedTargeting(rect))
+ return views::ViewTargeterDelegate::TargetForRect(root, rect);
+ const gfx::Point point(rect.CenterPoint());
+
+ if (!touch_layout_) {
+ // Return any view that isn't a Tab or this TabStrip immediately. We don't
+ // want to interfere.
+ views::View* v = views::ViewTargeterDelegate::TargetForRect(root, rect);
+ if (v && v != this && strcmp(v->GetClassName(), Tab::kViewClassName))
+ return v;
+
+ views::View* tab = FindTabHitByPoint(point);
+ if (tab)
+ return tab;
+ } else {
+ if (newtab_button_->visible()) {
+ views::View* view =
+ ConvertPointToViewAndGetEventHandler(this, newtab_button_, point);
+ if (view)
+ return view;
+ }
+ Tab* tab = FindTabForEvent(point);
+ if (tab)
+ return ConvertPointToViewAndGetEventHandler(this, tab, point);
+ }
+ return this;
+}
« no previous file with comments | « chrome/browser/ui/views/tabs/tab_strip.h ('k') | ui/message_center/views/notification_view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698