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

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

Issue 3276007: Fix a regression in r56766 (Closed) Base URL: http://src.chromium.org/git/chromium.git
Patch Set: Created 10 years, 3 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
« 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) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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/custom_button.h" 5 #include "views/controls/button/custom_button.h"
6 6
7 #include "app/throb_animation.h" 7 #include "app/throb_animation.h"
8 #include "base/keyboard_codes.h" 8 #include "base/keyboard_codes.h"
9 #include "views/screen.h" 9 #include "views/screen.h"
10 10
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after
190 return false; 190 return false;
191 191
192 // Space sets button state to pushed. Enter clicks the button. This matches 192 // Space sets button state to pushed. Enter clicks the button. This matches
193 // the Windows native behavior of buttons, where Space clicks the button on 193 // the Windows native behavior of buttons, where Space clicks the button on
194 // KeyRelease and Enter clicks the button on KeyPressed. 194 // KeyRelease and Enter clicks the button on KeyPressed.
195 if (e.GetKeyCode() == base::VKEY_SPACE) { 195 if (e.GetKeyCode() == base::VKEY_SPACE) {
196 SetState(BS_PUSHED); 196 SetState(BS_PUSHED);
197 } else if (e.GetKeyCode() == base::VKEY_RETURN) { 197 } else if (e.GetKeyCode() == base::VKEY_RETURN) {
198 SetState(BS_NORMAL); 198 SetState(BS_NORMAL);
199 NotifyClick(e); 199 NotifyClick(e);
200 } else {
201 return false;
200 } 202 }
201 return true; 203 return true;
202 } 204 }
203 205
204 bool CustomButton::OnKeyReleased(const KeyEvent& e) { 206 bool CustomButton::OnKeyReleased(const KeyEvent& e) {
205 if ((state_ == BS_DISABLED) || (e.GetKeyCode() != base::VKEY_SPACE)) 207 if ((state_ == BS_DISABLED) || (e.GetKeyCode() != base::VKEY_SPACE))
206 return false; 208 return false;
207 209
208 SetState(BS_NORMAL); 210 SetState(BS_NORMAL);
209 NotifyClick(e); 211 NotifyClick(e);
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
253 255
254 void CustomButton::AnimationProgressed(const Animation* animation) { 256 void CustomButton::AnimationProgressed(const Animation* animation) {
255 SchedulePaint(); 257 SchedulePaint();
256 } 258 }
257 259
258 bool CustomButton::ShouldEnterPushedState(const MouseEvent& e) { 260 bool CustomButton::ShouldEnterPushedState(const MouseEvent& e) {
259 return IsTriggerableEvent(e); 261 return IsTriggerableEvent(e);
260 } 262 }
261 263
262 } // namespace views 264 } // 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