OLD | NEW |
---|---|
(Empty) | |
1 // Copyright (c) 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 CONTENT_BROWSER_ANDROID_OVERSCROLL_GLOW_H_ | |
6 #define CONTENT_BROWSER_ANDROID_OVERSCROLL_GLOW_H_ | |
7 | |
8 #include "base/memory/ref_counted.h" | |
9 #include "base/memory/scoped_ptr.h" | |
10 #include "base/time.h" | |
11 #include "content/browser/android/edge_effect.h" | |
12 #include "ui/gfx/size_f.h" | |
13 #include "ui/gfx/vector2d_f.h" | |
14 | |
15 class SkBitmap; | |
16 | |
17 namespace cc { | |
18 class Layer; | |
19 } | |
20 | |
21 namespace content { | |
22 | |
23 /* |OverscrollGlow| mirrors its Android counterpart, EdgeEffect.java. | |
24 * Conscious tradeoffs were made to align this as closely as possible with the | |
25 * original Android java version. | |
26 */ | |
27 class OverscrollGlow { | |
28 public: | |
29 static scoped_ptr<OverscrollGlow> Create(); | |
30 | |
31 ~OverscrollGlow(); | |
32 | |
33 void OnOverscrolled(base::TimeTicks current_time, | |
34 gfx::Vector2dF overscroll, | |
35 gfx::Vector2dF velocity); | |
36 bool Animate(base::TimeTicks current_time); | |
37 bool IsAnimating() const; | |
38 void Release(base::TimeTicks current_time); | |
39 void Finish(); | |
40 | |
41 void set_horizontal_overscroll_enabled(bool enabled); | |
42 void set_size(const gfx::SizeF& size); | |
aelias_OOO_until_Jul13
2013/04/22 23:46:48
Just gfx::SizeF
jdduke (slow)
2013/04/23 16:02:13
Done.
| |
43 void set_parent_layer(scoped_refptr<cc::Layer> parent_layer); | |
44 | |
45 private: | |
46 enum { EDGE_COUNT = EdgeEffect::EDGE_COUNT }; | |
aelias_OOO_until_Jul13
2013/04/22 23:46:48
Seems unnecessary, please use EdgeEffect::EDGE_COU
jdduke (slow)
2013/04/23 16:02:13
Done.
| |
47 enum Axis { AXIS_X, AXIS_Y }; | |
48 | |
49 OverscrollGlow(const SkBitmap& edge, const SkBitmap& glow); | |
50 | |
51 void Pull(base::TimeTicks current_time, | |
52 const gfx::Vector2dF& added_overscroll); | |
aelias_OOO_until_Jul13
2013/04/22 23:46:48
Just gfx::Vector2dF all through here
jdduke (slow)
2013/04/23 16:02:13
Done.
| |
53 void Absorb(base::TimeTicks current_time, | |
54 const gfx::Vector2dF& velocity, | |
55 const gfx::Vector2dF& overscroll, | |
56 const gfx::Vector2dF& old_overscroll); | |
57 | |
58 void Release(Axis axis, base::TimeTicks current_time); | |
59 | |
60 EdgeEffect* GetOppositeEdge(int edge_index); | |
61 | |
62 scoped_ptr<EdgeEffect> edge_effects_[EDGE_COUNT]; | |
63 | |
64 gfx::SizeF size_; | |
65 gfx::Vector2dF old_overscroll_; | |
66 gfx::Vector2dF old_velocity_; | |
67 bool horizontal_overscroll_enabled_; | |
68 | |
69 scoped_refptr<cc::Layer> parent_layer_; | |
70 | |
71 DISALLOW_COPY_AND_ASSIGN(OverscrollGlow); | |
72 }; | |
73 | |
74 } // namespace content | |
75 | |
76 #endif // CONTENT_BROWSER_ANDROID_SCROLL_GLOW_H_ | |
OLD | NEW |