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

Unified Diff: ash/frame/custom_frame_view_ash.cc

Issue 380813003: Remove remaining overrides of View::HitTestRect() (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: DoesIntersectRect() overrides made private 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
Index: ash/frame/custom_frame_view_ash.cc
diff --git a/ash/frame/custom_frame_view_ash.cc b/ash/frame/custom_frame_view_ash.cc
index 3aa503cc186fd755f32e30f55aba11070c469e77..60e1a02becfbde2eccda5a8e65202c9f5659a59d 100644
--- a/ash/frame/custom_frame_view_ash.cc
+++ b/ash/frame/custom_frame_view_ash.cc
@@ -31,6 +31,7 @@
#include "ui/gfx/size.h"
#include "ui/views/controls/image_view.h"
#include "ui/views/view.h"
+#include "ui/views/view_targeter.h"
#include "ui/views/widget/widget.h"
#include "ui/views/widget/widget_delegate.h"
@@ -349,16 +350,20 @@ CustomFrameViewAsh::HeaderView::GetVisibleBoundsInScreen() const {
// View which takes up the entire widget and contains the HeaderView. HeaderView
// is a child of OverlayView to avoid creating a larger texture than necessary
// when painting the HeaderView to its own layer.
-class CustomFrameViewAsh::OverlayView : public views::View {
+class CustomFrameViewAsh::OverlayView : public views::View,
+ public views::ViewTargeterDelegate {
public:
explicit OverlayView(HeaderView* header_view);
virtual ~OverlayView();
- // views::View override:
+ // views::View:
virtual void Layout() OVERRIDE;
- virtual bool HitTestRect(const gfx::Rect& rect) const OVERRIDE;
private:
+ // views::ViewTargeterDelegate:
+ virtual bool DoesIntersectRect(const views::View* target,
+ const gfx::Rect& rect) const OVERRIDE;
+
HeaderView* header_view_;
DISALLOW_COPY_AND_ASSIGN(OverlayView);
@@ -367,6 +372,8 @@ class CustomFrameViewAsh::OverlayView : public views::View {
CustomFrameViewAsh::OverlayView::OverlayView(HeaderView* header_view)
: header_view_(header_view) {
AddChildView(header_view);
+ SetEventTargeter(
+ scoped_ptr<views::ViewTargeter>(new views::ViewTargeter(this)));
}
CustomFrameViewAsh::OverlayView::~OverlayView() {
@@ -390,7 +397,13 @@ void CustomFrameViewAsh::OverlayView::Layout() {
}
}
-bool CustomFrameViewAsh::OverlayView::HitTestRect(const gfx::Rect& rect) const {
+///////////////////////////////////////////////////////////////////////////////
+// CustomFrameViewAsh::OverlayView, views::ViewTargeterDelegate overrides:
+
+bool CustomFrameViewAsh::OverlayView::DoesIntersectRect(
+ const views::View* target,
+ const gfx::Rect& rect) const {
+ CHECK_EQ(target, this);
// Grab events in the header view. Return false for other events so that they
// can be handled by the client view.
return header_view_->HitTestRect(rect);
@@ -513,18 +526,15 @@ void CustomFrameViewAsh::SchedulePaintInRect(const gfx::Rect& r) {
}
}
-bool CustomFrameViewAsh::HitTestRect(const gfx::Rect& rect) const {
- // NonClientView hit tests the NonClientFrameView first instead of going in
- // z-order. Return false so that events get to the OverlayView.
- return false;
-}
-
void CustomFrameViewAsh::VisibilityChanged(views::View* starting_from,
bool is_visible) {
if (is_visible)
header_view_->UpdateAvatarIcon();
}
+////////////////////////////////////////////////////////////////////////////////
+// CustomFrameViewAsh, views::ViewTargeterDelegate overrides:
+
views::View* CustomFrameViewAsh::GetHeaderView() {
return header_view_;
}
@@ -536,6 +546,15 @@ const views::View* CustomFrameViewAsh::GetAvatarIconViewForTest() const {
////////////////////////////////////////////////////////////////////////////////
// CustomFrameViewAsh, private:
+// views::NonClientFrameView:
+bool CustomFrameViewAsh::DoesIntersectRect(const views::View* target,
+ const gfx::Rect& rect) const {
+ CHECK_EQ(target, this);
+ // NonClientView hit tests the NonClientFrameView first instead of going in
+ // z-order. Return false so that events get to the OverlayView.
+ return false;
+}
+
FrameCaptionButtonContainerView* CustomFrameViewAsh::
GetFrameCaptionButtonContainerViewForTest() {
return header_view_->caption_button_container();
« no previous file with comments | « ash/frame/custom_frame_view_ash.h ('k') | chrome/browser/ui/views/frame/browser_non_client_frame_view_ash.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698