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

Side by Side Diff: content/browser/frame_host/navigation_controller_impl.cc

Issue 1268453003: Remove GetPendingSiteInstance from NavigationControllerDelegate. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove delegate method Created 5 years, 4 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 unified diff | Download patch
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 /* 5 /*
6 * Copyright (C) 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. 6 * Copyright (C) 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
7 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) 7 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies)
8 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. 8 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved.
9 * (http://www.torchmobile.com/) 9 * (http://www.torchmobile.com/)
10 * 10 *
(...skipping 795 matching lines...) Expand 10 before | Expand all | Expand 10 after
806 806
807 // Save the previous state before we clobber it. 807 // Save the previous state before we clobber it.
808 if (GetLastCommittedEntry()) { 808 if (GetLastCommittedEntry()) {
809 details->previous_url = GetLastCommittedEntry()->GetURL(); 809 details->previous_url = GetLastCommittedEntry()->GetURL();
810 details->previous_entry_index = GetLastCommittedEntryIndex(); 810 details->previous_entry_index = GetLastCommittedEntryIndex();
811 } else { 811 } else {
812 details->previous_url = GURL(); 812 details->previous_url = GURL();
813 details->previous_entry_index = -1; 813 details->previous_entry_index = -1;
814 } 814 }
815 815
816 // If we have a pending entry at this point, it should have a SiteInstance.
817 // Restored entries start out with a null SiteInstance, but we should have
818 // assigned one in NavigateToPendingEntry.
819 DCHECK(pending_entry_index_ == -1 || pending_entry_->site_instance());
Charlie Reis 2015/07/29 23:58:27 I'd prefer not to remove this DCHECK. Can we add
Fabrice (no longer in Chrome) 2015/07/30 15:59:26 Done. I moved the restore_type here too.
820
821 // If we are doing a cross-site reload, we need to replace the existing 816 // If we are doing a cross-site reload, we need to replace the existing
822 // navigation entry, not add another entry to the history. This has the side 817 // navigation entry, not add another entry to the history. This has the side
823 // effect of removing forward browsing history, if such existed. Or if we are 818 // effect of removing forward browsing history, if such existed. Or if we are
824 // doing a cross-site redirect navigation, we will do a similar thing. 819 // doing a cross-site redirect navigation, we will do a similar thing.
825 // 820 //
826 // If this is an error load, we may have already removed the pending entry 821 // If this is an error load, we may have already removed the pending entry
827 // when we got the notice of the load failure. If so, look at the copy of the 822 // when we got the notice of the load failure. If so, look at the copy of the
828 // pending parameters that were saved. 823 // pending parameters that were saved.
829 if (params.url_is_unreachable && failed_pending_entry_id_ != 0) { 824 if (params.url_is_unreachable && failed_pending_entry_id_ != 0) {
830 details->did_replace_entry = failed_pending_entry_should_replace_; 825 details->did_replace_entry = failed_pending_entry_should_replace_;
(...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after
1148 entry->SetURL(params.url); 1143 entry->SetURL(params.url);
1149 entry->SetReferrer(params.referrer); 1144 entry->SetReferrer(params.referrer);
1150 if (entry->update_virtual_url_with_url()) 1145 if (entry->update_virtual_url_with_url())
1151 UpdateVirtualURLToURL(entry, params.url); 1146 UpdateVirtualURLToURL(entry, params.url);
1152 1147
1153 // The redirected to page should not inherit the favicon from the previous 1148 // The redirected to page should not inherit the favicon from the previous
1154 // page. 1149 // page.
1155 if (ui::PageTransitionIsRedirect(params.transition)) 1150 if (ui::PageTransitionIsRedirect(params.transition))
1156 entry->GetFavicon() = FaviconStatus(); 1151 entry->GetFavicon() = FaviconStatus();
1157 1152
1158 // The site instance will normally be the same except during session restore,
1159 // when no site instance will be assigned.
1160 DCHECK(entry->site_instance() == NULL ||
1161 entry->site_instance() == rfh->GetSiteInstance());
Charlie Reis 2015/07/29 23:58:27 This definitely needs to be kept-- a NavigationEnt
Fabrice (no longer in Chrome) 2015/07/30 15:59:26 Done.
1162 entry->set_site_instance( 1153 entry->set_site_instance(
1163 static_cast<SiteInstanceImpl*>(rfh->GetSiteInstance())); 1154 static_cast<SiteInstanceImpl*>(rfh->GetSiteInstance()));
1164 1155
1165 entry->SetHasPostData(params.is_post); 1156 entry->SetHasPostData(params.is_post);
1166 entry->SetPostID(params.post_id); 1157 entry->SetPostID(params.post_id);
1167 1158
1168 // The entry we found in the list might be pending if the user hit 1159 // The entry we found in the list might be pending if the user hit
1169 // back/forward/reload. This load should commit it (since it's already in the 1160 // back/forward/reload. This load should commit it (since it's already in the
1170 // list, we can just discard the pending pointer). We should also discard the 1161 // list, we can just discard the pending pointer). We should also discard the
1171 // pending entry if it corresponds to a different navigation, since that one 1162 // pending entry if it corresponds to a different navigation, since that one
(...skipping 544 matching lines...) Expand 10 before | Expand all | Expand 10 after
1716 } 1707 }
1717 1708
1718 // This call does not support re-entrancy. See http://crbug.com/347742. 1709 // This call does not support re-entrancy. See http://crbug.com/347742.
1719 CHECK(!in_navigate_to_pending_entry_); 1710 CHECK(!in_navigate_to_pending_entry_);
1720 in_navigate_to_pending_entry_ = true; 1711 in_navigate_to_pending_entry_ = true;
1721 bool success = NavigateToPendingEntryInternal(reload_type); 1712 bool success = NavigateToPendingEntryInternal(reload_type);
1722 in_navigate_to_pending_entry_ = false; 1713 in_navigate_to_pending_entry_ = false;
1723 1714
1724 if (!success) 1715 if (!success)
1725 DiscardNonCommittedEntries(); 1716 DiscardNonCommittedEntries();
1726
1727 // If the entry is being restored and doesn't have a SiteInstance yet, fill
1728 // it in now that we know. This allows us to find the entry when it commits.
1729 if (pending_entry_ && !pending_entry_->site_instance() &&
1730 pending_entry_->restore_type() != NavigationEntryImpl::RESTORE_NONE) {
1731 pending_entry_->set_site_instance(static_cast<SiteInstanceImpl*>(
1732 delegate_->GetPendingSiteInstance()));
1733 pending_entry_->set_restore_type(NavigationEntryImpl::RESTORE_NONE);
Charlie Reis 2015/07/29 23:58:27 When will this be cleared? We don't want to leave
Fabrice (no longer in Chrome) 2015/07/30 15:59:26 We are catching it, I just removed the wrong check
1734 }
1735 } 1717 }
1736 1718
1737 bool NavigationControllerImpl::NavigateToPendingEntryInternal( 1719 bool NavigationControllerImpl::NavigateToPendingEntryInternal(
1738 ReloadType reload_type) { 1720 ReloadType reload_type) {
1739 DCHECK(pending_entry_); 1721 DCHECK(pending_entry_);
1740 FrameTreeNode* root = delegate_->GetFrameTree()->root(); 1722 FrameTreeNode* root = delegate_->GetFrameTree()->root();
1741 1723
1742 // In default Chrome, there are no subframe FrameNavigationEntries. Either 1724 // In default Chrome, there are no subframe FrameNavigationEntries. Either
1743 // navigate the main frame or use the main frame's FrameNavigationEntry to 1725 // navigate the main frame or use the main frame's FrameNavigationEntry to
1744 // tell the indicated frame where to go. 1726 // tell the indicated frame where to go.
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after
1979 } 1961 }
1980 } 1962 }
1981 } 1963 }
1982 1964
1983 void NavigationControllerImpl::SetGetTimestampCallbackForTest( 1965 void NavigationControllerImpl::SetGetTimestampCallbackForTest(
1984 const base::Callback<base::Time()>& get_timestamp_callback) { 1966 const base::Callback<base::Time()>& get_timestamp_callback) {
1985 get_timestamp_callback_ = get_timestamp_callback; 1967 get_timestamp_callback_ = get_timestamp_callback;
1986 } 1968 }
1987 1969
1988 } // namespace content 1970 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698