OLD | NEW |
---|---|
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 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
244 event->StopPropagation(); | 244 event->StopPropagation(); |
245 } else if (event->type() == ui::ET_GESTURE_TAP_CANCEL || | 245 } else if (event->type() == ui::ET_GESTURE_TAP_CANCEL || |
246 event->type() == ui::ET_GESTURE_END) { | 246 event->type() == ui::ET_GESTURE_END) { |
247 SetState(STATE_NORMAL); | 247 SetState(STATE_NORMAL); |
248 } | 248 } |
249 if (!event->handled()) | 249 if (!event->handled()) |
250 Button::OnGestureEvent(event); | 250 Button::OnGestureEvent(event); |
251 } | 251 } |
252 | 252 |
253 bool CustomButton::AcceleratorPressed(const ui::Accelerator& accelerator) { | 253 bool CustomButton::AcceleratorPressed(const ui::Accelerator& accelerator) { |
254 if (!HasFocus()) | |
msw
2015/11/10 22:48:34
This isn't quite right... you want to check if !Ge
meacer
2015/11/11 00:32:59
Done.
| |
255 return false; | |
254 SetState(STATE_NORMAL); | 256 SetState(STATE_NORMAL); |
255 // TODO(beng): remove once NotifyClick takes ui::Event. | 257 // TODO(beng): remove once NotifyClick takes ui::Event. |
256 ui::MouseEvent synthetic_event( | 258 ui::MouseEvent synthetic_event( |
257 ui::ET_MOUSE_RELEASED, gfx::Point(), gfx::Point(), ui::EventTimeForNow(), | 259 ui::ET_MOUSE_RELEASED, gfx::Point(), gfx::Point(), ui::EventTimeForNow(), |
258 ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON); | 260 ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON); |
259 NotifyClick(synthetic_event); | 261 NotifyClick(synthetic_event); |
260 return true; | 262 return true; |
261 } | 263 } |
262 | 264 |
263 void CustomButton::ShowContextMenu(const gfx::Point& p, | 265 void CustomButton::ShowContextMenu(const gfx::Point& p, |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
372 if (!details.is_add && state_ != STATE_DISABLED) | 374 if (!details.is_add && state_ != STATE_DISABLED) |
373 SetState(STATE_NORMAL); | 375 SetState(STATE_NORMAL); |
374 } | 376 } |
375 | 377 |
376 void CustomButton::OnBlur() { | 378 void CustomButton::OnBlur() { |
377 if (IsHotTracked()) | 379 if (IsHotTracked()) |
378 SetState(STATE_NORMAL); | 380 SetState(STATE_NORMAL); |
379 } | 381 } |
380 | 382 |
381 } // namespace views | 383 } // namespace views |
OLD | NEW |