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

Unified Diff: views/controls/button/custom_button.cc

Issue 6685069: Disambiguate OnMouseCaptureLost from OnMouseReleased, etc. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address most TODOs and sync. Created 9 years, 9 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: views/controls/button/custom_button.cc
diff --git a/views/controls/button/custom_button.cc b/views/controls/button/custom_button.cc
index 5f8e82e3c67017734a12bf856116e8366ca1fce5..55acba8f4c75d397a89b3c22b13689b5a666c0d4 100644
--- a/views/controls/button/custom_button.cc
+++ b/views/controls/button/custom_button.cc
@@ -129,9 +129,8 @@ bool CustomButton::OnMouseDragged(const MouseEvent& event) {
return true;
}
-void CustomButton::OnMouseReleased(const MouseEvent& event, bool canceled) {
- // Starting a drag results in a MouseReleased, we need to ignore it.
- if ((state_ == BS_DISABLED) || InDrag())
+void CustomButton::OnMouseReleased(const MouseEvent& event) {
+ if (state_ == BS_DISABLED)
return;
if (!HitTest(event.location())) {
@@ -140,13 +139,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);

Powered by Google App Engine
This is Rietveld 408576698