| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 #ifndef UI_VIEWS_ANIMATION_INK_DROP_HOST_H_ | 5 #ifndef UI_VIEWS_ANIMATION_INK_DROP_HOST_H_ |
| 6 #define UI_VIEWS_ANIMATION_INK_DROP_HOST_H_ | 6 #define UI_VIEWS_ANIMATION_INK_DROP_HOST_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 | 9 |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| 11 #include "ui/gfx/geometry/point.h" | 11 #include "ui/gfx/geometry/point.h" |
| 12 #include "ui/views/views_export.h" | 12 #include "ui/views/views_export.h" |
| 13 | 13 |
| 14 namespace ui { | 14 namespace ui { |
| 15 class Layer; | 15 class Layer; |
| 16 } // namespace ui | 16 } // namespace ui |
| 17 | 17 |
| 18 namespace views { | 18 namespace views { |
| 19 | 19 |
| 20 class InkDrop; |
| 20 class InkDropRipple; | 21 class InkDropRipple; |
| 21 class InkDropHighlight; | 22 class InkDropHighlight; |
| 22 | 23 |
| 23 // Used by the InkDrop to add and remove the ink drop layers from a host's layer | 24 // Used by the InkDrop to add and remove the ink drop layers from a host's layer |
| 24 // tree. Typically the ink drop layer is added to a View's layer but it can also | 25 // tree. Typically the ink drop layer is added to a View's layer but it can also |
| 25 // be added to a View's ancestor layer. | 26 // be added to a View's ancestor layer. |
| 26 // | 27 // |
| 27 // Note: Some Views do not own a Layer, but you can use | 28 // Note: Some Views do not own a Layer, but you can use |
| 28 // View::SetLayer(new ui::Layer(ui::LAYER_NOT_DRAWN)) to force the View to have | 29 // View::SetLayer(new ui::Layer(ui::LAYER_NOT_DRAWN)) to force the View to have |
| 29 // a lightweight Layer that can parent the ink drop layer. | 30 // a lightweight Layer that can parent the ink drop layer. |
| 30 class VIEWS_EXPORT InkDropHost { | 31 class VIEWS_EXPORT InkDropHost { |
| 31 public: | 32 public: |
| 32 InkDropHost() {} | 33 InkDropHost() {} |
| 33 virtual ~InkDropHost() {} | 34 virtual ~InkDropHost() {} |
| 34 | 35 |
| 35 // Adds the |ink_drop_layer| in to a visible layer tree. | 36 // Adds the |ink_drop_layer| in to a visible layer tree. |
| 36 virtual void AddInkDropLayer(ui::Layer* ink_drop_layer) = 0; | 37 virtual void AddInkDropLayer(ui::Layer* ink_drop_layer) = 0; |
| 37 | 38 |
| 38 // Removes |ink_drop_layer| from the layer tree. | 39 // Removes |ink_drop_layer| from the layer tree. |
| 39 virtual void RemoveInkDropLayer(ui::Layer* ink_drop_layer) = 0; | 40 virtual void RemoveInkDropLayer(ui::Layer* ink_drop_layer) = 0; |
| 40 | 41 |
| 41 // Creates and returns the effect used for press. | 42 // Returns a configured InkDrop. In general subclasses will return an |
| 43 // InkDropImpl instance that will use the CreateInkDropRipple() and |
| 44 // CreateInkDropHighlight() methods to create the visual effects. |
| 45 // |
| 46 // Subclasses should override this if they need to configure any properties |
| 47 // specific to the InkDrop instance. e.g. the AutoHighlightMode of an |
| 48 // InkDropImpl instance. |
| 49 virtual std::unique_ptr<InkDrop> CreateInkDrop() = 0; |
| 50 |
| 51 // Creates and returns the visual effect used for press. Used by InkDropImpl |
| 52 // instances. |
| 42 virtual std::unique_ptr<InkDropRipple> CreateInkDropRipple() const = 0; | 53 virtual std::unique_ptr<InkDropRipple> CreateInkDropRipple() const = 0; |
| 43 | 54 |
| 44 // Creates and returns the effect used for hover and focus. | 55 // Creates and returns the visual effect used for hover and focus. Used by |
| 56 // InkDropImpl instances. |
| 45 virtual std::unique_ptr<InkDropHighlight> CreateInkDropHighlight() const = 0; | 57 virtual std::unique_ptr<InkDropHighlight> CreateInkDropHighlight() const = 0; |
| 46 | 58 |
| 47 private: | 59 private: |
| 48 DISALLOW_COPY_AND_ASSIGN(InkDropHost); | 60 DISALLOW_COPY_AND_ASSIGN(InkDropHost); |
| 49 }; | 61 }; |
| 50 | 62 |
| 51 } // namespace views | 63 } // namespace views |
| 52 | 64 |
| 53 #endif // UI_VIEWS_ANIMATION_INK_DROP_HOST_H_ | 65 #endif // UI_VIEWS_ANIMATION_INK_DROP_HOST_H_ |
| OLD | NEW |