| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/animation/ink_drop_host_view.h" | 5 #include "ui/views/animation/ink_drop_host_view.h" |
| 6 | 6 |
| 7 #include "base/memory/ptr_util.h" | 7 #include "base/memory/ptr_util.h" |
| 8 #include "ui/events/event.h" | 8 #include "ui/events/event.h" |
| 9 #include "ui/events/scoped_target_handler.h" | 9 #include "ui/events/scoped_target_handler.h" |
| 10 #include "ui/gfx/color_palette.h" | 10 #include "ui/gfx/color_palette.h" |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 69 case ui::ET_GESTURE_LONG_PRESS: | 69 case ui::ET_GESTURE_LONG_PRESS: |
| 70 if (current_ink_drop_state == InkDropState::ACTIVATED) | 70 if (current_ink_drop_state == InkDropState::ACTIVATED) |
| 71 return; | 71 return; |
| 72 ink_drop_state = InkDropState::ALTERNATE_ACTION_PENDING; | 72 ink_drop_state = InkDropState::ALTERNATE_ACTION_PENDING; |
| 73 break; | 73 break; |
| 74 case ui::ET_GESTURE_LONG_TAP: | 74 case ui::ET_GESTURE_LONG_TAP: |
| 75 ink_drop_state = InkDropState::ALTERNATE_ACTION_TRIGGERED; | 75 ink_drop_state = InkDropState::ALTERNATE_ACTION_TRIGGERED; |
| 76 break; | 76 break; |
| 77 case ui::ET_GESTURE_END: | 77 case ui::ET_GESTURE_END: |
| 78 case ui::ET_GESTURE_SCROLL_BEGIN: | 78 case ui::ET_GESTURE_SCROLL_BEGIN: |
| 79 case ui::ET_GESTURE_TAP_CANCEL: |
| 79 if (current_ink_drop_state == InkDropState::ACTIVATED) | 80 if (current_ink_drop_state == InkDropState::ACTIVATED) |
| 80 return; | 81 return; |
| 81 ink_drop_state = InkDropState::HIDDEN; | 82 ink_drop_state = InkDropState::HIDDEN; |
| 82 break; | 83 break; |
| 83 default: | 84 default: |
| 84 return; | 85 return; |
| 85 } | 86 } |
| 86 | 87 |
| 87 if (ink_drop_state == InkDropState::HIDDEN && | 88 if (ink_drop_state == InkDropState::HIDDEN && |
| 88 (current_ink_drop_state == InkDropState::ACTION_TRIGGERED || | 89 (current_ink_drop_state == InkDropState::ACTION_TRIGGERED || |
| 89 current_ink_drop_state == InkDropState::ALTERNATE_ACTION_TRIGGERED || | 90 current_ink_drop_state == InkDropState::ALTERNATE_ACTION_TRIGGERED || |
| 90 current_ink_drop_state == InkDropState::DEACTIVATED)) { | 91 current_ink_drop_state == InkDropState::DEACTIVATED || |
| 92 current_ink_drop_state == InkDropState::HIDDEN)) { |
| 91 // These InkDropStates automatically transition to the HIDDEN state so we | 93 // These InkDropStates automatically transition to the HIDDEN state so we |
| 92 // don't make an explicit call. Explicitly animating to HIDDEN in this | 94 // don't make an explicit call. Explicitly animating to HIDDEN in this |
| 93 // case would prematurely pre-empt these animations. | 95 // case would prematurely pre-empt these animations. |
| 94 return; | 96 return; |
| 95 } | 97 } |
| 96 host_view_->AnimateInkDrop(ink_drop_state, event); | 98 host_view_->AnimateInkDrop(ink_drop_state, event); |
| 97 } | 99 } |
| 98 | 100 |
| 99 private: | 101 private: |
| 100 // Allows |this| to handle all GestureEvents on |host_view_|. | 102 // Allows |this| to handle all GestureEvents on |host_view_|. |
| (...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 291 std::unique_ptr<InkDropImpl> | 293 std::unique_ptr<InkDropImpl> |
| 292 InkDropHostView::CreateDefaultFloodFillInkDropImpl() { | 294 InkDropHostView::CreateDefaultFloodFillInkDropImpl() { |
| 293 std::unique_ptr<views::InkDropImpl> ink_drop = | 295 std::unique_ptr<views::InkDropImpl> ink_drop = |
| 294 InkDropHostView::CreateDefaultInkDropImpl(); | 296 InkDropHostView::CreateDefaultInkDropImpl(); |
| 295 ink_drop->SetAutoHighlightMode( | 297 ink_drop->SetAutoHighlightMode( |
| 296 views::InkDropImpl::AutoHighlightMode::SHOW_ON_RIPPLE); | 298 views::InkDropImpl::AutoHighlightMode::SHOW_ON_RIPPLE); |
| 297 return ink_drop; | 299 return ink_drop; |
| 298 } | 300 } |
| 299 | 301 |
| 300 } // namespace views | 302 } // namespace views |
| OLD | NEW |