Index: content/browser/web_contents/aura/overscroll_navigation_overlay.h |
diff --git a/content/browser/web_contents/aura/overscroll_navigation_overlay.h b/content/browser/web_contents/aura/overscroll_navigation_overlay.h |
index db9871c024981ff908b20bfd9b2ed1baddcc6eaa..b5dacb4b9d1373ecc5838cb7e6acdc868065274f 100644 |
--- a/content/browser/web_contents/aura/overscroll_navigation_overlay.h |
+++ b/content/browser/web_contents/aura/overscroll_navigation_overlay.h |
@@ -7,9 +7,11 @@ |
#include "base/gtest_prod_util.h" |
#include "base/macros.h" |
-#include "content/browser/web_contents/aura/window_slider.h" |
+#include "content/browser/web_contents/aura/overscroll_window_animation.h" |
+#include "content/browser/web_contents/web_contents_view_aura.h" |
#include "content/common/content_export.h" |
#include "content/public/browser/web_contents_observer.h" |
+#include "ui/gfx/image/image.h" |
struct ViewHostMsg_UpdateRect_Params; |
@@ -29,9 +31,11 @@ class OverscrollNavigationOverlayTest; |
// painting. |
class CONTENT_EXPORT OverscrollNavigationOverlay |
: public WebContentsObserver, |
- public WindowSlider::Delegate { |
+ public OverscrollWindowAnimation::Delegate { |
public: |
- explicit OverscrollNavigationOverlay(WebContentsImpl* web_contents); |
+ explicit OverscrollNavigationOverlay(WebContentsImpl* web_contents, |
+ WebContentsViewAura* wcva, |
+ aura::Window* web_contents_window); |
~OverscrollNavigationOverlay() override; |
bool has_window() const { return !!window_.get(); } |
@@ -51,6 +55,15 @@ class CONTENT_EXPORT OverscrollNavigationOverlay |
void SetOverlayWindow(scoped_ptr<aura::Window> window, |
aura_extra::ImageWindowDelegate* delegate); |
+ const gfx::Image GetImageForDirection( |
+ OverscrollWindowAnimation::Direction direction); |
+ |
+ // Creates a layer with a screenshot for a given direction. |
+ scoped_ptr<ui::Layer> CreateLayerForDirection( |
+ OverscrollWindowAnimation::Direction direction); |
+ |
+ OverscrollWindowAnimation::Direction GetNavigationDirection(); |
+ |
private: |
friend class OverscrollNavigationOverlayTest; |
FRIEND_TEST_ALL_PREFIXES(OverscrollNavigationOverlayTest, |
@@ -64,11 +77,8 @@ class CONTENT_EXPORT OverscrollNavigationOverlay |
FRIEND_TEST_ALL_PREFIXES(OverscrollNavigationOverlayTest, |
MultiNavigation_PaintUpdate); |
- enum SlideDirection { |
- SLIDE_UNKNOWN, |
- SLIDE_BACK, |
- SLIDE_FRONT |
- }; |
+ // Fades out the overscroll window and dismisses it. |
+ void FadeOutOverscrollWindow(); |
// Stop observing the page and start the final overlay fade-out animation if |
// a window-slide isn't in progress and either the page has been painted or |
@@ -79,24 +89,38 @@ class CONTENT_EXPORT OverscrollNavigationOverlay |
// NavigationEntry for the screenshot image to display. |
ui::Layer* CreateSlideLayer(int offset); |
- // Overridden from WindowSlider::Delegate: |
- ui::Layer* CreateBackLayer() override; |
- ui::Layer* CreateFrontLayer() override; |
- void OnWindowSlideCompleting() override; |
- void OnWindowSlideCompleted(scoped_ptr<ui::Layer> layer) override; |
- void OnWindowSlideAborted() override; |
- void OnWindowSliderDestroyed() override; |
+ aura::Window* GetWindowToAnimateForOverscroll() const; |
+ |
+ // Overridden from OverscrollWindowAnimation::Delegate: |
+ OverscrollWindowAnimation::Direction |
+ StartNavigation(OverscrollMode mode) override; |
+ |
+ void SetTransform(const gfx::Transform& transform) override; |
+ |
+ ui::LayerAnimator* GetAnimator() override; |
+ |
+ gfx::Rect GetContentsBounds() const override; |
+ |
+ void OnAnimationCompleted() override; |
+ |
+ void OnAnimationCompleting() override; |
// Overridden from WebContentsObserver: |
void DidFirstVisuallyNonEmptyPaint() override; |
void DidStopLoading(RenderViewHost* host) override; |
+ // The current overscroll direction. |
+ OverscrollWindowAnimation::Direction direction_; |
+ |
// The WebContents which is being navigated. |
WebContentsImpl* web_contents_; |
- // The screenshot overlay window. |
+ // The window shown on top of the live window for the animations. |
scoped_ptr<aura::Window> window_; |
+ // Shadow shown under the animated window. |
+ scoped_ptr<ShadowLayerDelegate> shadow_; |
+ |
// This is the WindowDelegate of |window_|. The delegate manages its own |
// lifetime (destroys itself when |window_| is destroyed). |
aura_extra::ImageWindowDelegate* image_delegate_; |
@@ -109,20 +133,21 @@ class CONTENT_EXPORT OverscrollNavigationOverlay |
// when the relevant page loads and paints. |
GURL pending_entry_url_; |
- // The |WindowSlider| that allows sliding history layers while the page is |
- // being reloaded. |
- scoped_ptr<WindowSlider> window_slider_; |
- |
// Layer to be used for the final overlay fadeout animation when the overlay |
// is being dismissed. |
scoped_ptr<ui::Layer> overlay_dismiss_layer_; |
- // The direction of the in-progress slide (if any). |
- SlideDirection slide_direction_; |
- |
// The LayerDelegate used for the back/front layers during a slide. |
scoped_ptr<ImageLayerDelegate> layer_delegate_; |
+ // TODO use a delegate? |
+ WebContentsViewAura* wcva_; |
+ |
+ OverscrollWindowAnimation* owa_; |
+ |
+ // The window that hosts the web contents. |
+ aura::Window* web_contents_window_; |
+ |
DISALLOW_COPY_AND_ASSIGN(OverscrollNavigationOverlay); |
}; |