Chromium Code Reviews| 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_node_data.h" | 7 #include "ui/accessibility/ax_node_data.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 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 132 // Button::OnEnabledChanged() here? | 132 // Button::OnEnabledChanged() here? |
| 133 if (enabled() ? (state_ != STATE_DISABLED) : (state_ == STATE_DISABLED)) | 133 if (enabled() ? (state_ != STATE_DISABLED) : (state_ == STATE_DISABLED)) |
| 134 return; | 134 return; |
| 135 | 135 |
| 136 if (enabled()) { | 136 if (enabled()) { |
| 137 bool should_enter_hover_state = ShouldEnterHoveredState(); | 137 bool should_enter_hover_state = ShouldEnterHoveredState(); |
| 138 SetState(should_enter_hover_state ? STATE_HOVERED : STATE_NORMAL); | 138 SetState(should_enter_hover_state ? STATE_HOVERED : STATE_NORMAL); |
| 139 GetInkDrop()->SetHovered(should_enter_hover_state); | 139 GetInkDrop()->SetHovered(should_enter_hover_state); |
| 140 } else { | 140 } else { |
| 141 SetState(STATE_DISABLED); | 141 SetState(STATE_DISABLED); |
| 142 GetInkDrop()->SetHovered(false); | |
|
sadrul
2017/01/03 17:13:25
Can some of these move into CustomButton::StateCha
bruthig
2017/01/03 20:05:21
Would it make more sense to move this to InkDropHo
Evan Stade
2017/01/03 21:19:38
I don't know, maybe, but I'd rather keep it near t
Evan Stade
2017/01/03 21:19:38
Not easily. For one thing, all the 19 overrides wo
| |
| 142 } | 143 } |
| 143 } | 144 } |
| 144 | 145 |
| 145 const char* CustomButton::GetClassName() const { | 146 const char* CustomButton::GetClassName() const { |
| 146 return kViewClassName; | 147 return kViewClassName; |
| 147 } | 148 } |
| 148 | 149 |
| 149 bool CustomButton::OnMousePressed(const ui::MouseEvent& event) { | 150 bool CustomButton::OnMousePressed(const ui::MouseEvent& event) { |
| 150 if (state_ == STATE_DISABLED) | 151 if (state_ == STATE_DISABLED) |
| 151 return true; | 152 return true; |
| (...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 474 views::InkDropState::ACTION_PENDING || | 475 views::InkDropState::ACTION_PENDING || |
| 475 GetInkDrop()->GetTargetInkDropState() == | 476 GetInkDrop()->GetTargetInkDropState() == |
| 476 views::InkDropState::ALTERNATE_ACTION_PENDING) { | 477 views::InkDropState::ALTERNATE_ACTION_PENDING) { |
| 477 AnimateInkDrop(views::InkDropState::HIDDEN, | 478 AnimateInkDrop(views::InkDropState::HIDDEN, |
| 478 ui::LocatedEvent::FromIfValid(&event)); | 479 ui::LocatedEvent::FromIfValid(&event)); |
| 479 } | 480 } |
| 480 Button::OnClickCanceled(event); | 481 Button::OnClickCanceled(event); |
| 481 } | 482 } |
| 482 | 483 |
| 483 } // namespace views | 484 } // namespace views |
| OLD | NEW |