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

Side by Side Diff: ui/views/controls/button/menu_button.cc

Issue 10823004: Consume TAP regardless of menu result to avoid setting HOT state in CustomButton. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "ui/views/controls/button/menu_button.h" 5 #include "ui/views/controls/button/menu_button.h"
6 6
7 #include "base/utf_string_conversions.h" 7 #include "base/utf_string_conversions.h"
8 #include "grit/ui_resources.h" 8 #include "grit/ui_resources.h"
9 #include "grit/ui_strings.h" 9 #include "grit/ui_strings.h"
10 #include "ui/base/accessibility/accessible_view_state.h" 10 #include "ui/base/accessibility/accessible_view_state.h"
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after
215 // to BS_NORMAL instead of keeping the state BM_PUSHED. This, in turn, will 215 // to BS_NORMAL instead of keeping the state BM_PUSHED. This, in turn, will
216 // cause the button to appear depressed while the menu is displayed. 216 // cause the button to appear depressed while the menu is displayed.
217 void MenuButton::OnMouseExited(const MouseEvent& event) { 217 void MenuButton::OnMouseExited(const MouseEvent& event) {
218 if ((state_ != BS_DISABLED) && (!menu_visible_) && (!InDrag())) { 218 if ((state_ != BS_DISABLED) && (!menu_visible_) && (!InDrag())) {
219 SetState(BS_NORMAL); 219 SetState(BS_NORMAL);
220 } 220 }
221 } 221 }
222 222
223 ui::GestureStatus MenuButton::OnGestureEvent(const GestureEvent& event) { 223 ui::GestureStatus MenuButton::OnGestureEvent(const GestureEvent& event) {
224 if (state() != BS_DISABLED && event.type() == ui::ET_GESTURE_TAP) { 224 if (state() != BS_DISABLED && event.type() == ui::ET_GESTURE_TAP) {
225 if (Activate()) 225 ignore_result(Activate());
sky 2012/07/25 00:48:42 You don't need ignore_result here. Are you sure th
flackr 2012/07/25 01:31:59 Yes, Activate blocks until the menu completion, af
226 return ui::GESTURE_STATUS_CONSUMED; 226 return ui::GESTURE_STATUS_CONSUMED;
227 } 227 }
228 return TextButton::OnGestureEvent(event); 228 return TextButton::OnGestureEvent(event);
229 } 229 }
230 230
231 bool MenuButton::OnKeyPressed(const KeyEvent& event) { 231 bool MenuButton::OnKeyPressed(const KeyEvent& event) {
232 switch (event.key_code()) { 232 switch (event.key_code()) {
233 case ui::VKEY_SPACE: 233 case ui::VKEY_SPACE:
234 // Alt-space on windows should show the window menu. 234 // Alt-space on windows should show the window menu.
235 if (event.IsAltDown()) 235 if (event.IsAltDown())
236 break; 236 break;
(...skipping 27 matching lines...) Expand all
264 if (!GetWidget()) { 264 if (!GetWidget()) {
265 NOTREACHED(); 265 NOTREACHED();
266 return 0; 266 return 0;
267 } 267 }
268 268
269 gfx::Rect monitor_bounds = GetWidget()->GetWorkAreaBoundsInScreen(); 269 gfx::Rect monitor_bounds = GetWidget()->GetWorkAreaBoundsInScreen();
270 return monitor_bounds.right() - 1; 270 return monitor_bounds.right() - 1;
271 } 271 }
272 272
273 } // namespace views 273 } // namespace views
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698