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

Unified Diff: chrome/views/base_button.cc

Issue 16202: Fix 4830: We navigate back after closing the Save As dialog.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 12 years 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/views/base_button.cc
===================================================================
--- chrome/views/base_button.cc (revision 7136)
+++ chrome/views/base_button.cc (working copy)
@@ -217,9 +217,16 @@
bool BaseButton::OnKeyPressed(const KeyEvent& e) {
if (state_ != BS_DISABLED) {
- if ((e.GetCharacter() == VK_SPACE) || (e.GetCharacter() == VK_RETURN)) {
+ // Space sets button state to pushed. Enter clicks the button. This matches
+ // the Windows native behavior of buttons, where Space clicks the button
+ // on KeyRelease and Enter clicks the button on KeyPressed.
+ if (e.GetCharacter() == VK_SPACE) {
SetState(BS_PUSHED);
return true;
+ } else if (e.GetCharacter() == VK_RETURN) {
+ SetState(BS_NORMAL);
+ NotifyClick(0);
+ return true;
}
}
return false;
@@ -227,7 +234,7 @@
bool BaseButton::OnKeyReleased(const KeyEvent& e) {
if (state_ != BS_DISABLED) {
- if ((e.GetCharacter() == VK_SPACE) || (e.GetCharacter() == VK_RETURN)) {
+ if (e.GetCharacter() == VK_SPACE) {
SetState(BS_NORMAL);
NotifyClick(0);
return true;
« 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