OLD | NEW |
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 Loading... |
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. | 816 // If there is a pending entry at this point, it should have a SiteInstance, |
817 // Restored entries start out with a null SiteInstance, but we should have | 817 // except for restored entries. |
818 // assigned one in NavigateToPendingEntry. | 818 DCHECK(pending_entry_index_ == -1 || |
819 DCHECK(pending_entry_index_ == -1 || pending_entry_->site_instance()); | 819 pending_entry_->site_instance() || |
| 820 pending_entry_->restore_type() != NavigationEntryImpl::RESTORE_NONE); |
| 821 if (pending_entry_ && |
| 822 pending_entry_->restore_type() != NavigationEntryImpl::RESTORE_NONE) |
| 823 pending_entry_->set_restore_type(NavigationEntryImpl::RESTORE_NONE); |
820 | 824 |
821 // If we are doing a cross-site reload, we need to replace the existing | 825 // 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 | 826 // 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 | 827 // 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. | 828 // doing a cross-site redirect navigation, we will do a similar thing. |
825 // | 829 // |
826 // If this is an error load, we may have already removed the pending entry | 830 // 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 | 831 // when we got the notice of the load failure. If so, look at the copy of the |
828 // pending parameters that were saved. | 832 // pending parameters that were saved. |
829 if (params.url_is_unreachable && failed_pending_entry_id_ != 0) { | 833 if (params.url_is_unreachable && failed_pending_entry_id_ != 0) { |
(...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1150 if (entry->update_virtual_url_with_url()) | 1154 if (entry->update_virtual_url_with_url()) |
1151 UpdateVirtualURLToURL(entry, params.url); | 1155 UpdateVirtualURLToURL(entry, params.url); |
1152 | 1156 |
1153 // The redirected to page should not inherit the favicon from the previous | 1157 // The redirected to page should not inherit the favicon from the previous |
1154 // page. | 1158 // page. |
1155 if (ui::PageTransitionIsRedirect(params.transition)) | 1159 if (ui::PageTransitionIsRedirect(params.transition)) |
1156 entry->GetFavicon() = FaviconStatus(); | 1160 entry->GetFavicon() = FaviconStatus(); |
1157 | 1161 |
1158 // The site instance will normally be the same except during session restore, | 1162 // The site instance will normally be the same except during session restore, |
1159 // when no site instance will be assigned. | 1163 // when no site instance will be assigned. |
1160 DCHECK(entry->site_instance() == NULL || | 1164 DCHECK(entry->site_instance() == nullptr || |
1161 entry->site_instance() == rfh->GetSiteInstance()); | 1165 entry->site_instance() == rfh->GetSiteInstance()); |
1162 entry->set_site_instance( | 1166 entry->set_site_instance( |
1163 static_cast<SiteInstanceImpl*>(rfh->GetSiteInstance())); | 1167 static_cast<SiteInstanceImpl*>(rfh->GetSiteInstance())); |
1164 | 1168 |
1165 entry->SetHasPostData(params.is_post); | 1169 entry->SetHasPostData(params.is_post); |
1166 entry->SetPostID(params.post_id); | 1170 entry->SetPostID(params.post_id); |
1167 | 1171 |
1168 // The entry we found in the list might be pending if the user hit | 1172 // 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 | 1173 // 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 | 1174 // list, we can just discard the pending pointer). We should also discard the |
(...skipping 545 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1716 } | 1720 } |
1717 | 1721 |
1718 // This call does not support re-entrancy. See http://crbug.com/347742. | 1722 // This call does not support re-entrancy. See http://crbug.com/347742. |
1719 CHECK(!in_navigate_to_pending_entry_); | 1723 CHECK(!in_navigate_to_pending_entry_); |
1720 in_navigate_to_pending_entry_ = true; | 1724 in_navigate_to_pending_entry_ = true; |
1721 bool success = NavigateToPendingEntryInternal(reload_type); | 1725 bool success = NavigateToPendingEntryInternal(reload_type); |
1722 in_navigate_to_pending_entry_ = false; | 1726 in_navigate_to_pending_entry_ = false; |
1723 | 1727 |
1724 if (!success) | 1728 if (!success) |
1725 DiscardNonCommittedEntries(); | 1729 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); | |
1734 } | |
1735 } | 1730 } |
1736 | 1731 |
1737 bool NavigationControllerImpl::NavigateToPendingEntryInternal( | 1732 bool NavigationControllerImpl::NavigateToPendingEntryInternal( |
1738 ReloadType reload_type) { | 1733 ReloadType reload_type) { |
1739 DCHECK(pending_entry_); | 1734 DCHECK(pending_entry_); |
1740 FrameTreeNode* root = delegate_->GetFrameTree()->root(); | 1735 FrameTreeNode* root = delegate_->GetFrameTree()->root(); |
1741 | 1736 |
1742 // In default Chrome, there are no subframe FrameNavigationEntries. Either | 1737 // In default Chrome, there are no subframe FrameNavigationEntries. Either |
1743 // navigate the main frame or use the main frame's FrameNavigationEntry to | 1738 // navigate the main frame or use the main frame's FrameNavigationEntry to |
1744 // tell the indicated frame where to go. | 1739 // tell the indicated frame where to go. |
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1979 } | 1974 } |
1980 } | 1975 } |
1981 } | 1976 } |
1982 | 1977 |
1983 void NavigationControllerImpl::SetGetTimestampCallbackForTest( | 1978 void NavigationControllerImpl::SetGetTimestampCallbackForTest( |
1984 const base::Callback<base::Time()>& get_timestamp_callback) { | 1979 const base::Callback<base::Time()>& get_timestamp_callback) { |
1985 get_timestamp_callback_ = get_timestamp_callback; | 1980 get_timestamp_callback_ = get_timestamp_callback; |
1986 } | 1981 } |
1987 | 1982 |
1988 } // namespace content | 1983 } // namespace content |
OLD | NEW |