Making sure we don't take a GestureNav screenshot unless the history position changes.

Only take a screenshot if the page id changes.

Looking at NavigationControllerImpl::ClassifyNavigation(), I think this is the
right check. If we could move the code for taking the screenshot post
controller_->RendererDidNavigate() call, we'd be able to use the NavigationType
calculated in that method, but based on the comments for the screenshot code,
this doesn't seem like a safe thing to do.


BUG=375921

Review URL: https://codereview.chromium.org/316553007

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@275324 0039d316-1c4b-4281-b951-d872f2087c98
parent 8b1682cf
......@@ -426,8 +426,25 @@ void NavigatorImpl::DidNavigate(
// calling RenderFrameHostManager::DidNavigateMainFrame, because that can
// change WebContents::GetRenderViewHost to return the new host, instead
// of the one that may have just been swapped out.
if (delegate_->CanOverscrollContent())
controller_->TakeScreenshot();
if (delegate_->CanOverscrollContent()) {
bool page_id_changed;
bool url_changed;
NavigationEntry* current_entry = controller_->GetLastCommittedEntry();
if (current_entry) {
page_id_changed = params.page_id > 0 &&
params.page_id != current_entry->GetPageID();
url_changed = params.url != current_entry->GetURL();
} else {
page_id_changed = params.page_id > 0;
url_changed = params.url != GURL::EmptyGURL();
}
// We only want to take the screenshot if the are navigating to a
// different history entry than the current one. So if neither the
// page id nor the url changed - don't take the screenshot.
if (page_id_changed || url_changed)
controller_->TakeScreenshot();
}
// Run tasks that must execute just before the commit.
delegate_->DidNavigateMainFramePreCommit(params);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment