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

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

Issue 1309323004: Create a NavigationEntry for the initial blank page. Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix GetEntryCount, more tests Created 5 years, 2 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/navigator_impl.cc
diff --git a/content/browser/frame_host/navigator_impl.cc b/content/browser/frame_host/navigator_impl.cc
index 2e9a114eef9012d0c70904e3f3211b523ec31658..7f801b51991ea0979d49b94fe1fbdf7a9877dc8b 100644
--- a/content/browser/frame_host/navigator_impl.cc
+++ b/content/browser/frame_host/navigator_impl.cc
@@ -331,6 +331,13 @@ bool NavigatorImpl::NavigateToEntry(
if (!is_transfer_to_same) {
navigation_data_.reset(new NavigationMetricsData(navigation_start, dest_url,
entry.restore_type()));
+
+ // The renderer expects the history length to be 0 for the initial page.
+ int history_offset = controller_->IsInitialNavigation() ? -1 :
+ controller_->GetLastCommittedEntryIndex();
+ int history_length = controller_->IsInitialNavigation() ? 0 :
+ controller_->GetEntryCount();
+
// Create the navigation parameters.
FrameMsg_Navigate_Type::Value navigation_type =
GetNavigationType(controller_->GetBrowserContext(), entry, reload_type);
@@ -343,8 +350,7 @@ bool NavigatorImpl::NavigateToEntry(
frame_tree_node->has_committed_real_load(),
controller_->GetPendingEntryIndex() == -1,
controller_->GetIndexOfEntry(&entry),
- controller_->GetLastCommittedEntryIndex(),
- controller_->GetEntryCount()));
+ history_offset, history_length));
} else {
// No need to navigate again. Just resume the deferred request.
dest_render_frame_host->GetProcess()->ResumeDeferredNavigation(
@@ -469,7 +475,9 @@ void NavigatorImpl::DidNavigate(
// Send notification about committed provisional loads. This notification is
// different from the NAV_ENTRY_COMMITTED notification which doesn't include
// the actual URL navigated to and isn't sent for AUTO_SUBFRAME navigations.
- if (details.type != NAVIGATION_TYPE_NAV_IGNORE && delegate_) {
+ // TODO(creis): Do we need to send this for AUTO_SUBFRAME when did_navigate
+ // is false?
+ if (delegate_) {
DCHECK_EQ(!render_frame_host->GetParent(),
did_navigate ? details.is_main_frame : false);
ui::PageTransition transition_type = params.transition;

Powered by Google App Engine
This is Rietveld 408576698