summaryrefslogtreecommitdiffstats
path: root/chrome/views/base_button.cc
diff options
context:
space:
mode:
authorsky@google.com <sky@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-11-12 21:54:44 +0000
committersky@google.com <sky@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-11-12 21:54:44 +0000
commit8c30313c62097a718190a9df00e681a75e47d42f (patch)
tree12c57430411f0859746190ab50a5b1ec42c1f469 /chrome/views/base_button.cc
parent6840158fdaef4b2ece5ee8248907454fb4b7a84f (diff)
downloadchromium_src-8c30313c62097a718190a9df00e681a75e47d42f.zip
chromium_src-8c30313c62097a718190a9df00e681a75e47d42f.tar.gz
chromium_src-8c30313c62097a718190a9df00e681a75e47d42f.tar.bz2
Fixes bug in showing context menu for buttons. In particular because
we weren't resetting state before showing the context menu it was possible for the button to stay in a HOT state even though it isn't. BUG=2620 TEST=see bug Review URL: http://codereview.chromium.org/10835 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@5300 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/views/base_button.cc')
-rw-r--r--chrome/views/base_button.cc11
1 files changed, 11 insertions, 0 deletions
diff --git a/chrome/views/base_button.cc b/chrome/views/base_button.cc
index 7fc4772..6424f90 100644
--- a/chrome/views/base_button.cc
+++ b/chrome/views/base_button.cc
@@ -236,6 +236,17 @@ bool BaseButton::OnKeyReleased(const KeyEvent& e) {
return false;
}
+void BaseButton::ShowContextMenu(int x, int y, bool is_mouse_gesture) {
+ if (GetContextMenuController()) {
+ // We're about to show the context menu. Showing the context menu likely
+ // means we won't get a mouse exited and reset state. Reset it now to be
+ // sure.
+ if (GetState() != BS_DISABLED)
+ SetState(BS_NORMAL);
+ View::ShowContextMenu(x, y, is_mouse_gesture);
+ }
+}
+
bool BaseButton::AcceleratorPressed(const Accelerator& accelerator) {
if (enabled_) {
SetState(BS_NORMAL);