| 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..2f21d81437f682f6cb334f8d2ac1f39f5a44b217 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,108 @@
|
| #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/base/animation/animation_delegate.h"
|
| +#include "ui/base/animation/slide_animation.h"
|
| +#include "ui/compositor/layer.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 ui::AnimationDelegate {
|
| public:
|
| - ScrollEndEffectControllerAsh();
|
| + explicit ScrollEndEffectControllerAsh(
|
| + ScrollEndEffectControllerDelegate* delegate);
|
| virtual ~ScrollEndEffectControllerAsh();
|
|
|
| - // ScrollEndEffectController overides:
|
| + // ScrollEndEffectController overrides:
|
| virtual void OverscrollUpdate(int delta_y) OVERRIDE;
|
|
|
| + // ui::AnimationDelegate overrides:
|
| + virtual void AnimationEnded(const ui::Animation* animation) OVERRIDE;
|
| + virtual void AnimationProgressed(const ui::Animation* animation) OVERRIDE;
|
| +
|
| private:
|
| + // 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);
|
| +
|
| + // Adjusts the bounds for the layers of interest, so that the scroll end
|
| + // effect appears correctly. It is the responsibility of the caller to save
|
| + // and restore the bounds as needed.
|
| + void SetBoundsForEffect();
|
| +
|
| + int GetDownloadHeight() const;
|
| +
|
| + // For layers not at the origin they need to be translated to/from the origin
|
| + // in the transform for the simple inverse transform to be the correct counter
|
| + // tranformation. This is a utility method encapsulates this operation.
|
| + gfx::Transform CounterTransfromAboutPoint(int x, int y);
|
| +
|
| + ScrollEndEffectControllerDelegate* delegate_; // non-owned
|
| + bool is_effect_active_;
|
| +
|
| + // Layers in scoper_ptr<>s are owned by this class. All other layers are not
|
| + // owned by this class.
|
| + scoped_ptr<ui::Layer> frame_clipping_layer_;
|
| + scoped_ptr<ui::Layer> web_clipping_layer_;
|
| + ui::Layer* frame_layer_;
|
| + ui::Layer* non_client_layer_;
|
| + ui::Layer* web_contents_layer_;
|
| + ui::Layer* devtools_layer_;
|
| + ui::Layer* download_layer_;
|
| +
|
| + // Used to reparent |web_contents_layer_| when deactivating the effect.
|
| + ui::Layer* web_contents_parent_;
|
| +
|
| + // Used to reparent |devtools_layer_| when deactivating the effect.
|
| + ui::Layer* devtools_parent_;
|
| +
|
| + // Saved when the effect is activated, so it can be restored when the
|
| + // effect is deactivated.
|
| + gfx::Rect web_contents_bounds_;
|
| +
|
| + // Saved when the effect is activated, so it can be restored when the
|
| + // effect is deactivated.
|
| + gfx::Rect devtools_bounds_;
|
| +
|
| + // Used to turn off being on a layer when deactivating the effect.
|
| + views::View* non_client_view_; // non-owned
|
| +
|
| + // Used to turn off being on a layer when deactivating the effect.
|
| + views::View* download_view_; // non-owned
|
| +
|
| + // Inverse of the transform that is being applied at the top of the hiearchy
|
| + // for the effect.
|
| + gfx::Transform counter_transform_;
|
| +
|
| + int start_delta_y_;
|
| + int current_delta_y_;
|
| + int end_delta_y_;
|
| +
|
| + scoped_ptr<ui::SlideAnimation> animation_;
|
| +
|
| DISALLOW_COPY_AND_ASSIGN(ScrollEndEffectControllerAsh);
|
| };
|
|
|
|
|