MD Downloads: prevent search text from overlapping with the cancel search (X)
[chromium-blink-merge.git] / ui / compositor / layer_animator_collection.h
blobd00fcea66432aa0daf1fd9c9bd742ca21bd5adc4
1 // Copyright 2014 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.
5 #ifndef UI_COMPOSITOR_LAYER_ANIMATOR_COLLECTION_H_
6 #define UI_COMPOSITOR_LAYER_ANIMATOR_COLLECTION_H_
8 #include <set>
10 #include "base/callback.h"
11 #include "base/memory/ref_counted.h"
12 #include "base/time/time.h"
13 #include "ui/compositor/compositor_animation_observer.h"
14 #include "ui/compositor/compositor_export.h"
16 namespace ui {
18 class Compositor;
19 class LayerAnimator;
21 // A collection of LayerAnimators that should be updated at each animation step
22 // in the compositor.
23 class COMPOSITOR_EXPORT LayerAnimatorCollection
24 : public CompositorAnimationObserver {
25 public:
26 explicit LayerAnimatorCollection(Compositor* compositor);
27 ~LayerAnimatorCollection() override;
29 void StartAnimator(scoped_refptr<LayerAnimator> animator);
30 void StopAnimator(scoped_refptr<LayerAnimator> animator);
32 bool HasActiveAnimators() const;
34 base::TimeTicks last_tick_time() const { return last_tick_time_; }
36 // CompositorAnimationObserver:
37 void OnAnimationStep(base::TimeTicks timestamp) override;
38 void OnCompositingShuttingDown(Compositor* compositor) override;
40 private:
41 Compositor* compositor_;
42 base::TimeTicks last_tick_time_;
43 std::set<scoped_refptr<LayerAnimator> > animators_;
45 DISALLOW_COPY_AND_ASSIGN(LayerAnimatorCollection);
48 } // namespace ui
50 #endif // UI_COMPOSITOR_LAYER_ANIMATOR_COLLECTION_H_