Index: ui/views/animation/ink_drop_host_view.cc |
diff --git a/ui/views/animation/ink_drop_host_view.cc b/ui/views/animation/ink_drop_host_view.cc |
index e6b1e424155d41e75056cdf1744fc2e7e2684fcc..cf58f1b5443ee544f3741638b1d8230254de03b9 100644 |
--- a/ui/views/animation/ink_drop_host_view.cc |
+++ b/ui/views/animation/ink_drop_host_view.cc |
@@ -38,7 +38,8 @@ const int InkDropHostView::kInkDropSmallCornerRadius = 2; |
// An EventHandler that is guaranteed to be invoked and is not prone to |
// InkDropHostView descendents who do not call |
-// InkDropHostView::OnGestureEvent(). |
+// InkDropHostView::OnGestureEvent(). Only one instance of this class can exist |
+// at any given time for each ink drop host view. |
// |
// TODO(bruthig): Consider getting rid of this class. |
class InkDropHostView::InkDropGestureHandler : public ui::EventHandler { |
@@ -50,6 +51,8 @@ class InkDropHostView::InkDropGestureHandler : public ui::EventHandler { |
~InkDropGestureHandler() override {} |
+ void SetInkDrop(InkDrop* ink_drop) { ink_drop_ = ink_drop; } |
+ |
// ui::EventHandler: |
void OnGestureEvent(ui::GestureEvent* event) override { |
InkDropState current_ink_drop_state = ink_drop_->GetTargetInkDropState(); |
@@ -223,7 +226,10 @@ bool InkDropHostView::ShouldShowInkDropForFocus() const { |
void InkDropHostView::SetHasInkDrop(bool has_an_ink_drop) { |
if (has_an_ink_drop) { |
ink_drop_.reset(new InkDropImpl(this)); |
- gesture_handler_.reset(new InkDropGestureHandler(this, ink_drop_.get())); |
+ if (!gesture_handler_) |
+ gesture_handler_.reset(new InkDropGestureHandler(this, ink_drop_.get())); |
+ else |
+ gesture_handler_->SetInkDrop(ink_drop_.get()); |
} else { |
gesture_handler_.reset(); |
ink_drop_.reset(new InkDropStub()); |