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

Side by Side Diff: cc/animation/scrollbar_animation_controller.h

Issue 1057283003: Remove parts of //cc we aren't using (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 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
(Empty)
1 // Copyright 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef CC_ANIMATION_SCROLLBAR_ANIMATION_CONTROLLER_H_
6 #define CC_ANIMATION_SCROLLBAR_ANIMATION_CONTROLLER_H_
7
8 #include "base/cancelable_callback.h"
9 #include "base/memory/weak_ptr.h"
10 #include "base/time/time.h"
11 #include "cc/base/cc_export.h"
12 #include "cc/layers/layer_impl.h"
13 #include "ui/gfx/geometry/vector2d_f.h"
14
15 namespace cc {
16
17 class ScrollbarAnimationController;
18
19 class CC_EXPORT ScrollbarAnimationControllerClient {
20 public:
21 virtual void StartAnimatingScrollbarAnimationController(
22 ScrollbarAnimationController* controller) = 0;
23 virtual void StopAnimatingScrollbarAnimationController(
24 ScrollbarAnimationController* controller) = 0;
25 virtual void PostDelayedScrollbarAnimationTask(const base::Closure& task,
26 base::TimeDelta delay) = 0;
27 virtual void SetNeedsRedrawForScrollbarAnimation() = 0;
28
29 protected:
30 virtual ~ScrollbarAnimationControllerClient() {}
31 };
32
33 // This abstract class represents the compositor-side analogy of
34 // ScrollbarAnimator. Individual platforms should subclass it to provide
35 // specialized implementation.
36 class CC_EXPORT ScrollbarAnimationController {
37 public:
38 virtual ~ScrollbarAnimationController();
39
40 void Animate(base::TimeTicks now);
41
42 virtual void DidScrollBegin();
43 virtual void DidScrollUpdate(bool on_resize);
44 virtual void DidScrollEnd();
45 virtual void DidMouseMoveOffScrollbar() {}
46 virtual void DidMouseMoveNear(float distance) {}
47
48 protected:
49 ScrollbarAnimationController(LayerImpl* scroll_layer,
50 ScrollbarAnimationControllerClient* client,
51 base::TimeDelta delay_before_starting,
52 base::TimeDelta resize_delay_before_starting,
53 base::TimeDelta duration);
54
55 virtual void RunAnimationFrame(float progress) = 0;
56
57 void StartAnimation();
58 void StopAnimation();
59
60 LayerImpl* scroll_layer_;
61 ScrollbarAnimationControllerClient* client_;
62
63 private:
64 // Returns how far through the animation we are as a progress value from
65 // 0 to 1.
66 float AnimationProgressAtTime(base::TimeTicks now);
67
68 void PostDelayedAnimationTask(bool on_resize);
69
70 base::TimeTicks last_awaken_time_;
71 base::TimeDelta delay_before_starting_;
72 base::TimeDelta resize_delay_before_starting_;
73 base::TimeDelta duration_;
74
75 bool is_animating_;
76
77 bool currently_scrolling_;
78 bool scroll_gesture_has_scrolled_;
79 base::CancelableClosure delayed_scrollbar_fade_;
80
81 base::WeakPtrFactory<ScrollbarAnimationController> weak_factory_;
82 };
83
84 } // namespace cc
85
86 #endif // CC_ANIMATION_SCROLLBAR_ANIMATION_CONTROLLER_H_
OLDNEW
« no previous file with comments | « cc/animation/scroll_offset_animation_curve_unittest.cc ('k') | cc/animation/scrollbar_animation_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698