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

Side by Side Diff: chrome/browser/tab_contents/navigation_controller.cc

Issue 5581010: Merge 68646 - Makes instant run before unload listeners.... (Closed) Base URL: svn://svn.chromium.org/chrome/branches/597/src/
Patch Set: Created 10 years 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/tab_contents/navigation_controller.h" 5 #include "chrome/browser/tab_contents/navigation_controller.h"
6 6
7 #include "base/file_util.h" 7 #include "base/file_util.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/string_util.h" 9 #include "base/string_util.h"
10 #include "base/time.h" 10 #include "base/time.h"
(...skipping 962 matching lines...) Expand 10 before | Expand all | Expand 10 after
973 // There's a transient entry. In this case we want the last committed to 973 // There's a transient entry. In this case we want the last committed to
974 // point to the previous entry. 974 // point to the previous entry.
975 transient_entry_index_ = entry_count() - 1; 975 transient_entry_index_ = entry_count() - 1;
976 if (last_committed_entry_index_ != -1) 976 if (last_committed_entry_index_ != -1)
977 last_committed_entry_index_--; 977 last_committed_entry_index_--;
978 } 978 }
979 979
980 // Take over the session id from source. 980 // Take over the session id from source.
981 session_id_ = source->session_id_; 981 session_id_ = source->session_id_;
982 982
983 // Reset source's session id as we're taking it over. 983 // Reset source's session id as we're taking it over. We give it a new id in
984 source->session_id_.clear(); 984 // case source is added later on, which can happen with instant enabled if the
985 // tab has a before unload handler.
986 source->session_id_ = SessionID();
985 } 987 }
986 988
987 void NavigationController::PruneAllButActive() { 989 void NavigationController::PruneAllButActive() {
988 int prune_count = entry_count(); 990 int prune_count = entry_count();
989 if (transient_entry_index_ != -1) { 991 if (transient_entry_index_ != -1) {
990 // There is a transient entry. Prune up to it. 992 // There is a transient entry. Prune up to it.
991 DCHECK_EQ(entry_count() - 1, transient_entry_index_); 993 DCHECK_EQ(entry_count() - 1, transient_entry_index_);
992 prune_count = transient_entry_index_; 994 prune_count = transient_entry_index_;
993 transient_entry_index_ = 0; 995 transient_entry_index_ = 0;
994 last_committed_entry_index_ = -1; 996 last_committed_entry_index_ = -1;
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after
1200 size_t insert_index = 0; 1202 size_t insert_index = 0;
1201 for (int i = 0; i < max_index; i++) { 1203 for (int i = 0; i < max_index; i++) {
1202 // When cloning a tab, copy all entries except interstitial pages 1204 // When cloning a tab, copy all entries except interstitial pages
1203 if (source.entries_[i].get()->page_type() != INTERSTITIAL_PAGE) { 1205 if (source.entries_[i].get()->page_type() != INTERSTITIAL_PAGE) {
1204 entries_.insert(entries_.begin() + insert_index++, 1206 entries_.insert(entries_.begin() + insert_index++,
1205 linked_ptr<NavigationEntry>( 1207 linked_ptr<NavigationEntry>(
1206 new NavigationEntry(*source.entries_[i]))); 1208 new NavigationEntry(*source.entries_[i])));
1207 } 1209 }
1208 } 1210 }
1209 } 1211 }
OLDNEW
« no previous file with comments | « chrome/browser/tab_contents/navigation_controller.h ('k') | chrome/browser/tab_contents/navigation_controller_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698