Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(8)

Side by Side Diff: ui/views/animation/ink_drop.h

Issue 2720183002: [Views] Update ink drop for omnibox icons (Closed)
Patch Set: Removed the mask Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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_state.h" 16 #include "ui/views/animation/ink_drop_state.h"
17 #include "ui/views/view.h" 17 #include "ui/views/view.h"
18 #include "ui/views/views_export.h" 18 #include "ui/views/views_export.h"
19 19
20 namespace views { 20 namespace views {
21 21
22 class InkDropObserver;
23
22 // Pure virtual base class that manages the lifetime and state of an ink drop 24 // Pure virtual base class that manages the lifetime and state of an ink drop
bruthig 2017/04/21 15:05:10 Can you update the docs? This is no longer a pure
spqchan 2017/04/27 21:40:06 Done.
23 // ripple as well as visual hover state feedback. 25 // ripple as well as visual hover state feedback.
24 class VIEWS_EXPORT InkDrop { 26 class VIEWS_EXPORT InkDrop {
25 public: 27 public:
26 virtual ~InkDrop() {} 28 virtual ~InkDrop();
27 29
28 // Called by ink drop hosts when their size is changed. 30 // Called by ink drop hosts when their size is changed.
29 virtual void HostSizeChanged(const gfx::Size& new_size) = 0; 31 virtual void HostSizeChanged(const gfx::Size& new_size) = 0;
30 32
31 // Gets the target state of the ink drop. 33 // Gets the target state of the ink drop.
32 virtual InkDropState GetTargetInkDropState() const = 0; 34 virtual InkDropState GetTargetInkDropState() const = 0;
33 35
34 // Animates from the current InkDropState to |ink_drop_state|. 36 // Animates from the current InkDropState to |ink_drop_state|.
35 virtual void AnimateToState(InkDropState ink_drop_state) = 0; 37 virtual void AnimateToState(InkDropState ink_drop_state) = 0;
36 38
37 // Immediately snaps the InkDropState to ACTIVATED. This more specific 39 // Immediately snaps the InkDropState to ACTIVATED. This more specific
38 // implementation of the non-existent SnapToState(InkDropState) function is 40 // implementation of the non-existent SnapToState(InkDropState) function is
39 // the only one available because it was the only InkDropState that clients 41 // the only one available because it was the only InkDropState that clients
40 // needed to skip animations for. 42 // needed to skip animations for.
41 virtual void SnapToActivated() = 0; 43 virtual void SnapToActivated() = 0;
42 44
43 // Enables or disables the hover state. 45 // Enables or disables the hover state.
44 virtual void SetHovered(bool is_hovered) = 0; 46 virtual void SetHovered(bool is_hovered) = 0;
45 47
46 // Enables or disables the focus state. 48 // Enables or disables the focus state.
47 virtual void SetFocused(bool is_focused) = 0; 49 virtual void SetFocused(bool is_focused) = 0;
48 50
51 // Returns true if the highlight animation is in the process of fading in or
52 // is visible.
53 virtual bool IsHighlightFadingInOrVisible() const = 0;
54
55 // Methods to add/remove observers for this object.
56 void AddObserver(InkDropObserver* observer);
57 void RemoveObserver(InkDropObserver* observer);
58
49 protected: 59 protected:
50 InkDrop() {} 60 InkDrop();
61
62 const base::ObserverList<InkDropObserver>* observers() const {
63 return &observers_;
64 }
51 65
52 private: 66 private:
67 base::ObserverList<InkDropObserver> observers_;
68
53 DISALLOW_COPY_AND_ASSIGN(InkDrop); 69 DISALLOW_COPY_AND_ASSIGN(InkDrop);
54 }; 70 };
55 71
56 // A View which can be used to parent ink drop layers. Typically this is used 72 // 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 73 // 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 74 // canvas. This is used to avoid ugly text renderings when labels with subpixel
59 // rendering enabled are painted onto a non-opaque canvas. 75 // rendering enabled are painted onto a non-opaque canvas.
60 class VIEWS_EXPORT InkDropContainerView : public views::View { 76 class VIEWS_EXPORT InkDropContainerView : public views::View {
61 public: 77 public:
62 InkDropContainerView(); 78 InkDropContainerView();
63 79
64 void AddInkDropLayer(ui::Layer* ink_drop_layer); 80 void AddInkDropLayer(ui::Layer* ink_drop_layer);
65 void RemoveInkDropLayer(ui::Layer* ink_drop_layer); 81 void RemoveInkDropLayer(ui::Layer* ink_drop_layer);
66 82
67 // View: 83 // View:
68 bool CanProcessEventsWithinSubtree() const override; 84 bool CanProcessEventsWithinSubtree() const override;
69 85
70 private: 86 private:
71 DISALLOW_COPY_AND_ASSIGN(InkDropContainerView); 87 DISALLOW_COPY_AND_ASSIGN(InkDropContainerView);
72 }; 88 };
73 89
74 } // namespace views 90 } // namespace views
75 91
76 #endif // UI_VIEWS_ANIMATION_INK_DROP_H_ 92 #endif // UI_VIEWS_ANIMATION_INK_DROP_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698