| 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 277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 288 | 288 |
| 289 void CustomButton::ShowContextMenu(const gfx::Point& p, | 289 void CustomButton::ShowContextMenu(const gfx::Point& p, |
| 290 ui::MenuSourceType source_type) { | 290 ui::MenuSourceType source_type) { |
| 291 if (!context_menu_controller()) | 291 if (!context_menu_controller()) |
| 292 return; | 292 return; |
| 293 | 293 |
| 294 // We're about to show the context menu. Showing the context menu likely means | 294 // We're about to show the context menu. Showing the context menu likely means |
| 295 // we won't get a mouse exited and reset state. Reset it now to be sure. | 295 // we won't get a mouse exited and reset state. Reset it now to be sure. |
| 296 if (state_ != STATE_DISABLED) | 296 if (state_ != STATE_DISABLED) |
| 297 SetState(STATE_NORMAL); | 297 SetState(STATE_NORMAL); |
| 298 if (ink_drop_delegate_) { |
| 299 ink_drop_delegate_->SetHovered(false); |
| 300 ink_drop_delegate_->OnAction(InkDropState::HIDDEN); |
| 301 } |
| 298 View::ShowContextMenu(p, source_type); | 302 View::ShowContextMenu(p, source_type); |
| 299 } | 303 } |
| 300 | 304 |
| 301 void CustomButton::OnDragDone() { | 305 void CustomButton::OnDragDone() { |
| 302 // Only reset the state to normal if the button isn't currently disabled | 306 // Only reset the state to normal if the button isn't currently disabled |
| 303 // (since disabled buttons may still be able to be dragged). | 307 // (since disabled buttons may still be able to be dragged). |
| 304 if (state_ != STATE_DISABLED) | 308 if (state_ != STATE_DISABLED) |
| 305 SetState(STATE_NORMAL); | 309 SetState(STATE_NORMAL); |
| 306 if (ink_drop_delegate_) | 310 if (ink_drop_delegate_) |
| 307 ink_drop_delegate_->OnAction(InkDropState::HIDDEN); | 311 ink_drop_delegate_->OnAction(InkDropState::HIDDEN); |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 428 Button::NotifyClick(event); | 432 Button::NotifyClick(event); |
| 429 } | 433 } |
| 430 | 434 |
| 431 void CustomButton::OnClickCanceled(const ui::Event& event) { | 435 void CustomButton::OnClickCanceled(const ui::Event& event) { |
| 432 if (ink_drop_delegate()) | 436 if (ink_drop_delegate()) |
| 433 ink_drop_delegate()->OnAction(views::InkDropState::HIDDEN); | 437 ink_drop_delegate()->OnAction(views::InkDropState::HIDDEN); |
| 434 Button::OnClickCanceled(event); | 438 Button::OnClickCanceled(event); |
| 435 } | 439 } |
| 436 | 440 |
| 437 } // namespace views | 441 } // namespace views |
| OLD | NEW |