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 718 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
729 DCHECK(GetLastCommittedEntry()); | 729 DCHECK(GetLastCommittedEntry()); |
730 | 730 |
731 // Update the FTN ID to use below in case we found a named frame. | 731 // Update the FTN ID to use below in case we found a named frame. |
732 frame_tree_node_id = node->frame_tree_node_id(); | 732 frame_tree_node_id = node->frame_tree_node_id(); |
733 | 733 |
734 // In --site-per-process, create an identical NavigationEntry with a | 734 // In --site-per-process, create an identical NavigationEntry with a |
735 // new FrameNavigationEntry for the target subframe. | 735 // new FrameNavigationEntry for the target subframe. |
736 if (SiteIsolationPolicy::UseSubframeNavigationEntries()) { | 736 if (SiteIsolationPolicy::UseSubframeNavigationEntries()) { |
737 entry = GetLastCommittedEntry()->Clone(); | 737 entry = GetLastCommittedEntry()->Clone(); |
738 entry->SetPageID(-1); | 738 entry->SetPageID(-1); |
739 entry->AddOrUpdateFrameEntry(node, -1, -1, nullptr, params.url, | 739 entry->AddOrUpdateFrameEntry(node, "", -1, -1, nullptr, params.url, |
740 params.referrer, PageState()); | 740 params.referrer, PageState()); |
741 } | 741 } |
742 } | 742 } |
743 } | 743 } |
744 | 744 |
745 // Otherwise, create a pending entry for the main frame. | 745 // Otherwise, create a pending entry for the main frame. |
746 if (!entry) { | 746 if (!entry) { |
747 entry = NavigationEntryImpl::FromNavigationEntry(CreateNavigationEntry( | 747 entry = NavigationEntryImpl::FromNavigationEntry(CreateNavigationEntry( |
748 params.url, params.referrer, params.transition_type, | 748 params.url, params.referrer, params.transition_type, |
749 params.is_renderer_initiated, params.extra_headers, browser_context_)); | 749 params.is_renderer_initiated, params.extra_headers, browser_context_)); |
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
970 | 970 |
971 // Valid subframe navigation. | 971 // Valid subframe navigation. |
972 return NAVIGATION_TYPE_NEW_SUBFRAME; | 972 return NAVIGATION_TYPE_NEW_SUBFRAME; |
973 } | 973 } |
974 | 974 |
975 // Cross-process location.replace navigations should be classified as New with | 975 // Cross-process location.replace navigations should be classified as New with |
976 // replacement rather than ExistingPage, since it is not safe to reuse the | 976 // replacement rather than ExistingPage, since it is not safe to reuse the |
977 // NavigationEntry. | 977 // NavigationEntry. |
978 // TODO(creis): Have the renderer classify location.replace as | 978 // TODO(creis): Have the renderer classify location.replace as |
979 // did_create_new_entry for all cases and eliminate this special case. This | 979 // did_create_new_entry for all cases and eliminate this special case. This |
980 // requires updating several test expectations. See https://crbug.com/596707. | 980 // requires updating several test expectations. See https://crbug.com/317872. |
981 if (!rfh->GetParent() && GetLastCommittedEntry() && | 981 if (!rfh->GetParent() && GetLastCommittedEntry() && |
982 GetLastCommittedEntry()->site_instance() != rfh->GetSiteInstance() && | 982 GetLastCommittedEntry()->site_instance() != rfh->GetSiteInstance() && |
983 params.should_replace_current_entry) { | 983 params.should_replace_current_entry) { |
984 return NAVIGATION_TYPE_NEW_PAGE; | 984 return NAVIGATION_TYPE_NEW_PAGE; |
985 } | 985 } |
986 | 986 |
987 // We only clear the session history when navigating to a new page. | 987 // We only clear the session history when navigating to a new page. |
988 DCHECK(!params.history_list_was_cleared); | 988 DCHECK(!params.history_list_was_cleared); |
989 | 989 |
990 if (rfh->GetParent()) { | 990 if (rfh->GetParent()) { |
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1177 DCHECK(entry); | 1177 DCHECK(entry); |
1178 | 1178 |
1179 // The URL may have changed due to redirects. | 1179 // The URL may have changed due to redirects. |
1180 entry->set_page_type(params.url_is_unreachable ? PAGE_TYPE_ERROR | 1180 entry->set_page_type(params.url_is_unreachable ? PAGE_TYPE_ERROR |
1181 : PAGE_TYPE_NORMAL); | 1181 : PAGE_TYPE_NORMAL); |
1182 entry->SetURL(params.url); | 1182 entry->SetURL(params.url); |
1183 entry->SetReferrer(params.referrer); | 1183 entry->SetReferrer(params.referrer); |
1184 if (entry->update_virtual_url_with_url()) | 1184 if (entry->update_virtual_url_with_url()) |
1185 UpdateVirtualURLToURL(entry, params.url); | 1185 UpdateVirtualURLToURL(entry, params.url); |
1186 | 1186 |
1187 // Update the ISN and DSN in case this was a location.replace, which can cause | |
1188 // them to change. | |
1189 // TODO(creis): Classify location.replace as NEW_PAGE instead of EXISTING_PAGE | |
1190 // in https://crbug.com/596707. | |
1191 FrameNavigationEntry* frame_entry = | |
1192 entry->GetFrameEntry(rfh->frame_tree_node()); | |
1193 frame_entry->set_item_sequence_number(params.item_sequence_number); | |
1194 frame_entry->set_document_sequence_number(params.document_sequence_number); | |
1195 | |
1196 // The redirected to page should not inherit the favicon from the previous | 1187 // The redirected to page should not inherit the favicon from the previous |
1197 // page. | 1188 // page. |
1198 if (ui::PageTransitionIsRedirect(params.transition)) | 1189 if (ui::PageTransitionIsRedirect(params.transition)) |
1199 entry->GetFavicon() = FaviconStatus(); | 1190 entry->GetFavicon() = FaviconStatus(); |
1200 | 1191 |
1201 // The site instance will normally be the same except during session restore, | 1192 // The site instance will normally be the same except during session restore, |
1202 // when no site instance will be assigned. | 1193 // when no site instance will be assigned. |
1203 DCHECK(entry->site_instance() == nullptr || | 1194 DCHECK(entry->site_instance() == nullptr || |
1204 entry->site_instance() == rfh->GetSiteInstance()); | 1195 entry->site_instance() == rfh->GetSiteInstance()); |
1205 entry->set_site_instance( | 1196 entry->set_site_instance( |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1328 DiscardNonCommittedEntriesInternal(); | 1319 DiscardNonCommittedEntriesInternal(); |
1329 return true; | 1320 return true; |
1330 } | 1321 } |
1331 } | 1322 } |
1332 | 1323 |
1333 if (SiteIsolationPolicy::UseSubframeNavigationEntries()) { | 1324 if (SiteIsolationPolicy::UseSubframeNavigationEntries()) { |
1334 // This may be a "new auto" case where we add a new FrameNavigationEntry, or | 1325 // This may be a "new auto" case where we add a new FrameNavigationEntry, or |
1335 // it may be a "history auto" case where we update an existing one. | 1326 // it may be a "history auto" case where we update an existing one. |
1336 NavigationEntryImpl* last_committed = GetLastCommittedEntry(); | 1327 NavigationEntryImpl* last_committed = GetLastCommittedEntry(); |
1337 last_committed->AddOrUpdateFrameEntry( | 1328 last_committed->AddOrUpdateFrameEntry( |
1338 rfh->frame_tree_node(), params.item_sequence_number, | 1329 rfh->frame_tree_node(), params.frame_unique_name, |
1339 params.document_sequence_number, rfh->GetSiteInstance(), params.url, | 1330 params.item_sequence_number, params.document_sequence_number, |
1340 params.referrer, params.page_state); | 1331 rfh->GetSiteInstance(), params.url, params.referrer, params.page_state); |
1341 | 1332 |
1342 // Cross-process subframe navigations may leave a pending entry around. | 1333 // Cross-process subframe navigations may leave a pending entry around. |
1343 // Clear it if it's actually for the subframe. | 1334 // Clear it if it's actually for the subframe. |
1344 // TODO(creis): Don't use pending entries for subframe navigations. | 1335 // TODO(creis): Don't use pending entries for subframe navigations. |
1345 // See https://crbug.com/495161. | 1336 // See https://crbug.com/495161. |
1346 if (pending_entry_ && | 1337 if (pending_entry_ && |
1347 pending_entry_->frame_tree_node_id() == | 1338 pending_entry_->frame_tree_node_id() == |
1348 rfh->frame_tree_node()->frame_tree_node_id()) { | 1339 rfh->frame_tree_node()->frame_tree_node_id()) { |
1349 DiscardPendingEntry(false); | 1340 DiscardPendingEntry(false); |
1350 } | 1341 } |
(...skipping 699 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2050 } | 2041 } |
2051 } | 2042 } |
2052 } | 2043 } |
2053 | 2044 |
2054 void NavigationControllerImpl::SetGetTimestampCallbackForTest( | 2045 void NavigationControllerImpl::SetGetTimestampCallbackForTest( |
2055 const base::Callback<base::Time()>& get_timestamp_callback) { | 2046 const base::Callback<base::Time()>& get_timestamp_callback) { |
2056 get_timestamp_callback_ = get_timestamp_callback; | 2047 get_timestamp_callback_ = get_timestamp_callback; |
2057 } | 2048 } |
2058 | 2049 |
2059 } // namespace content | 2050 } // namespace content |
OLD | NEW |