| 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 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 99 | 99 |
| 100 void CustomButton::SetAnimationDuration(int duration) { | 100 void CustomButton::SetAnimationDuration(int duration) { |
| 101 hover_animation_.SetSlideDuration(duration); | 101 hover_animation_.SetSlideDuration(duration); |
| 102 } | 102 } |
| 103 | 103 |
| 104 void CustomButton::SetHotTracked(bool is_hot_tracked) { | 104 void CustomButton::SetHotTracked(bool is_hot_tracked) { |
| 105 if (state_ != STATE_DISABLED) | 105 if (state_ != STATE_DISABLED) |
| 106 SetState(is_hot_tracked ? STATE_HOVERED : STATE_NORMAL); | 106 SetState(is_hot_tracked ? STATE_HOVERED : STATE_NORMAL); |
| 107 | 107 |
| 108 if (is_hot_tracked) | 108 if (is_hot_tracked) |
| 109 NotifyAccessibilityEvent(ui::AX_EVENT_FOCUS, true); | 109 NotifyAccessibilityEvent(ui::AX_EVENT_HOVER, true); |
| 110 } | 110 } |
| 111 | 111 |
| 112 bool CustomButton::IsHotTracked() const { | 112 bool CustomButton::IsHotTracked() const { |
| 113 return state_ == STATE_HOVERED; | 113 return state_ == STATE_HOVERED; |
| 114 } | 114 } |
| 115 | 115 |
| 116 //////////////////////////////////////////////////////////////////////////////// | 116 //////////////////////////////////////////////////////////////////////////////// |
| 117 // CustomButton, View overrides: | 117 // CustomButton, View overrides: |
| 118 | 118 |
| 119 void CustomButton::Layout() { | 119 void CustomButton::Layout() { |
| (...skipping 327 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 447 Button::NotifyClick(event); | 447 Button::NotifyClick(event); |
| 448 } | 448 } |
| 449 | 449 |
| 450 void CustomButton::OnClickCanceled(const ui::Event& event) { | 450 void CustomButton::OnClickCanceled(const ui::Event& event) { |
| 451 if (ink_drop_delegate()) | 451 if (ink_drop_delegate()) |
| 452 ink_drop_delegate()->OnAction(views::InkDropState::HIDDEN); | 452 ink_drop_delegate()->OnAction(views::InkDropState::HIDDEN); |
| 453 Button::OnClickCanceled(event); | 453 Button::OnClickCanceled(event); |
| 454 } | 454 } |
| 455 | 455 |
| 456 } // namespace views | 456 } // namespace views |
| OLD | NEW |