Chromium Code Reviews| Index: views/controls/button/custom_button.cc |
| diff --git a/views/controls/button/custom_button.cc b/views/controls/button/custom_button.cc |
| index 5f8e82e3c67017734a12bf856116e8366ca1fce5..c1f66c25e3c02722fcdb4fc21af9784fd8a31ac1 100644 |
| --- a/views/controls/button/custom_button.cc |
| +++ b/views/controls/button/custom_button.cc |
| @@ -129,7 +129,8 @@ bool CustomButton::OnMouseDragged(const MouseEvent& event) { |
| return true; |
| } |
| -void CustomButton::OnMouseReleased(const MouseEvent& event, bool canceled) { |
| +void CustomButton::OnMouseReleased(const MouseEvent& event) { |
| + // TODO(msw): Is this still true? Perhaps the InDrag() check is unnecessary. |
|
msw
2011/03/17 23:28:51
Need guidance / testing; or leave as-is.
|
| // Starting a drag results in a MouseReleased, we need to ignore it. |
| if ((state_ == BS_DISABLED) || InDrag()) |
| return; |
| @@ -140,13 +141,19 @@ void CustomButton::OnMouseReleased(const MouseEvent& event, bool canceled) { |
| } |
| SetState(BS_HOT); |
| - if (!canceled && IsTriggerableEvent(event)) { |
| + if (IsTriggerableEvent(event)) { |
| NotifyClick(event); |
| // NOTE: We may be deleted at this point (by the listener's notification |
| // handler). |
| } |
| } |
| +void CustomButton::OnMouseCaptureLost() { |
| + // Starting a drag results in a MouseCaptureLost, we need to ignore it. |
| + if (state_ != BS_DISABLED && !InDrag()) |
| + SetState(BS_NORMAL); |
| +} |
| + |
| void CustomButton::OnMouseEntered(const MouseEvent& event) { |
| if (state_ != BS_DISABLED) |
| SetState(BS_HOT); |