| 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 c4f05fdc199d2560d08acd5ded513397d745ec17..80229e83c5996cfb75b9dc671af69289dccff867 100644
|
| --- a/content/browser/frame_host/navigation_controller_impl.cc
|
| +++ b/content/browser/frame_host/navigation_controller_impl.cc
|
| @@ -754,6 +754,7 @@ void NavigationControllerImpl::LoadURLWithParams(const LoadURLParams& params) {
|
|
|
| bool NavigationControllerImpl::RendererDidNavigate(
|
| RenderFrameHost* rfh,
|
| + int32 page_id,
|
| const FrameHostMsg_DidCommitProvisionalLoad_Params& params,
|
| LoadCommittedDetails* details) {
|
| is_initial_navigation_ = false;
|
| @@ -781,7 +782,7 @@ bool NavigationControllerImpl::RendererDidNavigate(
|
| pending_entry_ && pending_entry_->should_replace_entry();
|
|
|
| // Do navigation-type specific actions. These will make and commit an entry.
|
| - details->type = ClassifyNavigation(rfh, params);
|
| + details->type = ClassifyNavigation(rfh, page_id, params);
|
|
|
| // is_in_page must be computed before the entry gets committed.
|
| details->is_in_page = AreURLsInPageNavigation(rfh->GetLastCommittedURL(),
|
| @@ -789,22 +790,24 @@ bool NavigationControllerImpl::RendererDidNavigate(
|
|
|
| switch (details->type) {
|
| case NAVIGATION_TYPE_NEW_PAGE:
|
| - RendererDidNavigateToNewPage(rfh, params, details->did_replace_entry);
|
| + RendererDidNavigateToNewPage(rfh, page_id, params,
|
| + details->did_replace_entry);
|
| break;
|
| case NAVIGATION_TYPE_EXISTING_PAGE:
|
| - RendererDidNavigateToExistingPage(rfh, params);
|
| + RendererDidNavigateToExistingPage(rfh, page_id, params);
|
| break;
|
| case NAVIGATION_TYPE_SAME_PAGE:
|
| - RendererDidNavigateToSamePage(rfh, params);
|
| + RendererDidNavigateToSamePage(rfh, page_id, params);
|
| break;
|
| case NAVIGATION_TYPE_IN_PAGE:
|
| - RendererDidNavigateInPage(rfh, params, &details->did_replace_entry);
|
| + RendererDidNavigateInPage(rfh, page_id, params,
|
| + &details->did_replace_entry);
|
| break;
|
| case NAVIGATION_TYPE_NEW_SUBFRAME:
|
| - RendererDidNavigateNewSubframe(rfh, params);
|
| + RendererDidNavigateNewSubframe(rfh, page_id, params);
|
| break;
|
| case NAVIGATION_TYPE_AUTO_SUBFRAME:
|
| - if (!RendererDidNavigateAutoSubframe(rfh, params))
|
| + if (!RendererDidNavigateAutoSubframe(rfh, page_id, params))
|
| return false;
|
| break;
|
| case NAVIGATION_TYPE_NAV_IGNORE:
|
| @@ -881,8 +884,9 @@ bool NavigationControllerImpl::RendererDidNavigate(
|
|
|
| NavigationType NavigationControllerImpl::ClassifyNavigation(
|
| RenderFrameHost* rfh,
|
| + int32 page_id,
|
| const FrameHostMsg_DidCommitProvisionalLoad_Params& params) const {
|
| - if (params.page_id == -1) {
|
| + if (page_id == -1) {
|
| // TODO(nasko, creis): An out-of-process child frame has no way of
|
| // knowing the page_id of its parent, so it is passing back -1. The
|
| // semantics here should be re-evaluated during session history refactor
|
| @@ -913,7 +917,7 @@ NavigationType NavigationControllerImpl::ClassifyNavigation(
|
| return NAVIGATION_TYPE_NAV_IGNORE;
|
| }
|
|
|
| - if (params.page_id > delegate_->GetMaxPageIDForSiteInstance(
|
| + if (page_id > delegate_->GetMaxPageIDForSiteInstance(
|
| rfh->GetSiteInstance())) {
|
| // Greater page IDs than we've ever seen before are new pages. We may or may
|
| // not have a pending entry for the page, and this may or may not be the
|
| @@ -939,7 +943,7 @@ NavigationType NavigationControllerImpl::ClassifyNavigation(
|
| // Now we know that the notification is for an existing page. Find that entry.
|
| int existing_entry_index = GetEntryIndexWithPageID(
|
| rfh->GetSiteInstance(),
|
| - params.page_id);
|
| + page_id);
|
| if (existing_entry_index == -1) {
|
| // The page was not found. It could have been pruned because of the limit on
|
| // back/forward entries (not likely since we'll usually tell it to navigate
|
| @@ -955,7 +959,7 @@ NavigationType NavigationControllerImpl::ClassifyNavigation(
|
| // http://url/foo.html#page1#max3#frame1#ids:2_Nx,1_1x,3_2
|
| std::string temp = params.url.spec();
|
| temp.append("#page");
|
| - temp.append(base::IntToString(params.page_id));
|
| + temp.append(base::IntToString(page_id));
|
| temp.append("#max");
|
| temp.append(base::IntToString(delegate_->GetMaxPageID()));
|
| temp.append("#frame");
|
| @@ -1024,6 +1028,7 @@ NavigationType NavigationControllerImpl::ClassifyNavigation(
|
|
|
| void NavigationControllerImpl::RendererDidNavigateToNewPage(
|
| RenderFrameHost* rfh,
|
| + int32 page_id,
|
| const FrameHostMsg_DidCommitProvisionalLoad_Params& params,
|
| bool replace_entry) {
|
| NavigationEntryImpl* new_entry;
|
| @@ -1064,7 +1069,7 @@ void NavigationControllerImpl::RendererDidNavigateToNewPage(
|
| if (update_virtual_url)
|
| UpdateVirtualURLToURL(new_entry, params.url);
|
| new_entry->SetReferrer(params.referrer);
|
| - new_entry->SetPageID(params.page_id);
|
| + new_entry->SetPageID(page_id);
|
| new_entry->SetTransitionType(params.transition);
|
| new_entry->set_site_instance(
|
| static_cast<SiteInstanceImpl*>(rfh->GetSiteInstance()));
|
| @@ -1096,6 +1101,7 @@ void NavigationControllerImpl::RendererDidNavigateToNewPage(
|
|
|
| void NavigationControllerImpl::RendererDidNavigateToExistingPage(
|
| RenderFrameHost* rfh,
|
| + int32 page_id,
|
| const FrameHostMsg_DidCommitProvisionalLoad_Params& params) {
|
| // We should only get here for main frame navigations.
|
| DCHECK(PageTransitionIsMainFrame(params.transition));
|
| @@ -1103,8 +1109,7 @@ void NavigationControllerImpl::RendererDidNavigateToExistingPage(
|
| // This is a back/forward navigation. The existing page for the ID is
|
| // guaranteed to exist by ClassifyNavigation, and we just need to update it
|
| // with new information from the renderer.
|
| - int entry_index = GetEntryIndexWithPageID(rfh->GetSiteInstance(),
|
| - params.page_id);
|
| + int entry_index = GetEntryIndexWithPageID(rfh->GetSiteInstance(), page_id);
|
| DCHECK(entry_index >= 0 &&
|
| entry_index < static_cast<int>(entries_.size()));
|
| NavigationEntryImpl* entry = entries_[entry_index].get();
|
| @@ -1144,17 +1149,18 @@ void NavigationControllerImpl::RendererDidNavigateToExistingPage(
|
| // If a transient entry was removed, the indices might have changed, so we
|
| // have to query the entry index again.
|
| last_committed_entry_index_ =
|
| - GetEntryIndexWithPageID(rfh->GetSiteInstance(), params.page_id);
|
| + GetEntryIndexWithPageID(rfh->GetSiteInstance(), page_id);
|
| }
|
|
|
| void NavigationControllerImpl::RendererDidNavigateToSamePage(
|
| RenderFrameHost* rfh,
|
| + int32 page_id,
|
| const FrameHostMsg_DidCommitProvisionalLoad_Params& params) {
|
| // This mode implies we have a pending entry that's the same as an existing
|
| // entry for this page ID. This entry is guaranteed to exist by
|
| // ClassifyNavigation. All we need to do is update the existing entry.
|
| NavigationEntryImpl* existing_entry = GetEntryWithPageID(
|
| - rfh->GetSiteInstance(), params.page_id);
|
| + rfh->GetSiteInstance(), page_id);
|
|
|
| // We assign the entry's unique ID to be that of the new one. Since this is
|
| // always the result of a user action, we want to dismiss infobars, etc. like
|
| @@ -1176,13 +1182,14 @@ void NavigationControllerImpl::RendererDidNavigateToSamePage(
|
|
|
| void NavigationControllerImpl::RendererDidNavigateInPage(
|
| RenderFrameHost* rfh,
|
| + int32 page_id,
|
| const FrameHostMsg_DidCommitProvisionalLoad_Params& params,
|
| bool* did_replace_entry) {
|
| DCHECK(PageTransitionIsMainFrame(params.transition)) <<
|
| "WebKit should only tell us about in-page navs for the main frame.";
|
| // We're guaranteed to have an entry for this one.
|
| NavigationEntryImpl* existing_entry = GetEntryWithPageID(
|
| - rfh->GetSiteInstance(), params.page_id);
|
| + rfh->GetSiteInstance(), page_id);
|
|
|
| // 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
|
| @@ -1203,11 +1210,12 @@ void NavigationControllerImpl::RendererDidNavigateInPage(
|
| // If a transient entry was removed, the indices might have changed, so we
|
| // have to query the entry index again.
|
| last_committed_entry_index_ =
|
| - GetEntryIndexWithPageID(rfh->GetSiteInstance(), params.page_id);
|
| + GetEntryIndexWithPageID(rfh->GetSiteInstance(), page_id);
|
| }
|
|
|
| void NavigationControllerImpl::RendererDidNavigateNewSubframe(
|
| RenderFrameHost* rfh,
|
| + int32 page_id,
|
| const FrameHostMsg_DidCommitProvisionalLoad_Params& params) {
|
| if (PageTransitionCoreTypeIs(params.transition,
|
| PAGE_TRANSITION_AUTO_SUBFRAME)) {
|
| @@ -1224,12 +1232,13 @@ void NavigationControllerImpl::RendererDidNavigateNewSubframe(
|
| << "that a last committed entry exists.";
|
| NavigationEntryImpl* new_entry = new NavigationEntryImpl(
|
| *NavigationEntryImpl::FromNavigationEntry(GetLastCommittedEntry()));
|
| - new_entry->SetPageID(params.page_id);
|
| + new_entry->SetPageID(page_id);
|
| InsertOrReplaceEntry(new_entry, false);
|
| }
|
|
|
| bool NavigationControllerImpl::RendererDidNavigateAutoSubframe(
|
| RenderFrameHost* rfh,
|
| + int32 page_id,
|
| const FrameHostMsg_DidCommitProvisionalLoad_Params& params) {
|
| // We're guaranteed to have a previously committed entry, and we now need to
|
| // handle navigation inside of a subframe in it without creating a new entry.
|
| @@ -1238,9 +1247,7 @@ bool NavigationControllerImpl::RendererDidNavigateAutoSubframe(
|
| // Handle the case where we're navigating back/forward to a previous subframe
|
| // navigation entry. This is case "2." in NAV_AUTO_SUBFRAME comment in the
|
| // header file. In case "1." this will be a NOP.
|
| - int entry_index = GetEntryIndexWithPageID(
|
| - rfh->GetSiteInstance(),
|
| - params.page_id);
|
| + int entry_index = GetEntryIndexWithPageID(rfh->GetSiteInstance(), page_id);
|
| if (entry_index < 0 ||
|
| entry_index >= static_cast<int>(entries_.size())) {
|
| NOTREACHED();
|
|
|