| 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 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 236 } else if (event->type() == ui::ET_GESTURE_TAP_DOWN && | 236 } else if (event->type() == ui::ET_GESTURE_TAP_DOWN && |
| 237 ShouldEnterPushedState(*event)) { | 237 ShouldEnterPushedState(*event)) { |
| 238 SetState(STATE_PRESSED); | 238 SetState(STATE_PRESSED); |
| 239 if (request_focus_on_press_) | 239 if (request_focus_on_press_) |
| 240 RequestFocus(); | 240 RequestFocus(); |
| 241 event->StopPropagation(); | 241 event->StopPropagation(); |
| 242 } else if (event->type() == ui::ET_GESTURE_TAP_CANCEL || | 242 } else if (event->type() == ui::ET_GESTURE_TAP_CANCEL || |
| 243 event->type() == ui::ET_GESTURE_END) { | 243 event->type() == ui::ET_GESTURE_END) { |
| 244 SetState(STATE_NORMAL); | 244 SetState(STATE_NORMAL); |
| 245 } | 245 } |
| 246 if (!event->handled()) | 246 Button::OnGestureEvent(event); |
| 247 Button::OnGestureEvent(event); | |
| 248 } | 247 } |
| 249 | 248 |
| 250 bool CustomButton::AcceleratorPressed(const ui::Accelerator& accelerator) { | 249 bool CustomButton::AcceleratorPressed(const ui::Accelerator& accelerator) { |
| 251 SetState(STATE_NORMAL); | 250 SetState(STATE_NORMAL); |
| 252 // TODO(beng): remove once NotifyClick takes ui::Event. | 251 // TODO(beng): remove once NotifyClick takes ui::Event. |
| 253 ui::MouseEvent synthetic_event( | 252 ui::MouseEvent synthetic_event( |
| 254 ui::ET_MOUSE_RELEASED, gfx::Point(), gfx::Point(), ui::EventTimeForNow(), | 253 ui::ET_MOUSE_RELEASED, gfx::Point(), gfx::Point(), ui::EventTimeForNow(), |
| 255 ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON); | 254 ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON); |
| 256 NotifyClick(synthetic_event); | 255 NotifyClick(synthetic_event); |
| 257 return true; | 256 return true; |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 369 if (!details.is_add && state_ != STATE_DISABLED) | 368 if (!details.is_add && state_ != STATE_DISABLED) |
| 370 SetState(STATE_NORMAL); | 369 SetState(STATE_NORMAL); |
| 371 } | 370 } |
| 372 | 371 |
| 373 void CustomButton::OnBlur() { | 372 void CustomButton::OnBlur() { |
| 374 if (IsHotTracked()) | 373 if (IsHotTracked()) |
| 375 SetState(STATE_NORMAL); | 374 SetState(STATE_NORMAL); |
| 376 } | 375 } |
| 377 | 376 |
| 378 } // namespace views | 377 } // namespace views |
| OLD | NEW |