| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "views/controls/button/button_dropdown.h" | 5 #include "views/controls/button/button_dropdown.h" |
| 6 | 6 |
| 7 #include "base/compiler_specific.h" | 7 #include "base/compiler_specific.h" |
| 8 #include "base/message_loop.h" | 8 #include "base/message_loop.h" |
| 9 #include "base/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
| 10 #include "grit/app_strings.h" | 10 #include "grit/app_strings.h" |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 66 // it immediately. | 66 // it immediately. |
| 67 if (event.y() > y_position_on_lbuttondown_ + GetHorizontalDragThreshold()) { | 67 if (event.y() > y_position_on_lbuttondown_ + GetHorizontalDragThreshold()) { |
| 68 show_menu_factory_.RevokeAll(); | 68 show_menu_factory_.RevokeAll(); |
| 69 ShowDropDownMenu(GetWidget()->GetNativeView()); | 69 ShowDropDownMenu(GetWidget()->GetNativeView()); |
| 70 } | 70 } |
| 71 } | 71 } |
| 72 | 72 |
| 73 return result; | 73 return result; |
| 74 } | 74 } |
| 75 | 75 |
| 76 void ButtonDropDown::OnMouseReleased(const MouseEvent& event, bool canceled) { | 76 void ButtonDropDown::OnMouseReleased(const MouseEvent& event) { |
| 77 // Showing the drop down results in a MouseReleased with a canceled drag, we | 77 if (IsTriggerableEvent(event) || |
| 78 // need to ignore it. | 78 (event.IsRightMouseButton() && !HitTest(event.location()))) { |
| 79 if (!canceled && (IsTriggerableEvent(event) || | 79 ImageButton::OnMouseReleased(event); |
| 80 (event.IsRightMouseButton() && !HitTest(event.location())))) { | |
| 81 ImageButton::OnMouseReleased(event, canceled); | |
| 82 } | 80 } |
| 83 | 81 |
| 84 if (canceled) | |
| 85 return; | |
| 86 | |
| 87 if (IsTriggerableEvent(event)) | 82 if (IsTriggerableEvent(event)) |
| 88 show_menu_factory_.RevokeAll(); | 83 show_menu_factory_.RevokeAll(); |
| 89 | 84 |
| 90 if (IsEnabled() && event.IsRightMouseButton() && HitTest(event.location())) { | 85 if (IsEnabled() && event.IsRightMouseButton() && HitTest(event.location())) { |
| 91 show_menu_factory_.RevokeAll(); | 86 show_menu_factory_.RevokeAll(); |
| 92 ShowDropDownMenu(GetWidget()->GetNativeView()); | 87 ShowDropDownMenu(GetWidget()->GetNativeView()); |
| 93 } | 88 } |
| 94 } | 89 } |
| 95 | 90 |
| 96 void ButtonDropDown::OnMouseExited(const MouseEvent& event) { | 91 void ButtonDropDown::OnMouseExited(const MouseEvent& event) { |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 160 } | 155 } |
| 161 } | 156 } |
| 162 | 157 |
| 163 //////////////////////////////////////////////////////////////////////////////// | 158 //////////////////////////////////////////////////////////////////////////////// |
| 164 // | 159 // |
| 165 // ButtonDropDown - Accessibility | 160 // ButtonDropDown - Accessibility |
| 166 // | 161 // |
| 167 //////////////////////////////////////////////////////////////////////////////// | 162 //////////////////////////////////////////////////////////////////////////////// |
| 168 | 163 |
| 169 } // namespace views | 164 } // namespace views |
| OLD | NEW |