| 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/keycodes/keyboard_codes.h" | 9 #include "ui/events/keycodes/keyboard_codes.h" |
| 10 #include "ui/gfx/animation/throb_animation.h" | 10 #include "ui/gfx/animation/throb_animation.h" |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 66 // Button is returning to a normal state from hover, start hover | 66 // Button is returning to a normal state from hover, start hover |
| 67 // fade animation. | 67 // fade animation. |
| 68 hover_animation_->Hide(); | 68 hover_animation_->Hide(); |
| 69 } else { | 69 } else { |
| 70 hover_animation_->Stop(); | 70 hover_animation_->Stop(); |
| 71 } | 71 } |
| 72 } | 72 } |
| 73 | 73 |
| 74 state_ = state; | 74 state_ = state; |
| 75 StateChanged(); | 75 StateChanged(); |
| 76 if (state_changed_delegate_.get()) | |
| 77 state_changed_delegate_->StateChanged(state_); | |
| 78 SchedulePaint(); | 76 SchedulePaint(); |
| 79 } | 77 } |
| 80 | 78 |
| 81 void CustomButton::StartThrobbing(int cycles_til_stop) { | 79 void CustomButton::StartThrobbing(int cycles_til_stop) { |
| 82 is_throbbing_ = true; | 80 is_throbbing_ = true; |
| 83 hover_animation_->StartThrobbing(cycles_til_stop); | 81 hover_animation_->StartThrobbing(cycles_til_stop); |
| 84 } | 82 } |
| 85 | 83 |
| 86 void CustomButton::StopThrobbing() { | 84 void CustomButton::StopThrobbing() { |
| 87 if (hover_animation_->is_animating()) { | 85 if (hover_animation_->is_animating()) { |
| (...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 346 if (!details.is_add && state_ != STATE_DISABLED) | 344 if (!details.is_add && state_ != STATE_DISABLED) |
| 347 SetState(STATE_NORMAL); | 345 SetState(STATE_NORMAL); |
| 348 } | 346 } |
| 349 | 347 |
| 350 void CustomButton::OnBlur() { | 348 void CustomButton::OnBlur() { |
| 351 if (IsHotTracked()) | 349 if (IsHotTracked()) |
| 352 SetState(STATE_NORMAL); | 350 SetState(STATE_NORMAL); |
| 353 } | 351 } |
| 354 | 352 |
| 355 } // namespace views | 353 } // namespace views |
| OLD | NEW |