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 "ui/events/event.h" | 7 #include "ui/events/event.h" |
8 #include "ui/events/scoped_target_handler.h" | 8 #include "ui/events/scoped_target_handler.h" |
9 #include "ui/gfx/color_palette.h" | 9 #include "ui/gfx/color_palette.h" |
10 #include "ui/gfx/geometry/size_conversions.h" | 10 #include "ui/gfx/geometry/size_conversions.h" |
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
186 SkColor InkDropHostView::GetInkDropBaseColor() const { | 186 SkColor InkDropHostView::GetInkDropBaseColor() const { |
187 NOTREACHED(); | 187 NOTREACHED(); |
188 return gfx::kPlaceholderColor; | 188 return gfx::kPlaceholderColor; |
189 } | 189 } |
190 | 190 |
191 bool InkDropHostView::ShouldShowInkDropForFocus() const { | 191 bool InkDropHostView::ShouldShowInkDropForFocus() const { |
192 return false; | 192 return false; |
193 } | 193 } |
194 | 194 |
195 void InkDropHostView::SetHasInkDrop(bool has_an_ink_drop) { | 195 void InkDropHostView::SetHasInkDrop(bool has_an_ink_drop) { |
| 196 bool handles_gesture_event = has_an_ink_drop; |
| 197 SetHasInkDrop(has_an_ink_drop, handles_gesture_event); |
| 198 } |
| 199 |
| 200 void InkDropHostView::SetHasInkDrop(bool has_an_ink_drop, |
| 201 bool handles_gesture_event) { |
196 if (has_an_ink_drop) { | 202 if (has_an_ink_drop) { |
197 ink_drop_.reset(new InkDropImpl(this)); | 203 ink_drop_.reset(new InkDropImpl(this)); |
198 gesture_handler_.reset(new InkDropGestureHandler(this, ink_drop_.get())); | 204 if (handles_gesture_event) |
| 205 gesture_handler_.reset(new InkDropGestureHandler(this, ink_drop_.get())); |
| 206 else |
| 207 gesture_handler_.reset(); |
199 } else { | 208 } else { |
| 209 DCHECK(!handles_gesture_event); |
200 gesture_handler_.reset(); | 210 gesture_handler_.reset(); |
201 ink_drop_.reset(new InkDropStub()); | 211 ink_drop_.reset(new InkDropStub()); |
202 } | 212 } |
203 } | 213 } |
204 | 214 |
205 void InkDropHostView::AnimateInkDrop(InkDropState ink_drop_state) { | 215 void InkDropHostView::AnimateInkDrop(InkDropState ink_drop_state) { |
206 ink_drop_->AnimateToState(ink_drop_state); | 216 ink_drop_->AnimateToState(ink_drop_state); |
207 } | 217 } |
208 | 218 |
209 } // namespace views | 219 } // namespace views |
OLD | NEW |