| 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" |
| 11 #include "ui/views/animation/ink_drop.h" | 11 #include "ui/views/animation/ink_drop.h" |
| 12 #include "ui/views/animation/ink_drop_factory.h" | |
| 13 #include "ui/views/animation/ink_drop_highlight.h" | 12 #include "ui/views/animation/ink_drop_highlight.h" |
| 13 #include "ui/views/animation/ink_drop_impl.h" |
| 14 #include "ui/views/animation/ink_drop_stub.h" | 14 #include "ui/views/animation/ink_drop_stub.h" |
| 15 #include "ui/views/animation/square_ink_drop_ripple.h" | 15 #include "ui/views/animation/square_ink_drop_ripple.h" |
| 16 | 16 |
| 17 namespace views { | 17 namespace views { |
| 18 | 18 |
| 19 // Default sizes for ink drop effects. | 19 // Default sizes for ink drop effects. |
| 20 const int kInkDropSize = 24; | 20 const int kInkDropSize = 24; |
| 21 const int kInkDropLargeCornerRadius = 4; | 21 const int kInkDropLargeCornerRadius = 4; |
| 22 | 22 |
| 23 // The scale factor to compute the large ink drop size. | 23 // The scale factor to compute the large ink drop size. |
| (...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 185 NOTREACHED(); | 185 NOTREACHED(); |
| 186 return gfx::kPlaceholderColor; | 186 return gfx::kPlaceholderColor; |
| 187 } | 187 } |
| 188 | 188 |
| 189 bool InkDropHostView::ShouldShowInkDropForFocus() const { | 189 bool InkDropHostView::ShouldShowInkDropForFocus() const { |
| 190 return false; | 190 return false; |
| 191 } | 191 } |
| 192 | 192 |
| 193 void InkDropHostView::SetHasInkDrop(bool has_an_ink_drop) { | 193 void InkDropHostView::SetHasInkDrop(bool has_an_ink_drop) { |
| 194 if (has_an_ink_drop) { | 194 if (has_an_ink_drop) { |
| 195 ink_drop_ = InkDropFactory::CreateInkDrop(this); | 195 ink_drop_.reset(new InkDropImpl(this)); |
| 196 gesture_handler_.reset(new InkDropGestureHandler(this, ink_drop_.get())); | 196 gesture_handler_.reset(new InkDropGestureHandler(this, ink_drop_.get())); |
| 197 } else { | 197 } else { |
| 198 gesture_handler_.reset(); | 198 gesture_handler_.reset(); |
| 199 ink_drop_.reset(new InkDropStub()); | 199 ink_drop_.reset(new InkDropStub()); |
| 200 } | 200 } |
| 201 } | 201 } |
| 202 | 202 |
| 203 void InkDropHostView::AnimateInkDrop(InkDropState ink_drop_state) { | 203 void InkDropHostView::AnimateInkDrop(InkDropState ink_drop_state) { |
| 204 ink_drop_->AnimateToState(ink_drop_state); | 204 ink_drop_->AnimateToState(ink_drop_state); |
| 205 } | 205 } |
| 206 | 206 |
| 207 } // namespace views | 207 } // namespace views |
| OLD | NEW |