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

Unified Diff: ui/views/window/non_client_view.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 | « ui/views/window/non_client_view.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/views/window/non_client_view.cc
diff --git a/ui/views/window/non_client_view.cc b/ui/views/window/non_client_view.cc
index 43b2e70052b6b6616f68ac3fe8d989ceea775494..e337da649cc3667f0006cfb0ccdad09e7465ef4d 100644
--- a/ui/views/window/non_client_view.cc
+++ b/ui/views/window/non_client_view.cc
@@ -36,6 +36,8 @@ static const int kClientViewIndex = 1;
NonClientView::NonClientView()
: client_view_(NULL),
overlay_view_(NULL) {
+ SetEventTargeter(
+ scoped_ptr<views::ViewTargeter>(new views::ViewTargeter(this)));
}
NonClientView::~NonClientView() {
@@ -187,9 +189,28 @@ const char* NonClientView::GetClassName() const {
return kViewClassName;
}
-View* NonClientView::GetEventHandlerForRect(const gfx::Rect& rect) {
+View* NonClientView::GetTooltipHandlerForPoint(const gfx::Point& point) {
+ // The same logic as for |TargetForRect()| applies here.
+ if (frame_view_->parent() == this) {
+ // During the reset of the frame_view_ it's possible to be in this code
+ // after it's been removed from the view hierarchy but before it's been
+ // removed from the NonClientView.
+ gfx::Point point_in_child_coords(point);
+ View::ConvertPointToTarget(this, frame_view_.get(), &point_in_child_coords);
+ View* handler =
+ frame_view_->GetTooltipHandlerForPoint(point_in_child_coords);
+ if (handler)
+ return handler;
+ }
+
+ return View::GetTooltipHandlerForPoint(point);
+}
+
+View* NonClientView::TargetForRect(View* root, const gfx::Rect& rect) {
+ CHECK_EQ(root, this);
+
if (!UsePointBasedTargeting(rect))
- return View::GetEventHandlerForRect(rect);
+ return ViewTargeterDelegate::TargetForRect(root, rect);
// Because of the z-ordering of our child views (the client view is positioned
// over the non-client frame view, if the client view ever overlaps the frame
@@ -210,24 +231,7 @@ View* NonClientView::GetEventHandlerForRect(const gfx::Rect& rect) {
return frame_view_->GetEventHandlerForRect(rect_in_child_coords);
}
- return View::GetEventHandlerForRect(rect);
-}
-
-View* NonClientView::GetTooltipHandlerForPoint(const gfx::Point& point) {
- // The same logic as for |GetEventHandlerForRect()| applies here.
- if (frame_view_->parent() == this) {
- // During the reset of the frame_view_ it's possible to be in this code
- // after it's been removed from the view hierarchy but before it's been
- // removed from the NonClientView.
- gfx::Point point_in_child_coords(point);
- View::ConvertPointToTarget(this, frame_view_.get(), &point_in_child_coords);
- View* handler =
- frame_view_->GetTooltipHandlerForPoint(point_in_child_coords);
- if (handler)
- return handler;
- }
-
- return View::GetTooltipHandlerForPoint(point);
+ return ViewTargeterDelegate::TargetForRect(root, rect);
}
////////////////////////////////////////////////////////////////////////////////
« no previous file with comments | « ui/views/window/non_client_view.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698