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

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

Issue 344043: Fixes regression introduced in fixing 19597. This change effectively... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 11 years, 1 month 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) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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/menu_button.h" 5 #include "views/controls/button/menu_button.h"
6 6
7 #include "app/drag_drop_types.h" 7 #include "app/drag_drop_types.h"
8 #include "app/gfx/canvas.h" 8 #include "app/gfx/canvas.h"
9 #include "app/l10n_util.h" 9 #include "app/l10n_util.h"
10 #include "app/resource_bundle.h" 10 #include "app/resource_bundle.h"
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
181 if (delta_in_milliseconds > kMinimumTimeBetweenButtonClicks) { 181 if (delta_in_milliseconds > kMinimumTimeBetweenButtonClicks) {
182 return Activate(); 182 return Activate();
183 } 183 }
184 } 184 }
185 } 185 }
186 return true; 186 return true;
187 } 187 }
188 188
189 void MenuButton::OnMouseReleased(const MouseEvent& e, 189 void MenuButton::OnMouseReleased(const MouseEvent& e,
190 bool canceled) { 190 bool canceled) {
191 // Explicitly test for left mouse button to show the menu. If we tested for
192 // !IsTriggerableEvent it could lead to a situation where we end up showing
193 // the menu and context menu (this would happen if the right button is not
194 // triggerable and there's a context menu).
191 if (GetDragOperations(e.x(), e.y()) != DragDropTypes::DRAG_NONE && 195 if (GetDragOperations(e.x(), e.y()) != DragDropTypes::DRAG_NONE &&
192 state() != BS_DISABLED && !canceled && !InDrag() && !IsTriggerableEvent(e) 196 state() != BS_DISABLED && !canceled && !InDrag() &&
193 && HitTest(e.location())) { 197 e.IsOnlyLeftMouseButton() && HitTest(e.location())) {
194 Activate(); 198 Activate();
195 } else { 199 } else {
196 TextButton::OnMouseReleased(e, canceled); 200 TextButton::OnMouseReleased(e, canceled);
197 } 201 }
198 } 202 }
199 203
200 // When the space bar or the enter key is pressed we need to show the menu. 204 // When the space bar or the enter key is pressed we need to show the menu.
201 bool MenuButton::OnKeyReleased(const KeyEvent& e) { 205 bool MenuButton::OnKeyReleased(const KeyEvent& e) {
202 #if defined(OS_WIN) 206 #if defined(OS_WIN)
203 if ((e.GetKeyCode() == base::VKEY_SPACE) || 207 if ((e.GetKeyCode() == base::VKEY_SPACE) ||
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
242 } 246 }
243 247
244 bool MenuButton::GetAccessibleState(AccessibilityTypes::State* state) { 248 bool MenuButton::GetAccessibleState(AccessibilityTypes::State* state) {
245 DCHECK(state); 249 DCHECK(state);
246 250
247 *state = AccessibilityTypes::STATE_HASPOPUP; 251 *state = AccessibilityTypes::STATE_HASPOPUP;
248 return true; 252 return true;
249 } 253 }
250 254
251 } // namespace views 255 } // 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