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

Unified Diff: content/browser/web_contents/navigation_controller_impl.cc

Issue 21544005: Take the navigation type into account when checking if the navigation is in page. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Readability. Bringing back removed TC. Created 7 years, 4 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
Index: content/browser/web_contents/navigation_controller_impl.cc
diff --git a/content/browser/web_contents/navigation_controller_impl.cc b/content/browser/web_contents/navigation_controller_impl.cc
index 6176606cbd44d6bbaeb66e9ee368e57bcd2ac80a..82780227243746aa2b34581c595fbd3080e25c0b 100644
--- a/content/browser/web_contents/navigation_controller_impl.cc
+++ b/content/browser/web_contents/navigation_controller_impl.cc
@@ -105,18 +105,15 @@ void ConfigureEntriesForRestore(
// See NavigationController::IsURLInPageNavigation for how this works and why.
bool AreURLsInPageNavigation(const GURL& existing_url,
const GURL& new_url,
- bool renderer_says_in_page) {
+ bool renderer_says_in_page,
+ NavigationType navigation_type) {
if (existing_url == new_url)
return renderer_says_in_page;
if (!new_url.has_ref()) {
- // TODO(jcampan): what about when navigating back from a ref URL to the top
- // non ref URL? Nothing is loaded in that case but we return false here.
- // The user could also navigate from the ref URL to the non ref URL by
- // entering the non ref URL in the location bar or through a bookmark, in
- // which case there would be a load. I am not sure if the non-load/load
- // scenarios can be differentiated with the TransitionType.
Finnur 2013/08/30 11:52:00 Are we sure that nothing meaningful is lost by del
- return false;
+ // When going back from the ref URL to the non ref one the navigation type
+ // is IN_PAGE.
+ return navigation_type == NAVIGATION_TYPE_IN_PAGE;
}
url_canon::Replacements<char> replacements;
@@ -740,13 +737,13 @@ bool NavigationControllerImpl::RendererDidNavigate(
details->did_replace_entry =
pending_entry_ && pending_entry_->should_replace_entry();
- // is_in_page must be computed before the entry gets committed.
- details->is_in_page = IsURLInPageNavigation(
- params.url, params.was_within_same_page);
-
// Do navigation-type specific actions. These will make and commit an entry.
Finnur 2013/08/30 11:52:00 See how the comments on line 747 and 743 were mean
pstanek 2013/08/30 12:01:14 I don't think ClassifyNavigation() commits the ent
details->type = ClassifyNavigation(params);
+ // is_in_page must be computed before the entry gets committed.
+ details->is_in_page = IsURLInPageNavigation(
+ params.url, params.was_within_same_page, details->type);
+
switch (details->type) {
case NAVIGATION_TYPE_NEW_PAGE:
RendererDidNavigateToNewPage(params, details->did_replace_entry);
@@ -956,7 +953,8 @@ NavigationType NavigationControllerImpl::ClassifyNavigation(
// navigations that don't actually navigate, but it can happen when there is
// an encoding override (it always sends a navigation request).
if (AreURLsInPageNavigation(existing_entry->GetURL(), params.url,
- params.was_within_same_page)) {
+ params.was_within_same_page,
+ NAVIGATION_TYPE_UNKNOWN)) {
return NAVIGATION_TYPE_IN_PAGE;
}
@@ -1197,10 +1195,12 @@ int NavigationControllerImpl::GetIndexOfEntry(
}
bool NavigationControllerImpl::IsURLInPageNavigation(
- const GURL& url, bool renderer_says_in_page) const {
+ const GURL& url,
+ bool renderer_says_in_page,
+ NavigationType navigation_type) const {
NavigationEntry* last_committed = GetLastCommittedEntry();
return last_committed && AreURLsInPageNavigation(
- last_committed->GetURL(), url, renderer_says_in_page);
+ last_committed->GetURL(), url, renderer_says_in_page, navigation_type);
}
void NavigationControllerImpl::CopyStateFrom(

Powered by Google App Engine
This is Rietveld 408576698