// Make sure the overlay window is on top.
if (window_.get() && window_->parent())
window_->parent()->StackChildAtTop(window_.get());
+
+ // Assumes the navigation has been initiated.
+ NavigationEntry* pending_entry =
+ web_contents_->GetController().GetPendingEntry();
+ // Save id of the pending entry to identify when it loads and paints later.
+ // Under some circumstances navigation can leave a null pending entry -
+ // see comments in NavigationControllerImpl::NavigateToPendingEntry().
+ pending_entry_id_ = pending_entry ? pending_entry->GetUniqueID() : 0;
}
void OverscrollNavigationOverlay::SetOverlayWindow(
}
void OverscrollNavigationOverlay::StopObservingIfDone() {
- // If there is a screenshot displayed in the overlay window, then wait for
- // the navigated page to complete loading and some paint update before
- // hiding the overlay.
- // If there is no screenshot in the overlay window, then hide this view
- // as soon as there is any new painting notification.
- if ((need_paint_update_ && !received_paint_update_) ||
- (image_delegate_->has_image() && !loading_complete_)) {
+ if ((need_paint_update_ && !received_paint_update_)) {
return;
}
return;
scoped_ptr<ui::Layer> layer;
- if (window_.get()) {
- layer.reset(window_->AcquireLayer());
- }
+ if (window_.get())
+ layer = window_->AcquireLayer();
Observe(NULL);
window_slider_.reset();
window_.reset();
if (slide_direction_ == SLIDE_UNKNOWN)
return;
- // Reset state and wait for the new navigation page to complete
- // loading/painting.
- StartObserving();
-
// Perform the navigation.
if (slide_direction_ == SLIDE_BACK)
web_contents_->GetController().GoBack();
else
NOTREACHED();
- NavigationEntry* pending_entry =
- web_contents_->GetController().GetPendingEntry();
- // Save id of the pending entry to identify when it loads and paints later.
- // Under some circumstances navigation can leave a null pending entry -
- // see comments in NavigationControllerImpl::NavigateToPendingEntry().
- pending_entry_id_ = pending_entry ? pending_entry->GetUniqueID() : 0;
+ // Reset state and wait for the new navigation page to complete
+ // loading/painting.
+ StartObserving();
}
void OverscrollNavigationOverlay::OnWindowSlideCompleted() {
}
}
-void OverscrollNavigationOverlay::DocumentOnLoadCompletedInMainFrame(
- int32 page_id) {
+void OverscrollNavigationOverlay::DocumentOnLoadCompletedInMainFrame() {
// Use the last committed entry rather than the active one, in case a
// pending entry has been created.
int committed_entry_id =
web_contents_->GetController().GetLastCommittedEntry()->GetUniqueID();
- // For the purposes of dismissing the overlay - consider the loading completed
- // once the main frame has loaded.
+ // Consider the loading completed once the main frame has loaded.
if (committed_entry_id == pending_entry_id_ || !pending_entry_id_) {
loading_complete_ = true;
StopObservingIfDone();
}
}
-void OverscrollNavigationOverlay::DidFirstVisuallyNonEmptyPaint(int32 page_id) {
+void OverscrollNavigationOverlay::DidFirstVisuallyNonEmptyPaint() {
int visible_entry_id =
web_contents_->GetController().GetVisibleEntry()->GetUniqueID();
if (visible_entry_id == pending_entry_id_ || !pending_entry_id_) {
web_contents_->GetController().GetLastCommittedEntry()->GetUniqueID();
if (committed_entry_id == pending_entry_id_ || !pending_entry_id_) {
loading_complete_ = true;
- if (!received_paint_update_) {
+ if (!received_paint_update_ && need_paint_update_) {
// Force a repaint after the page is loaded.
RenderViewHostImpl* view = static_cast<RenderViewHostImpl*>(host);
view->ScheduleComposite();