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

Unified Diff: chrome/browser/ui/views/profiles/avatar_menu_button.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: chrome/browser/ui/views/profiles/avatar_menu_button.cc
diff --git a/chrome/browser/ui/views/profiles/avatar_menu_button.cc b/chrome/browser/ui/views/profiles/avatar_menu_button.cc
index 046095fe0d9c018d2065a17e3c5bab942eda3fd8..3c3deb168feda5f734ce75f89b72b057c58bf565 100644
--- a/chrome/browser/ui/views/profiles/avatar_menu_button.cc
+++ b/chrome/browser/ui/views/profiles/avatar_menu_button.cc
@@ -20,6 +20,7 @@
#include "components/signin/core/common/profile_management_switches.h"
#include "content/public/browser/notification_service.h"
#include "ui/gfx/canvas.h"
+#include "ui/views/view_targeter.h"
#include "ui/views/widget/widget.h"
static inline int Round(double x) {
@@ -38,6 +39,9 @@ AvatarMenuButton::AvatarMenuButton(Browser* browser, bool disabled)
button_on_right_(false) {
// In RTL mode, the avatar icon should be looking the opposite direction.
EnableCanvasFlippingForRTLUI(true);
+
+ SetEventTargeter(
+ scoped_ptr<views::ViewTargeter>(new views::ViewTargeter(this)));
}
AvatarMenuButton::~AvatarMenuButton() {
@@ -78,10 +82,6 @@ void AvatarMenuButton::OnPaint(gfx::Canvas* canvas) {
button_icon_.height(), dst_x, dst_y, dst_width, dst_height, false);
}
-bool AvatarMenuButton::HitTestRect(const gfx::Rect& rect) const {
- return !disabled_ && views::MenuButton::HitTestRect(rect);
-}
-
void AvatarMenuButton::SetAvatarIcon(const gfx::Image& icon,
bool is_rectangle) {
icon_.reset(new gfx::Image(icon));
@@ -90,6 +90,14 @@ void AvatarMenuButton::SetAvatarIcon(const gfx::Image& icon,
SchedulePaint();
}
+// views::ViewTargeterDelegate:
+bool AvatarMenuButton::DoesIntersectRect(const views::View* target,
+ const gfx::Rect& rect) const {
+ CHECK_EQ(target, this);
+ return !disabled_ &&
+ views::ViewTargeterDelegate::DoesIntersectRect(target, rect);
+}
+
// views::MenuButtonListener implementation
void AvatarMenuButton::OnMenuButtonClicked(views::View* source,
const gfx::Point& point) {
« no previous file with comments | « chrome/browser/ui/views/profiles/avatar_menu_button.h ('k') | chrome/browser/ui/views/toolbar/toolbar_view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698