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

Unified Diff: content/browser/frame_host/navigator_impl.cc

Issue 316553007: Making sure we don't take a GestureNav screenshot unless the history position changes. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixing for the case where the navigation is performed by entering the URL into the omnibox. Created 6 years, 6 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/frame_host/navigator_impl.cc
diff --git a/content/browser/frame_host/navigator_impl.cc b/content/browser/frame_host/navigator_impl.cc
index 64d242174b8d8586eb9678d4319e97f86b3d868e..775af00b018973dfb0161e0a996f024b1a9ff76a 100644
--- a/content/browser/frame_host/navigator_impl.cc
+++ b/content/browser/frame_host/navigator_impl.cc
@@ -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);
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698