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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
49 !strcmp(classname, LabelButton::kViewClassName) || | 49 !strcmp(classname, LabelButton::kViewClassName) || |
50 !strcmp(classname, RadioButton::kViewClassName) || | 50 !strcmp(classname, RadioButton::kViewClassName) || |
51 !strcmp(classname, MenuButton::kViewClassName)) { | 51 !strcmp(classname, MenuButton::kViewClassName)) { |
52 return static_cast<CustomButton*>(view); | 52 return static_cast<CustomButton*>(view); |
53 } | 53 } |
54 } | 54 } |
55 return NULL; | 55 return NULL; |
56 } | 56 } |
57 | 57 |
58 CustomButton::~CustomButton() { | 58 CustomButton::~CustomButton() { |
| 59 // InkDropDelegate needs to be destroyed by now since it may need to call |
| 60 // methods on |this| via InkDropHost. |
| 61 DCHECK(!ink_drop_delegate_); |
59 } | 62 } |
60 | 63 |
61 void CustomButton::SetState(ButtonState state) { | 64 void CustomButton::SetState(ButtonState state) { |
62 if (state == state_) | 65 if (state == state_) |
63 return; | 66 return; |
64 | 67 |
65 if (animate_on_state_change_ && | 68 if (animate_on_state_change_ && |
66 (!is_throbbing_ || !hover_animation_->is_animating())) { | 69 (!is_throbbing_ || !hover_animation_->is_animating())) { |
67 is_throbbing_ = false; | 70 is_throbbing_ = false; |
68 if ((state_ == STATE_HOVERED) && (state == STATE_NORMAL)) { | 71 if ((state_ == STATE_HOVERED) && (state == STATE_NORMAL)) { |
(...skipping 341 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
410 return GetWidget() && GetWidget()->GetTopLevelWidget() != GetWidget(); | 413 return GetWidget() && GetWidget()->GetTopLevelWidget() != GetWidget(); |
411 } | 414 } |
412 | 415 |
413 bool CustomButton::FocusInChildWidget() const { | 416 bool CustomButton::FocusInChildWidget() const { |
414 return GetWidget() && | 417 return GetWidget() && |
415 GetWidget()->GetRootView()->Contains( | 418 GetWidget()->GetRootView()->Contains( |
416 GetFocusManager()->GetFocusedView()); | 419 GetFocusManager()->GetFocusedView()); |
417 } | 420 } |
418 | 421 |
419 } // namespace views | 422 } // namespace views |
OLD | NEW |