Disable accessible touch exploration by default.
[chromium-blink-merge.git] / ui / compositor / layer_animator_collection.cc
blob12142d88827175352af7545b0924940c5ff6eaa4
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 #include "ui/compositor/layer_animator_collection.h"
7 #include <set>
9 #include "base/time/time.h"
10 #include "ui/compositor/layer_animator.h"
11 #include "ui/gfx/frame_time.h"
13 namespace ui {
15 LayerAnimatorCollection::LayerAnimatorCollection(
16 LayerAnimatorCollectionDelegate* delegate)
17 : delegate_(delegate),
18 last_tick_time_(gfx::FrameTime::Now()) {
21 LayerAnimatorCollection::~LayerAnimatorCollection() {
24 void LayerAnimatorCollection::StartAnimator(
25 scoped_refptr<LayerAnimator> animator) {
26 DCHECK_EQ(0U, animators_.count(animator));
27 if (!animators_.size())
28 last_tick_time_ = gfx::FrameTime::Now();
29 animators_.insert(animator);
30 if (delegate_)
31 delegate_->ScheduleAnimationForLayerCollection();
34 void LayerAnimatorCollection::StopAnimator(
35 scoped_refptr<LayerAnimator> animator) {
36 DCHECK_GT(animators_.count(animator), 0U);
37 animators_.erase(animator);
40 bool LayerAnimatorCollection::HasActiveAnimators() const {
41 return !animators_.empty();
44 void LayerAnimatorCollection::Progress(base::TimeTicks now) {
45 last_tick_time_ = now;
46 std::set<scoped_refptr<LayerAnimator> > list = animators_;
47 for (std::set<scoped_refptr<LayerAnimator> >::iterator iter = list.begin();
48 iter != list.end();
49 ++iter) {
50 // Make sure the animator is still valid.
51 if (animators_.count(*iter) > 0)
52 (*iter)->Step(now);
56 } // namespace ui