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

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

Issue 1214073005: Remove NAVIGATION_TYPE_IN_PAGE. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: didreplace Created 5 years, 5 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/frame_host/navigation_controller_impl.cc
diff --git a/content/browser/frame_host/navigation_controller_impl.cc b/content/browser/frame_host/navigation_controller_impl.cc
index 321aaeac80253402894b3e0a816d83a00f87001c..2229ff0952c79f9f8b9d32bb552f026c7c78cb48 100644
--- a/content/browser/frame_host/navigation_controller_impl.cc
+++ b/content/browser/frame_host/navigation_controller_impl.cc
@@ -860,14 +860,12 @@ bool NavigationControllerImpl::RendererDidNavigate(
RendererDidNavigateToNewPage(rfh, params, details->did_replace_entry);
break;
case NAVIGATION_TYPE_EXISTING_PAGE:
+ details->did_replace_entry = details->is_in_page;
RendererDidNavigateToExistingPage(rfh, params);
break;
case NAVIGATION_TYPE_SAME_PAGE:
RendererDidNavigateToSamePage(rfh, params);
break;
- case NAVIGATION_TYPE_IN_PAGE:
- RendererDidNavigateInPage(rfh, params, &details->did_replace_entry);
- break;
case NAVIGATION_TYPE_NEW_SUBFRAME:
RendererDidNavigateNewSubframe(rfh, params);
break;
@@ -1000,14 +998,9 @@ NavigationType NavigationControllerImpl::ClassifyNavigation(
if (!last_committed)
return NAVIGATION_TYPE_NAV_IGNORE;
- if (IsURLInPageNavigation(params.url, params.was_within_same_page, rfh)) {
- // This is history.replaceState(), which is renderer-initiated yet within
- // the same page.
- return NAVIGATION_TYPE_IN_PAGE;
- } else {
- // This is history.reload() or a client-side redirect.
- return NAVIGATION_TYPE_EXISTING_PAGE;
- }
+ // This is history.replaceState(), history.reload(), or a client-side
+ // redirect.
+ return NAVIGATION_TYPE_EXISTING_PAGE;
}
if (pending_entry_ && pending_entry_index_ == -1 &&
@@ -1046,14 +1039,6 @@ NavigationType NavigationControllerImpl::ClassifyNavigation(
return NAVIGATION_TYPE_NEW_PAGE;
}
- // Any top-level navigations with the same base (minus the reference fragment)
- // are in-page navigations. (We weeded out subframe navigations above.) Most
- // of the time this doesn't matter since Blink doesn't tell us about subframe
- // navigations that don't actually navigate, but it can happen when there is
- // an encoding override (it always sends a navigation request).
- if (IsURLInPageNavigation(params.url, params.was_within_same_page, rfh))
- return NAVIGATION_TYPE_IN_PAGE;
-
// Since we weeded out "new" navigations above, we know this is an existing
// (back/forward) navigation.
return NAVIGATION_TYPE_EXISTING_PAGE;
@@ -1231,49 +1216,6 @@ void NavigationControllerImpl::RendererDidNavigateToSamePage(
DiscardNonCommittedEntries();
}
-void NavigationControllerImpl::RendererDidNavigateInPage(
Charlie Reis 2015/07/07 00:07:15 Wow, this is all handled by RendererDidNavigateToE
Avi (use Gerrit) 2015/07/07 04:38:16 Yes. The only real difference is setting the did_r
- RenderFrameHostImpl* rfh,
- const FrameHostMsg_DidCommitProvisionalLoad_Params& params,
- bool* did_replace_entry) {
- DCHECK(!rfh->GetParent()) <<
- "Blink should only tell us about in-page navs for the main frame.";
-
- NavigationEntryImpl* existing_entry;
- if (params.nav_entry_id) {
- // This is a browser-initiated history navigation across an existing
- // fragment navigation or pushState-created entry.
- existing_entry = GetEntryWithUniqueID(params.nav_entry_id);
- } else {
- // This is renderer-initiated. The only kinds of renderer-initated
- // navigations that are IN_PAGE are history.replaceState, which lands us at
- // the last committed entry.
- existing_entry = GetLastCommittedEntry();
- }
- DCHECK(existing_entry);
-
- // Reference fragment navigation. We're guaranteed to have the last_committed
- // entry and it will be the same page as the new navigation (minus the
- // reference fragments, of course). We'll update the URL of the existing
- // entry without pruning the forward history.
- existing_entry->set_page_type(params.url_is_unreachable ? PAGE_TYPE_ERROR
- : PAGE_TYPE_NORMAL);
- existing_entry->SetURL(params.url);
- if (existing_entry->update_virtual_url_with_url())
- UpdateVirtualURLToURL(existing_entry, params.url);
-
- existing_entry->SetHasPostData(params.is_post);
- existing_entry->SetPostID(params.post_id);
-
- // This replaces the existing entry since the page ID didn't change.
- *did_replace_entry = true;
-
- DiscardNonCommittedEntriesInternal();
-
- // If a transient entry was removed, the indices might have changed, so we
- // have to query the entry index again.
- last_committed_entry_index_ = GetIndexOfEntry(existing_entry);
-}
-
void NavigationControllerImpl::RendererDidNavigateNewSubframe(
RenderFrameHostImpl* rfh,
const FrameHostMsg_DidCommitProvisionalLoad_Params& params) {

Powered by Google App Engine
This is Rietveld 408576698