OLD | NEW |
---|---|
(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_TOP_CONTROLS_MANAGER_H_ | |
6 #define CC_TOP_CONTROLS_MANAGER_H_ | |
7 | |
8 #include "base/memory/scoped_ptr.h" | |
9 #include "base/memory/weak_ptr.h" | |
10 #include "cc/layer_impl.h" | |
11 #include "ui/gfx/size.h" | |
12 #include "ui/gfx/vector2d_f.h" | |
13 | |
14 namespace base { | |
15 class TimeTicks; | |
16 } | |
17 | |
18 namespace cc { | |
19 | |
20 class LayerTreeImpl; | |
21 class TopControlsAnimation; | |
22 | |
23 class TopControlsDelegate { | |
jamesr
2012/12/19 22:56:29
this should have a protected destructor since it w
Ted C
2012/12/20 00:42:39
Done.
| |
24 public: | |
25 virtual void setNeedsRedraw() = 0; | |
26 virtual void setNeedsUpdateDrawProperties() = 0; | |
27 virtual LayerTreeImpl* activeTree() = 0; | |
28 }; | |
29 | |
30 // Manages the position of the top controls. | |
31 class TopControlsManager { | |
32 public: | |
33 static scoped_ptr<TopControlsManager> Create(TopControlsDelegate* delegate, | |
34 float top_controls_height); | |
35 virtual ~TopControlsManager(); | |
36 | |
37 float controls_top_offset() { return controls_top_offset_; } | |
38 float content_top_offset() { return content_top_offset_; } | |
39 float is_overlay_mode() { return is_overlay_mode_; } | |
40 TopControlsAnimation* animation() { return top_controls_animation_.get(); } | |
41 | |
42 void UpdateDrawPositions(); | |
43 | |
44 void ScrollBegin(); | |
45 gfx::Vector2dF ScrollBy(const gfx::Vector2dF pending_delta); | |
46 void ScrollEnd(); | |
47 | |
48 void Animate(base::TimeTicks monotonic_time); | |
49 | |
50 protected: | |
51 TopControlsManager(TopControlsDelegate* delegate, float top_controls_height); | |
52 | |
53 private: | |
54 gfx::Vector2dF ScrollInternal(const gfx::Vector2dF pending_delta); | |
55 void ResetAnimations(); | |
56 LayerImpl* RootScrollLayer(); | |
57 float RootScrollLayerTotalScrollY(); | |
58 void StartAnimationIfNecessary(); | |
59 void StartAutoHideAnimation(int64 triggered_time); | |
60 | |
61 base::WeakPtrFactory<TopControlsManager> weak_ptr_factory_; | |
62 | |
63 TopControlsDelegate* delegate_; // owned by this. | |
64 | |
jamesr
2012/12/19 22:56:29
I don't think this comment can be right - we never
Ted C
2012/12/20 00:42:39
Yeah...poorly worded. I meant the delegate is the
| |
65 scoped_ptr<TopControlsAnimation> top_controls_animation_; | |
66 bool is_overlay_mode_; | |
67 float controls_top_offset_; | |
68 float content_top_offset_; | |
69 float top_controls_height_; | |
70 int64 top_controls_auto_hide_trigger_time_; | |
71 bool scroll_readjustment_enabled_; | |
72 float previous_root_scroll_offset_; | |
73 | |
74 DISALLOW_COPY_AND_ASSIGN(TopControlsManager); | |
75 }; | |
76 | |
77 } // namespace cc | |
78 | |
79 #endif // CC_TOP_CONTROLS_MANAGER_H_ | |
OLD | NEW |