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

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

Issue 159329: Revert 19923 - Merge r15950.... (Closed) Base URL: svn://chrome-svn/chrome/branches/172/src/
Patch Set: Created 11 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
« no previous file with comments | « chrome/browser/tab_contents/navigation_controller.h ('k') | chrome/test/data/History/HistoryHelper.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/tab_contents/navigation_controller.cc
===================================================================
--- chrome/browser/tab_contents/navigation_controller.cc (revision 21500)
+++ chrome/browser/tab_contents/navigation_controller.cc (working copy)
@@ -735,11 +735,7 @@
new_entry->set_site_instance(active_contents_->GetSiteInstance());
new_entry->set_has_post_data(params.is_post);
- // If the current entry is a redirection source, it needs to be replaced with
- // the new entry to avoid unwanted redirections in navigating backward /
- // forward. Otherwise, just insert the new entry.
- InsertOrReplaceEntry(new_entry,
- PageTransition::IsRedirect(new_entry->transition_type()));
+ InsertEntry(new_entry);
}
void NavigationController::RendererDidNavigateToExistingPage(
@@ -812,7 +808,7 @@
NavigationEntry* new_entry = new NavigationEntry(*existing_entry);
new_entry->set_page_id(params.page_id);
new_entry->set_url(params.url);
- InsertOrReplaceEntry(new_entry, false);
+ InsertEntry(new_entry);
}
void NavigationController::RendererDidNavigateNewSubframe(
@@ -825,7 +821,7 @@
<< "that a last committed entry exists.";
NavigationEntry* new_entry = new NavigationEntry(*GetLastCommittedEntry());
new_entry->set_page_id(params.page_id);
- InsertOrReplaceEntry(new_entry, false);
+ InsertEntry(new_entry);
}
bool NavigationController::RendererDidNavigateAutoSubframe(
@@ -881,15 +877,15 @@
last_committed_entry_index_ = new_entry_index;
} else {
// This is a new navigation. It's easiest to just copy the entry and insert
- // it new again, since InsertOrReplaceEntry expects to take ownership and
- // also discard the pending entry. We also need to synthesize a page ID. We
- // can only do this because this function will only be called by our custom
+ // it new again, since InsertEntry expects to take ownership and also
+ // discard the pending entry. We also need to synthesize a page ID. We can
+ // only do this because this function will only be called by our custom
// TabContents types. For WebContents, the IDs are generated by the
// renderer, so we can't do this.
details.type = NavigationType::NEW_PAGE;
pending_entry_->set_page_id(active_contents_->GetMaxPageID() + 1);
active_contents_->UpdateMaxPageID(pending_entry_->page_id());
- InsertOrReplaceEntry(new NavigationEntry(*pending_entry_), false);
+ InsertEntry(new NavigationEntry(*pending_entry_));
}
// Broadcast the notification of the navigation.
@@ -958,8 +954,7 @@
}
}
-void NavigationController::InsertOrReplaceEntry(NavigationEntry* entry,
- bool replace) {
+void NavigationController::InsertEntry(NavigationEntry* entry) {
DCHECK(entry->transition_type() != PageTransition::AUTO_SUBFRAME);
// Copy the pending entry's unique ID to the committed entry.
@@ -973,13 +968,10 @@
int current_size = static_cast<int>(entries_.size());
+ // Prune any entries which are in front of the current entry.
if (current_size > 0) {
- // Prune any entries which are in front of the current entry.
- // Also prune the current entry if we are to replace the current entry.
- int prune_up_to = replace ? last_committed_entry_index_ - 1
- : last_committed_entry_index_;
int num_pruned = 0;
- while (prune_up_to < (current_size - 1)) {
+ while (last_committed_entry_index_ < (current_size - 1)) {
num_pruned++;
entries_.pop_back();
current_size--;
Property changes on: chrome\browser\tab_contents\navigation_controller.cc
___________________________________________________________________
Modified: svn:mergeinfo
Reverse-merged /trunk/src/chrome/browser/tab_contents/navigation_controller.cc:r14162,14665,15308,15810,15899,15950,16015,16808,18093,18210,18321,18640,18871,19044,19692
« no previous file with comments | « chrome/browser/tab_contents/navigation_controller.h ('k') | chrome/test/data/History/HistoryHelper.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698