| Index: chrome/browser/ui/views/frame/scroll_end_effect_controller_ash.h
|
| diff --git a/chrome/browser/ui/views/frame/scroll_end_effect_controller_ash.h b/chrome/browser/ui/views/frame/scroll_end_effect_controller_ash.h
|
| index 9c14e7f08a5eeec902052a6d15d4849901379249..2ab9ed587e161d1b3a0e1ee1f27f8430fcb8c2b8 100644
|
| --- a/chrome/browser/ui/views/frame/scroll_end_effect_controller_ash.h
|
| +++ b/chrome/browser/ui/views/frame/scroll_end_effect_controller_ash.h
|
| @@ -6,17 +6,70 @@
|
| #define CHROME_BROWSER_UI_VIEWS_FRAME_SCROLL_END_EFFECT_CONTROLLER_ASH_H_
|
|
|
| #include "base/compiler_specific.h"
|
| +#include "base/memory/scoped_ptr.h"
|
| #include "chrome/browser/ui/views/frame/scroll_end_effect_controller.h"
|
| +#include "ui/compositor/layer.h"
|
| +#include "ui/gfx/animation/animation_delegate.h"
|
| +#include "ui/gfx/animation/slide_animation.h"
|
| +#include "ui/gfx/rect.h"
|
| +#include "ui/gfx/transform.h"
|
|
|
| -class ScrollEndEffectControllerAsh : public ScrollEndEffectController {
|
| +namespace views {
|
| +class View;
|
| +}
|
| +
|
| +// Class that implements the scroll end effect by controlling the layout of
|
| +// layers and the transforms applied to them. This class depends heavily on
|
| +// ScrollEndEffectControllerDelegate, which is implemented in BrowserView.
|
| +class ScrollEndEffectControllerAsh : public ScrollEndEffectController,
|
| + public gfx::AnimationDelegate {
|
| public:
|
| - ScrollEndEffectControllerAsh();
|
| + explicit ScrollEndEffectControllerAsh(
|
| + ScrollEndEffectControllerDelegate* delegate);
|
| virtual ~ScrollEndEffectControllerAsh();
|
|
|
| - // ScrollEndEffectController overides:
|
| + // ScrollEndEffectController overrides:
|
| virtual void OverscrollUpdate(int delta_y) OVERRIDE;
|
|
|
| + // gfx::AnimationDelegate overrides:
|
| + virtual void AnimationEnded(const gfx::Animation* animation) OVERRIDE;
|
| + virtual void AnimationProgressed(const gfx::Animation* animation) OVERRIDE;
|
| +
|
| private:
|
| + friend class ScrollEndEffectControllerAshTest;
|
| +
|
| + // Sets up the layer hierarchy for showing the effect. This involves making
|
| + // sure everything is on a layer and inserting clipping layers into the
|
| + // hierarchy.
|
| + void ActivateEffect();
|
| +
|
| + // Restores the layer hierarchy and states to what they were before the effect
|
| + // was actived.
|
| + void DeactivateEffect();
|
| +
|
| + // Computes the transforms and counter transforms that are needed to produce
|
| + // the desired effect then applies them. The bounds of the layers may be
|
| + // adjusted due to a call to SetBoundsForEffect, so need to be stored before
|
| + // calling. The entire window is scaled and possibly translated to produce the
|
| + // squishing effect. The non-client area and the content are counter scaled to
|
| + // preserve their size and translated/clipped to fit in the smaller window.
|
| + void ApplyDelta(int delta_y);
|
| +
|
| + ScrollEndEffectControllerDelegate* delegate_; // non-owned
|
| + bool is_effect_active_;
|
| +
|
| + // The size of the frame at the beginning of the effect, so that the effect
|
| + // can scale relative to it and the value can be restored at the end.
|
| + gfx::Rect frame_bounds_;
|
| +
|
| + // Control variables related to the current delta_y being applied for the
|
| + // effect and used when animating.
|
| + int start_delta_y_;
|
| + int current_delta_y_;
|
| + int end_delta_y_;
|
| +
|
| + scoped_ptr<gfx::SlideAnimation> animation_;
|
| +
|
| DISALLOW_COPY_AND_ASSIGN(ScrollEndEffectControllerAsh);
|
| };
|
|
|
|
|