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

Unified Diff: chrome/browser/tab_contents/tab_contents.cc

Issue 3655007: Merge 58701 - Relanding this:... (Closed) Base URL: svn://svn.chromium.org/chrome/branches/517/src/
Patch Set: Created 10 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
« no previous file with comments | « chrome/browser/tab_contents/tab_contents.h ('k') | chrome/browser/tab_contents/test_tab_contents.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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) {
« no previous file with comments | « chrome/browser/tab_contents/tab_contents.h ('k') | chrome/browser/tab_contents/test_tab_contents.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698