| 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_H_ | 5 #ifndef UI_VIEWS_ANIMATION_INK_DROP_H_ |
| 6 #define UI_VIEWS_ANIMATION_INK_DROP_H_ | 6 #define UI_VIEWS_ANIMATION_INK_DROP_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 | 9 |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| 11 #include "base/time/time.h" | 11 #include "base/time/time.h" |
| 12 #include "ui/compositor/layer_tree_owner.h" | 12 #include "ui/compositor/layer_tree_owner.h" |
| 13 #include "ui/events/event_handler.h" | 13 #include "ui/events/event_handler.h" |
| 14 #include "ui/gfx/geometry/rect.h" | 14 #include "ui/gfx/geometry/rect.h" |
| 15 #include "ui/gfx/geometry/size.h" | 15 #include "ui/gfx/geometry/size.h" |
| 16 #include "ui/views/animation/ink_drop_observer.h" |
| 16 #include "ui/views/animation/ink_drop_state.h" | 17 #include "ui/views/animation/ink_drop_state.h" |
| 17 #include "ui/views/view.h" | 18 #include "ui/views/view.h" |
| 18 #include "ui/views/views_export.h" | 19 #include "ui/views/views_export.h" |
| 19 | 20 |
| 20 namespace views { | 21 namespace views { |
| 21 | 22 |
| 22 // Pure virtual base class that manages the lifetime and state of an ink drop | 23 // Pure virtual base class that manages the lifetime and state of an ink drop |
| 23 // ripple as well as visual hover state feedback. | 24 // ripple as well as visual hover state feedback. |
| 24 class VIEWS_EXPORT InkDrop { | 25 class VIEWS_EXPORT InkDrop { |
| 25 public: | 26 public: |
| (...skipping 13 matching lines...) Expand all Loading... |
| 39 // the only one available because it was the only InkDropState that clients | 40 // the only one available because it was the only InkDropState that clients |
| 40 // needed to skip animations for. | 41 // needed to skip animations for. |
| 41 virtual void SnapToActivated() = 0; | 42 virtual void SnapToActivated() = 0; |
| 42 | 43 |
| 43 // Enables or disables the hover state. | 44 // Enables or disables the hover state. |
| 44 virtual void SetHovered(bool is_hovered) = 0; | 45 virtual void SetHovered(bool is_hovered) = 0; |
| 45 | 46 |
| 46 // Enables or disables the focus state. | 47 // Enables or disables the focus state. |
| 47 virtual void SetFocused(bool is_focused) = 0; | 48 virtual void SetFocused(bool is_focused) = 0; |
| 48 | 49 |
| 50 // Returns true if the highlight animation is in the process of fading in or |
| 51 // is visible. |
| 52 virtual bool IsHighlightFadingInOrVisible() const = 0; |
| 53 |
| 54 // Sets the observer of this object. |
| 55 void SetObserver(InkDropObserver* observer); |
| 56 |
| 49 protected: | 57 protected: |
| 50 InkDrop() {} | 58 InkDrop() : observer_(nullptr) {} |
| 59 |
| 60 InkDropObserver* observer_; |
| 51 | 61 |
| 52 private: | 62 private: |
| 53 DISALLOW_COPY_AND_ASSIGN(InkDrop); | 63 DISALLOW_COPY_AND_ASSIGN(InkDrop); |
| 54 }; | 64 }; |
| 55 | 65 |
| 56 // A View which can be used to parent ink drop layers. Typically this is used | 66 // A View which can be used to parent ink drop layers. Typically this is used |
| 57 // as a non-ancestor view to labels so that the labels can paint on an opaque | 67 // as a non-ancestor view to labels so that the labels can paint on an opaque |
| 58 // canvas. This is used to avoid ugly text renderings when labels with subpixel | 68 // canvas. This is used to avoid ugly text renderings when labels with subpixel |
| 59 // rendering enabled are painted onto a non-opaque canvas. | 69 // rendering enabled are painted onto a non-opaque canvas. |
| 60 class VIEWS_EXPORT InkDropContainerView : public views::View { | 70 class VIEWS_EXPORT InkDropContainerView : public views::View { |
| 61 public: | 71 public: |
| 62 InkDropContainerView(); | 72 InkDropContainerView(); |
| 63 | 73 |
| 64 void AddInkDropLayer(ui::Layer* ink_drop_layer); | 74 void AddInkDropLayer(ui::Layer* ink_drop_layer); |
| 65 void RemoveInkDropLayer(ui::Layer* ink_drop_layer); | 75 void RemoveInkDropLayer(ui::Layer* ink_drop_layer); |
| 66 | 76 |
| 67 // View: | 77 // View: |
| 68 bool CanProcessEventsWithinSubtree() const override; | 78 bool CanProcessEventsWithinSubtree() const override; |
| 69 | 79 |
| 70 private: | 80 private: |
| 71 DISALLOW_COPY_AND_ASSIGN(InkDropContainerView); | 81 DISALLOW_COPY_AND_ASSIGN(InkDropContainerView); |
| 72 }; | 82 }; |
| 73 | 83 |
| 74 } // namespace views | 84 } // namespace views |
| 75 | 85 |
| 76 #endif // UI_VIEWS_ANIMATION_INK_DROP_H_ | 86 #endif // UI_VIEWS_ANIMATION_INK_DROP_H_ |
| OLD | NEW |