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

Unified Diff: chrome/browser/ui/views/toolbar/toolbar_view.cc

Issue 380813003: Remove remaining overrides of View::HitTestRect() (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase against ToT 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: chrome/browser/ui/views/toolbar/toolbar_view.cc
diff --git a/chrome/browser/ui/views/toolbar/toolbar_view.cc b/chrome/browser/ui/views/toolbar/toolbar_view.cc
index 107005e2e3be0b2fceece486f29051e315389065..62f8ef0b951f277565cbf293fd6f90b133b9c68d 100644
--- a/chrome/browser/ui/views/toolbar/toolbar_view.cc
+++ b/chrome/browser/ui/views/toolbar/toolbar_view.cc
@@ -67,6 +67,7 @@
#include "ui/native_theme/native_theme_aura.h"
#include "ui/views/controls/menu/menu_listener.h"
#include "ui/views/focus/view_storage.h"
+#include "ui/views/view_targeter.h"
#include "ui/views/widget/tooltip_manager.h"
#include "ui/views/widget/widget.h"
#include "ui/views/window/non_client_view.h"
@@ -140,6 +141,9 @@ ToolbarView::ToolbarView(Browser* browser)
this)) {
set_id(VIEW_ID_TOOLBAR);
+ SetEventTargeter(
+ scoped_ptr<views::ViewTargeter>(new views::ViewTargeter(this)));
+
chrome::AddCommandObserver(browser_, IDC_BACK, this);
chrome::AddCommandObserver(browser_, IDC_FORWARD, this);
chrome::AddCommandObserver(browser_, IDC_RELOAD, this);
@@ -632,16 +636,6 @@ void ToolbarView::Layout() {
app_menu_->SetBounds(next_element_x, child_y, app_menu_width, child_height);
}
-bool ToolbarView::HitTestRect(const gfx::Rect& rect) const {
- // Fall through to the tab strip above us if none of |rect| intersects
- // with this view (intersection with the top shadow edge does not
- // count as intersection with this view).
- if (rect.bottom() < content_shadow_height())
- return false;
- // Otherwise let our superclass take care of it.
- return AccessiblePaneView::HitTestRect(rect);
-}
-
void ToolbarView::OnPaint(gfx::Canvas* canvas) {
View::OnPaint(canvas);
@@ -680,6 +674,22 @@ bool ToolbarView::ShouldPaintBackground() const {
}
////////////////////////////////////////////////////////////////////////////////
+// ToolbarView, views::ViewTargeterDelegate overrides:
+
+bool ToolbarView::DoesIntersectRect(const views::View* target,
+ const gfx::Rect& rect) const {
+ CHECK_EQ(target, this);
+
+ // Fall through to the tab strip above us if none of |rect| intersects
+ // with this view (intersection with the top shadow edge does not
+ // count as intersection with this view).
+ if (rect.bottom() < content_shadow_height())
+ return false;
+ // Otherwise let our superclass take care of it.
+ return ViewTargeterDelegate::DoesIntersectRect(this, rect);
+}
+
+////////////////////////////////////////////////////////////////////////////////
// ToolbarView, protected:
// Override this so that when the user presses F6 to rotate toolbar panes,

Powered by Google App Engine
This is Rietveld 408576698