| 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 730 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 741 DCHECK(GetLastCommittedEntry()); | 741 DCHECK(GetLastCommittedEntry()); |
| 742 | 742 |
| 743 // Update the FTN ID to use below in case we found a named frame. | 743 // Update the FTN ID to use below in case we found a named frame. |
| 744 frame_tree_node_id = node->frame_tree_node_id(); | 744 frame_tree_node_id = node->frame_tree_node_id(); |
| 745 | 745 |
| 746 // In --site-per-process, create an identical NavigationEntry with a | 746 // In --site-per-process, create an identical NavigationEntry with a |
| 747 // new FrameNavigationEntry for the target subframe. | 747 // new FrameNavigationEntry for the target subframe. |
| 748 if (SiteIsolationPolicy::UseSubframeNavigationEntries()) { | 748 if (SiteIsolationPolicy::UseSubframeNavigationEntries()) { |
| 749 entry = GetLastCommittedEntry()->Clone(); | 749 entry = GetLastCommittedEntry()->Clone(); |
| 750 entry->SetPageID(-1); | 750 entry->SetPageID(-1); |
| 751 entry->AddOrUpdateFrameEntry(node, -1, -1, nullptr, params.url, | 751 entry->AddOrUpdateFrameEntry(node, "", -1, -1, nullptr, params.url, |
| 752 params.referrer, PageState()); | 752 params.referrer, PageState()); |
| 753 } | 753 } |
| 754 } | 754 } |
| 755 } | 755 } |
| 756 | 756 |
| 757 // Otherwise, create a pending entry for the main frame. | 757 // Otherwise, create a pending entry for the main frame. |
| 758 if (!entry) { | 758 if (!entry) { |
| 759 entry = NavigationEntryImpl::FromNavigationEntry(CreateNavigationEntry( | 759 entry = NavigationEntryImpl::FromNavigationEntry(CreateNavigationEntry( |
| 760 params.url, params.referrer, params.transition_type, | 760 params.url, params.referrer, params.transition_type, |
| 761 params.is_renderer_initiated, params.extra_headers, browser_context_)); | 761 params.is_renderer_initiated, params.extra_headers, browser_context_)); |
| (...skipping 355 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1117 new_entry->set_site_instance( | 1117 new_entry->set_site_instance( |
| 1118 static_cast<SiteInstanceImpl*>(rfh->GetSiteInstance())); | 1118 static_cast<SiteInstanceImpl*>(rfh->GetSiteInstance())); |
| 1119 new_entry->SetHasPostData(params.is_post); | 1119 new_entry->SetHasPostData(params.is_post); |
| 1120 new_entry->SetPostID(params.post_id); | 1120 new_entry->SetPostID(params.post_id); |
| 1121 new_entry->SetOriginalRequestURL(params.original_request_url); | 1121 new_entry->SetOriginalRequestURL(params.original_request_url); |
| 1122 new_entry->SetIsOverridingUserAgent(params.is_overriding_user_agent); | 1122 new_entry->SetIsOverridingUserAgent(params.is_overriding_user_agent); |
| 1123 | 1123 |
| 1124 // Update the FrameNavigationEntry for new main frame commits. | 1124 // Update the FrameNavigationEntry for new main frame commits. |
| 1125 FrameNavigationEntry* frame_entry = | 1125 FrameNavigationEntry* frame_entry = |
| 1126 new_entry->GetFrameEntry(rfh->frame_tree_node()); | 1126 new_entry->GetFrameEntry(rfh->frame_tree_node()); |
| 1127 frame_entry->set_frame_unique_name(params.frame_unique_name); |
| 1127 frame_entry->set_item_sequence_number(params.item_sequence_number); | 1128 frame_entry->set_item_sequence_number(params.item_sequence_number); |
| 1128 frame_entry->set_document_sequence_number(params.document_sequence_number); | 1129 frame_entry->set_document_sequence_number(params.document_sequence_number); |
| 1129 | 1130 |
| 1130 // history.pushState() is classified as a navigation to a new page, but | 1131 // history.pushState() is classified as a navigation to a new page, but |
| 1131 // sets was_within_same_page to true. In this case, we already have the | 1132 // sets was_within_same_page to true. In this case, we already have the |
| 1132 // title and favicon available, so set them immediately. | 1133 // title and favicon available, so set them immediately. |
| 1133 if (params.was_within_same_page && GetLastCommittedEntry()) { | 1134 if (params.was_within_same_page && GetLastCommittedEntry()) { |
| 1134 new_entry->SetTitle(GetLastCommittedEntry()->GetTitle()); | 1135 new_entry->SetTitle(GetLastCommittedEntry()->GetTitle()); |
| 1135 new_entry->GetFavicon() = GetLastCommittedEntry()->GetFavicon(); | 1136 new_entry->GetFavicon() = GetLastCommittedEntry()->GetFavicon(); |
| 1136 } | 1137 } |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1252 // can go back or forward to it. The actual subframe information will be | 1253 // can go back or forward to it. The actual subframe information will be |
| 1253 // stored in the page state for each of those entries. This happens out of | 1254 // stored in the page state for each of those entries. This happens out of |
| 1254 // band with the actual navigations. | 1255 // band with the actual navigations. |
| 1255 DCHECK(GetLastCommittedEntry()) << "ClassifyNavigation should guarantee " | 1256 DCHECK(GetLastCommittedEntry()) << "ClassifyNavigation should guarantee " |
| 1256 << "that a last committed entry exists."; | 1257 << "that a last committed entry exists."; |
| 1257 | 1258 |
| 1258 scoped_ptr<NavigationEntryImpl> new_entry; | 1259 scoped_ptr<NavigationEntryImpl> new_entry; |
| 1259 if (SiteIsolationPolicy::UseSubframeNavigationEntries()) { | 1260 if (SiteIsolationPolicy::UseSubframeNavigationEntries()) { |
| 1260 // Make sure new_entry takes ownership of frame_entry in a scoped_refptr. | 1261 // Make sure new_entry takes ownership of frame_entry in a scoped_refptr. |
| 1261 FrameNavigationEntry* frame_entry = new FrameNavigationEntry( | 1262 FrameNavigationEntry* frame_entry = new FrameNavigationEntry( |
| 1262 rfh->frame_tree_node()->frame_tree_node_id(), | 1263 rfh->frame_tree_node()->frame_tree_node_id(), params.frame_unique_name, |
| 1263 params.item_sequence_number, params.document_sequence_number, | 1264 params.item_sequence_number, params.document_sequence_number, |
| 1264 rfh->GetSiteInstance(), params.url, params.referrer); | 1265 rfh->GetSiteInstance(), params.url, params.referrer); |
| 1265 new_entry = GetLastCommittedEntry()->CloneAndReplace(rfh->frame_tree_node(), | 1266 new_entry = GetLastCommittedEntry()->CloneAndReplace(rfh->frame_tree_node(), |
| 1266 frame_entry); | 1267 frame_entry); |
| 1267 | 1268 |
| 1268 // TODO(creis): Make sure the last committed entry always has the subframe | 1269 // TODO(creis): Make sure the last committed entry always has the subframe |
| 1269 // entry to replace, and CHECK(frame_entry->HasOneRef). For now, we might | 1270 // entry to replace, and CHECK(frame_entry->HasOneRef). For now, we might |
| 1270 // not find the entry to replace, and new_entry will be deleted when it goes | 1271 // not find the entry to replace, and new_entry will be deleted when it goes |
| 1271 // out of scope. See https://crbug.com/522193. | 1272 // out of scope. See https://crbug.com/522193. |
| 1272 } else { | 1273 } else { |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1313 DiscardNonCommittedEntriesInternal(); | 1314 DiscardNonCommittedEntriesInternal(); |
| 1314 return true; | 1315 return true; |
| 1315 } | 1316 } |
| 1316 } | 1317 } |
| 1317 | 1318 |
| 1318 if (SiteIsolationPolicy::UseSubframeNavigationEntries()) { | 1319 if (SiteIsolationPolicy::UseSubframeNavigationEntries()) { |
| 1319 // This may be a "new auto" case where we add a new FrameNavigationEntry, or | 1320 // This may be a "new auto" case where we add a new FrameNavigationEntry, or |
| 1320 // it may be a "history auto" case where we update an existing one. | 1321 // it may be a "history auto" case where we update an existing one. |
| 1321 NavigationEntryImpl* last_committed = GetLastCommittedEntry(); | 1322 NavigationEntryImpl* last_committed = GetLastCommittedEntry(); |
| 1322 last_committed->AddOrUpdateFrameEntry( | 1323 last_committed->AddOrUpdateFrameEntry( |
| 1323 rfh->frame_tree_node(), params.item_sequence_number, | 1324 rfh->frame_tree_node(), params.frame_unique_name, |
| 1324 params.document_sequence_number, rfh->GetSiteInstance(), params.url, | 1325 params.item_sequence_number, params.document_sequence_number, |
| 1325 params.referrer, params.page_state); | 1326 rfh->GetSiteInstance(), params.url, params.referrer, params.page_state); |
| 1326 | 1327 |
| 1327 // Cross-process subframe navigations may leave a pending entry around. | 1328 // Cross-process subframe navigations may leave a pending entry around. |
| 1328 // Clear it if it's actually for the subframe. | 1329 // Clear it if it's actually for the subframe. |
| 1329 // TODO(creis): Don't use pending entries for subframe navigations. | 1330 // TODO(creis): Don't use pending entries for subframe navigations. |
| 1330 // See https://crbug.com/495161. | 1331 // See https://crbug.com/495161. |
| 1331 if (pending_entry_ && | 1332 if (pending_entry_ && |
| 1332 pending_entry_->frame_tree_node_id() == | 1333 pending_entry_->frame_tree_node_id() == |
| 1333 rfh->frame_tree_node()->frame_tree_node_id()) { | 1334 rfh->frame_tree_node()->frame_tree_node_id()) { |
| 1334 DiscardPendingEntry(false); | 1335 DiscardPendingEntry(false); |
| 1335 } | 1336 } |
| (...skipping 694 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2030 } | 2031 } |
| 2031 } | 2032 } |
| 2032 } | 2033 } |
| 2033 | 2034 |
| 2034 void NavigationControllerImpl::SetGetTimestampCallbackForTest( | 2035 void NavigationControllerImpl::SetGetTimestampCallbackForTest( |
| 2035 const base::Callback<base::Time()>& get_timestamp_callback) { | 2036 const base::Callback<base::Time()>& get_timestamp_callback) { |
| 2036 get_timestamp_callback_ = get_timestamp_callback; | 2037 get_timestamp_callback_ = get_timestamp_callback; |
| 2037 } | 2038 } |
| 2038 | 2039 |
| 2039 } // namespace content | 2040 } // namespace content |
| OLD | NEW |