| Index: chrome/browser/tab_contents/tab_contents.cc
|
| ===================================================================
|
| --- chrome/browser/tab_contents/tab_contents.cc (revision 62308)
|
| +++ chrome/browser/tab_contents/tab_contents.cc (working copy)
|
| @@ -227,12 +227,12 @@
|
| return ViewMsg_Navigate_Params::NORMAL;
|
| }
|
|
|
| -void MakeNavigateParams(const NavigationController& controller,
|
| +void MakeNavigateParams(const NavigationEntry& entry,
|
| + const NavigationController& controller,
|
| NavigationController::ReloadType reload_type,
|
| ViewMsg_Navigate_Params* params) {
|
| - const NavigationEntry& entry = *controller.pending_entry();
|
| params->page_id = entry.page_id();
|
| - params->pending_history_list_offset = controller.pending_entry_index();
|
| + params->pending_history_list_offset = controller.GetIndexOfEntry(&entry);
|
| params->current_history_list_offset = controller.last_committed_entry_index();
|
| params->current_history_list_length = controller.entry_count();
|
| params->url = entry.url();
|
| @@ -849,8 +849,12 @@
|
|
|
| bool TabContents::NavigateToPendingEntry(
|
| NavigationController::ReloadType reload_type) {
|
| - const NavigationEntry& entry = *controller_.pending_entry();
|
| + return NavigateToEntry(*controller_.pending_entry(), reload_type);
|
| +}
|
|
|
| +bool TabContents::NavigateToEntry(
|
| + const NavigationEntry& entry,
|
| + NavigationController::ReloadType reload_type) {
|
| RenderViewHost* dest_render_view_host = render_manager_.Navigate(entry);
|
| if (!dest_render_view_host)
|
| return false; // Unable to create the desired render view host.
|
| @@ -882,7 +886,7 @@
|
|
|
| // Navigate in the desired RenderViewHost.
|
| ViewMsg_Navigate_Params navigate_params;
|
| - MakeNavigateParams(controller_, reload_type, &navigate_params);
|
| + MakeNavigateParams(entry, controller_, reload_type, &navigate_params);
|
| dest_render_view_host->Navigate(navigate_params);
|
|
|
| if (entry.page_id() == -1) {
|
| @@ -1994,8 +1998,15 @@
|
| }
|
|
|
| void TabContents::GoToEntryAtOffset(int offset) {
|
| - if (!delegate_ || delegate_->OnGoToEntryOffset(offset))
|
| - controller_.GoToOffset(offset);
|
| + if (!delegate_ || delegate_->OnGoToEntryOffset(offset)) {
|
| + NavigationEntry* entry = controller_.GetEntryAtOffset(offset);
|
| + if (!entry)
|
| + return;
|
| + // Note that we don't call NavigationController::GotToOffset() as we don't
|
| + // want to create a pending navigation entry (it might end up lingering
|
| + // http://crbug.com/51680).
|
| + NavigateToEntry(*entry, NavigationController::NO_RELOAD);
|
| + }
|
| }
|
|
|
| void TabContents::OnMissingPluginStatus(int status) {
|
|
|