| 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/base/material_design/material_design_controller.h" | 8 #include "ui/base/material_design/material_design_controller.h" |
| 9 #include "ui/events/event.h" | 9 #include "ui/events/event.h" |
| 10 #include "ui/events/event_utils.h" | 10 #include "ui/events/event_utils.h" |
| (...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 160 // handler). | 160 // handler). |
| 161 } | 161 } |
| 162 return true; | 162 return true; |
| 163 } | 163 } |
| 164 | 164 |
| 165 bool CustomButton::OnMouseDragged(const ui::MouseEvent& event) { | 165 bool CustomButton::OnMouseDragged(const ui::MouseEvent& event) { |
| 166 if (state_ != STATE_DISABLED) { | 166 if (state_ != STATE_DISABLED) { |
| 167 if (HitTestPoint(event.location())) { | 167 if (HitTestPoint(event.location())) { |
| 168 SetState(ShouldEnterPushedState(event) ? STATE_PRESSED : STATE_HOVERED); | 168 SetState(ShouldEnterPushedState(event) ? STATE_PRESSED : STATE_HOVERED); |
| 169 if (!InDrag() && ink_drop_delegate() && | 169 if (!InDrag() && ink_drop_delegate() && |
| 170 ink_drop_delegate()->GetTargetInkDropState() != | 170 ink_drop_delegate()->GetTargetInkDropState() == |
| 171 views::InkDropState::ACTION_PENDING) | 171 views::InkDropState::HIDDEN) |
| 172 ink_drop_delegate()->OnAction(views::InkDropState::ACTION_PENDING); | 172 ink_drop_delegate()->OnAction(views::InkDropState::ACTION_PENDING); |
| 173 } else { | 173 } else { |
| 174 SetState(STATE_NORMAL); | 174 SetState(STATE_NORMAL); |
| 175 if (!InDrag() && ink_drop_delegate() && | 175 if (!InDrag() && ink_drop_delegate() && |
| 176 ink_drop_delegate()->GetTargetInkDropState() != | 176 ink_drop_delegate()->GetTargetInkDropState() == |
| 177 views::InkDropState::HIDDEN) | 177 views::InkDropState::ACTION_PENDING) |
| 178 ink_drop_delegate()->OnAction(views::InkDropState::HIDDEN); | 178 ink_drop_delegate()->OnAction(views::InkDropState::HIDDEN); |
| 179 } | 179 } |
| 180 } | 180 } |
| 181 return true; | 181 return true; |
| 182 } | 182 } |
| 183 | 183 |
| 184 void CustomButton::OnMouseReleased(const ui::MouseEvent& event) { | 184 void CustomButton::OnMouseReleased(const ui::MouseEvent& event) { |
| 185 if (state_ != STATE_DISABLED) { | 185 if (state_ != STATE_DISABLED) { |
| 186 if (!HitTestPoint(event.location())) { | 186 if (!HitTestPoint(event.location())) { |
| 187 SetState(STATE_NORMAL); | 187 SetState(STATE_NORMAL); |
| (...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 468 Button::NotifyClick(event); | 468 Button::NotifyClick(event); |
| 469 } | 469 } |
| 470 | 470 |
| 471 void CustomButton::OnClickCanceled(const ui::Event& event) { | 471 void CustomButton::OnClickCanceled(const ui::Event& event) { |
| 472 if (ink_drop_delegate()) | 472 if (ink_drop_delegate()) |
| 473 ink_drop_delegate()->OnAction(views::InkDropState::HIDDEN); | 473 ink_drop_delegate()->OnAction(views::InkDropState::HIDDEN); |
| 474 Button::OnClickCanceled(event); | 474 Button::OnClickCanceled(event); |
| 475 } | 475 } |
| 476 | 476 |
| 477 } // namespace views | 477 } // namespace views |
| OLD | NEW |