Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(706)

Unified Diff: chrome/browser/ui/views/frame/scroll_end_effect_controller_ash.h

Issue 22265009: Implement initial version of scroll end effect Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixed another compile issue :-/ Created 7 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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..e372c63154e04780eac2f76834ac5a4d46a2e51b 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 size of the effect, so that the effect can
sadrul 2013/10/25 18:28:25 'at the beginning/start of the effect'?
rharrison 2013/11/18 21:52:26 Done.
+ // scale relative to that and it 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);
};

Powered by Google App Engine
This is Rietveld 408576698