| Index: cc/top_controls_animation.h
|
| diff --git a/cc/top_controls_animation.h b/cc/top_controls_animation.h
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..dc9c122de01139e6d06897628b6ee7abe9dbaafe
|
| --- /dev/null
|
| +++ b/cc/top_controls_animation.h
|
| @@ -0,0 +1,56 @@
|
| +// Copyright 2012 The Chromium Authors. All rights reserved.
|
| +// Use of this source code is governed by a BSD-style license that can be
|
| +// found in the LICENSE file.
|
| +
|
| +#ifndef CC_TOP_CONTROLS_ANIMATION_H_
|
| +#define CC_TOP_CONTROLS_ANIMATION_H_
|
| +
|
| +#include "base/memory/scoped_ptr.h"
|
| +#include "base/time.h"
|
| +#include "ui/gfx/size.h"
|
| +#include "ui/gfx/vector2d_f.h"
|
| +
|
| +namespace cc {
|
| +
|
| +class TimingFunction;
|
| +
|
| +// A small helper class that does the math for animations pertaining to the
|
| +// position of the top controls.
|
| +//
|
| +// All sizes and vectors in this class's public methods are in the root scroll
|
| +// layer's coordinate space.
|
| +class TopControlsAnimation {
|
| + public:
|
| + // Construct with the state at the beginning of the animation.
|
| + static scoped_ptr<TopControlsAnimation> Create(float start_y_offset,
|
| + float top_controls_height,
|
| + base::TimeTicks start_time,
|
| + base::TimeDelta max_duration);
|
| +
|
| + ~TopControlsAnimation();
|
| +
|
| + void SetDirection(bool showing);
|
| +
|
| + // Call these functions while the animation is in progress to output the
|
| + // current state.
|
| + float ScrollOffsetAtTime(base::TimeTicks time) const;
|
| + bool IsAnimationCompleteAtTime(base::TimeTicks time) const;
|
| +
|
| + protected:
|
| + TopControlsAnimation(float start_y_offset,
|
| + float top_controls_height,
|
| + base::TimeTicks start_time,
|
| + base::TimeDelta max_duration);
|
| +
|
| + private:
|
| + scoped_ptr<TimingFunction> timing_function_;
|
| + const float top_controls_height_;
|
| + const float start_y_offset_;
|
| + const base::TimeTicks start_time_;
|
| + const base::TimeDelta max_duration_;
|
| + int direction_;
|
| +};
|
| +
|
| +} // namespace cc
|
| +
|
| +#endif // CC_TOP_CONTROLS_ANIMATION_H_
|
|
|