Index: content/browser/web_contents/aura/overscroll_navigation_overlay.cc |
diff --git a/content/browser/web_contents/aura/overscroll_navigation_overlay.cc b/content/browser/web_contents/aura/overscroll_navigation_overlay.cc |
index 8c47a7b1ff1b50a50540f896722b3aefcf10ca29..a1dce6915cdf3dbc3994580cb84020bb2c020f98 100644 |
--- a/content/browser/web_contents/aura/overscroll_navigation_overlay.cc |
+++ b/content/browser/web_contents/aura/overscroll_navigation_overlay.cc |
@@ -9,6 +9,7 @@ |
#include "content/browser/web_contents/aura/image_window_delegate.h" |
#include "content/browser/web_contents/web_contents_impl.h" |
#include "content/common/view_messages.h" |
+#include "content/public/browser/render_widget_host_view.h" |
#include "ui/aura/window.h" |
#include "ui/compositor/layer.h" |
#include "ui/compositor/layer_animation_observer.h" |
@@ -222,43 +223,32 @@ void OverscrollNavigationOverlay::OnUpdateRect( |
} |
} |
-ui::Layer* OverscrollNavigationOverlay::CreateBackLayer() { |
+ui::Layer* OverscrollNavigationOverlay::OnSlideBackStartedCreateLayer() { |
if (!web_contents_->GetController().CanGoBack()) |
return NULL; |
slide_direction_ = SLIDE_BACK; |
return CreateSlideLayer(-1); |
} |
-ui::Layer* OverscrollNavigationOverlay::CreateFrontLayer() { |
+ui::Layer* OverscrollNavigationOverlay::OnSlideForwardStartedCreateLayer() { |
if (!web_contents_->GetController().CanGoForward()) |
return NULL; |
slide_direction_ = SLIDE_FRONT; |
return CreateSlideLayer(1); |
} |
-void OverscrollNavigationOverlay::OnWindowSlideComplete() { |
- if (slide_direction_ == SLIDE_UNKNOWN) { |
- window_slider_.reset(); |
- StopObservingIfDone(); |
+void OverscrollNavigationOverlay::OnWindowSlideCompleting() { |
+ if (slide_direction_ == SLIDE_UNKNOWN) |
return; |
- } |
- |
- // Change the image used for the overlay window. |
- image_delegate_->SetImage(layer_delegate_->image()); |
- window_->layer()->SetTransform(gfx::Transform()); |
- window_->SchedulePaintInRect(gfx::Rect(window_->bounds().size())); |
- |
- SlideDirection direction = slide_direction_; |
- slide_direction_ = SLIDE_UNKNOWN; |
// Reset state and wait for the new navigation page to complete |
// loading/painting. |
StartObserving(); |
// Perform the navigation. |
- if (direction == SLIDE_BACK) |
+ if (slide_direction_ == SLIDE_BACK) |
web_contents_->GetController().GoBack(); |
- else if (direction == SLIDE_FRONT) |
+ else if (slide_direction_ == SLIDE_FRONT) |
web_contents_->GetController().GoForward(); |
else |
NOTREACHED(); |
@@ -271,6 +261,34 @@ void OverscrollNavigationOverlay::OnWindowSlideComplete() { |
pending_entry_id_ = pending_entry ? pending_entry->GetUniqueID() : 0; |
} |
+void OverscrollNavigationOverlay::OnWindowSlideCompleted() { |
+ if (slide_direction_ == SLIDE_UNKNOWN) { |
+ window_slider_.reset(); |
+ StopObservingIfDone(); |
+ return; |
+ } |
+ |
+ // Change the image used for the overlay window. |
+ image_delegate_->SetImage(layer_delegate_->image()); |
+ window_->layer()->SetTransform(gfx::Transform()); |
+ window_->SchedulePaintInRect(gfx::Rect(window_->bounds().size())); |
+ slide_direction_ = SLIDE_UNKNOWN; |
+ |
+ // Make sure the overlay layer is repainted before we dismiss it, otherwise |
+ // OverlayDismissAnimator may end up showing the wrong screenshot during the |
+ // fadeout animation. |
+ if (received_paint_update_ && need_paint_update_) { |
+ received_paint_update_ = false; |
+ RenderWidgetHost* host = |
+ web_contents_->GetRenderWidgetHostView()->GetRenderWidgetHost(); |
+ RenderViewHostImpl* view_host = |
+ static_cast<RenderViewHostImpl*> (RenderViewHost::From(host)); |
+ view_host->ScheduleComposite(); |
+ } else if (!need_paint_update_) { |
+ StopObservingIfDone(); |
+ } |
+} |
+ |
void OverscrollNavigationOverlay::OnWindowSlideAborted() { |
StopObservingIfDone(); |
} |