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

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

Issue 1288893002: Ctrl-Enter on Bookmark bar link should open in the New Tab. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Changes as per review comments. Created 5 years, 4 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) 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/custom_button.h" 5 #include "ui/views/controls/button/custom_button.h"
6 6
7 #include "ui/accessibility/ax_view_state.h" 7 #include "ui/accessibility/ax_view_state.h"
8 #include "ui/events/event.h" 8 #include "ui/events/event.h"
9 #include "ui/events/event_utils.h" 9 #include "ui/events/event_utils.h"
10 #include "ui/events/keycodes/keyboard_codes.h" 10 #include "ui/events/keycodes/keyboard_codes.h"
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after
193 // Space sets button state to pushed. Enter clicks the button. This matches 193 // Space sets button state to pushed. Enter clicks the button. This matches
194 // the Windows native behavior of buttons, where Space clicks the button on 194 // the Windows native behavior of buttons, where Space clicks the button on
195 // KeyRelease and Enter clicks the button on KeyPressed. 195 // KeyRelease and Enter clicks the button on KeyPressed.
196 if (event.key_code() == ui::VKEY_SPACE) { 196 if (event.key_code() == ui::VKEY_SPACE) {
197 SetState(STATE_PRESSED); 197 SetState(STATE_PRESSED);
198 } else if (event.key_code() == ui::VKEY_RETURN) { 198 } else if (event.key_code() == ui::VKEY_RETURN) {
199 SetState(STATE_NORMAL); 199 SetState(STATE_NORMAL);
200 // TODO(beng): remove once NotifyClick takes ui::Event. 200 // TODO(beng): remove once NotifyClick takes ui::Event.
201 ui::MouseEvent synthetic_event(ui::ET_MOUSE_RELEASED, gfx::Point(), 201 ui::MouseEvent synthetic_event(ui::ET_MOUSE_RELEASED, gfx::Point(),
202 gfx::Point(), ui::EventTimeForNow(), 202 gfx::Point(), ui::EventTimeForNow(),
203 ui::EF_LEFT_MOUSE_BUTTON, 203 ui::EF_LEFT_MOUSE_BUTTON | event.flags(),
sadrul 2015/08/14 14:52:46 KeyEvent can have KeyEventFlags, which can mean di
Deepak 2015/08/17 06:32:51 Done.
204 ui::EF_LEFT_MOUSE_BUTTON); 204 ui::EF_LEFT_MOUSE_BUTTON);
205 NotifyClick(synthetic_event); 205 NotifyClick(synthetic_event);
206 } else { 206 } else {
207 return false; 207 return false;
208 } 208 }
209 return true; 209 return true;
210 } 210 }
211 211
212 bool CustomButton::OnKeyReleased(const ui::KeyEvent& event) { 212 bool CustomButton::OnKeyReleased(const ui::KeyEvent& event) {
213 if ((state_ == STATE_DISABLED) || (event.key_code() != ui::VKEY_SPACE)) 213 if ((state_ == STATE_DISABLED) || (event.key_code() != ui::VKEY_SPACE))
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
349 if (!details.is_add && state_ != STATE_DISABLED) 349 if (!details.is_add && state_ != STATE_DISABLED)
350 SetState(STATE_NORMAL); 350 SetState(STATE_NORMAL);
351 } 351 }
352 352
353 void CustomButton::OnBlur() { 353 void CustomButton::OnBlur() {
354 if (IsHotTracked()) 354 if (IsHotTracked())
355 SetState(STATE_NORMAL); 355 SetState(STATE_NORMAL);
356 } 356 }
357 357
358 } // namespace views 358 } // 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