| 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 807 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 818 details->is_in_page = IsURLInPageNavigation(params.url, params.origin, | 818 details->is_in_page = IsURLInPageNavigation(params.url, params.origin, |
| 819 params.was_within_same_page, rfh); | 819 params.was_within_same_page, rfh); |
| 820 | 820 |
| 821 switch (details->type) { | 821 switch (details->type) { |
| 822 case NAVIGATION_TYPE_NEW_PAGE: | 822 case NAVIGATION_TYPE_NEW_PAGE: |
| 823 RendererDidNavigateToNewPage(rfh, params, details->is_in_page, | 823 RendererDidNavigateToNewPage(rfh, params, details->is_in_page, |
| 824 details->did_replace_entry); | 824 details->did_replace_entry); |
| 825 break; | 825 break; |
| 826 case NAVIGATION_TYPE_EXISTING_PAGE: | 826 case NAVIGATION_TYPE_EXISTING_PAGE: |
| 827 details->did_replace_entry = details->is_in_page; | 827 details->did_replace_entry = details->is_in_page; |
| 828 RendererDidNavigateToExistingPage(rfh, params); | 828 RendererDidNavigateToExistingPage(rfh, params, details->is_in_page); |
| 829 break; | 829 break; |
| 830 case NAVIGATION_TYPE_SAME_PAGE: | 830 case NAVIGATION_TYPE_SAME_PAGE: |
| 831 RendererDidNavigateToSamePage(rfh, params); | 831 RendererDidNavigateToSamePage(rfh, params); |
| 832 break; | 832 break; |
| 833 case NAVIGATION_TYPE_NEW_SUBFRAME: | 833 case NAVIGATION_TYPE_NEW_SUBFRAME: |
| 834 RendererDidNavigateNewSubframe(rfh, params, details->is_in_page, | 834 RendererDidNavigateNewSubframe(rfh, params, details->is_in_page, |
| 835 details->did_replace_entry); | 835 details->did_replace_entry); |
| 836 break; | 836 break; |
| 837 case NAVIGATION_TYPE_AUTO_SUBFRAME: | 837 case NAVIGATION_TYPE_AUTO_SUBFRAME: |
| 838 if (!RendererDidNavigateAutoSubframe(rfh, params)) { | 838 if (!RendererDidNavigateAutoSubframe(rfh, params)) { |
| (...skipping 324 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1163 DiscardNonCommittedEntriesInternal(); | 1163 DiscardNonCommittedEntriesInternal(); |
| 1164 entries_.clear(); | 1164 entries_.clear(); |
| 1165 last_committed_entry_index_ = -1; | 1165 last_committed_entry_index_ = -1; |
| 1166 } | 1166 } |
| 1167 | 1167 |
| 1168 InsertOrReplaceEntry(std::move(new_entry), replace_entry); | 1168 InsertOrReplaceEntry(std::move(new_entry), replace_entry); |
| 1169 } | 1169 } |
| 1170 | 1170 |
| 1171 void NavigationControllerImpl::RendererDidNavigateToExistingPage( | 1171 void NavigationControllerImpl::RendererDidNavigateToExistingPage( |
| 1172 RenderFrameHostImpl* rfh, | 1172 RenderFrameHostImpl* rfh, |
| 1173 const FrameHostMsg_DidCommitProvisionalLoad_Params& params) { | 1173 const FrameHostMsg_DidCommitProvisionalLoad_Params& params, |
| 1174 bool is_in_page) { |
| 1174 // We should only get here for main frame navigations. | 1175 // We should only get here for main frame navigations. |
| 1175 DCHECK(!rfh->GetParent()); | 1176 DCHECK(!rfh->GetParent()); |
| 1176 | 1177 |
| 1177 // TODO(creis): Classify location.replace as NEW_PAGE instead of EXISTING_PAGE | 1178 // TODO(creis): Classify location.replace as NEW_PAGE instead of EXISTING_PAGE |
| 1178 // in https://crbug.com/596707. | 1179 // in https://crbug.com/596707. |
| 1179 | 1180 |
| 1180 NavigationEntryImpl* entry; | 1181 NavigationEntryImpl* entry; |
| 1182 NavigationHandleImpl* handle = rfh->navigation_handle(); |
| 1181 if (params.intended_as_new_entry) { | 1183 if (params.intended_as_new_entry) { |
| 1182 // This was intended as a new entry but the pending entry was lost in the | 1184 // This was intended as a new entry but the pending entry was lost in the |
| 1183 // meanwhile and no new page was created. We are stuck at the last committed | 1185 // meanwhile and no new page was created. We are stuck at the last committed |
| 1184 // entry. | 1186 // entry. |
| 1185 entry = GetLastCommittedEntry(); | 1187 entry = GetLastCommittedEntry(); |
| 1186 } else if (params.nav_entry_id) { | 1188 } else if (params.nav_entry_id) { |
| 1187 // This is a browser-initiated navigation (back/forward/reload). | 1189 // This is a browser-initiated navigation (back/forward/reload). |
| 1188 entry = GetEntryWithUniqueID(params.nav_entry_id); | 1190 entry = GetEntryWithUniqueID(params.nav_entry_id); |
| 1189 | 1191 |
| 1190 // Needed for the restore case, where the serialized NavigationEntry doesn't | 1192 // Needed for the restore case, where the serialized NavigationEntry doesn't |
| 1191 // have the SSL state. | 1193 // have the SSL state. |
| 1192 NavigationHandleImpl* handle = rfh->navigation_handle(); | |
| 1193 entry->GetSSL() = handle->ssl_status(); | 1194 entry->GetSSL() = handle->ssl_status(); |
| 1194 } else { | 1195 } else { |
| 1195 // This is renderer-initiated. The only kinds of renderer-initated | 1196 // This is renderer-initiated. The only kinds of renderer-initated |
| 1196 // navigations that are EXISTING_PAGE are reloads and location.replace, | 1197 // navigations that are EXISTING_PAGE are reloads and location.replace, |
| 1197 // which land us at the last committed entry. | 1198 // which land us at the last committed entry. |
| 1198 entry = GetLastCommittedEntry(); | 1199 entry = GetLastCommittedEntry(); |
| 1200 |
| 1201 // If this is an in-page navigation, then there's no SSLStatus in the |
| 1202 // NavigationHandle so don't overwrite the existing entry's SSLStatus. |
| 1203 if (!is_in_page) |
| 1204 entry->GetSSL() = handle->ssl_status(); |
| 1199 } | 1205 } |
| 1200 DCHECK(entry); | 1206 DCHECK(entry); |
| 1201 | 1207 |
| 1202 // The URL may have changed due to redirects. | 1208 // The URL may have changed due to redirects. |
| 1203 entry->set_page_type(params.url_is_unreachable ? PAGE_TYPE_ERROR | 1209 entry->set_page_type(params.url_is_unreachable ? PAGE_TYPE_ERROR |
| 1204 : PAGE_TYPE_NORMAL); | 1210 : PAGE_TYPE_NORMAL); |
| 1205 entry->SetURL(params.url); | 1211 entry->SetURL(params.url); |
| 1206 entry->SetReferrer(params.referrer); | 1212 entry->SetReferrer(params.referrer); |
| 1207 if (entry->update_virtual_url_with_url()) | 1213 if (entry->update_virtual_url_with_url()) |
| 1208 UpdateVirtualURLToURL(entry, params.url); | 1214 UpdateVirtualURLToURL(entry, params.url); |
| (...skipping 902 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2111 } | 2117 } |
| 2112 } | 2118 } |
| 2113 } | 2119 } |
| 2114 | 2120 |
| 2115 void NavigationControllerImpl::SetGetTimestampCallbackForTest( | 2121 void NavigationControllerImpl::SetGetTimestampCallbackForTest( |
| 2116 const base::Callback<base::Time()>& get_timestamp_callback) { | 2122 const base::Callback<base::Time()>& get_timestamp_callback) { |
| 2117 get_timestamp_callback_ = get_timestamp_callback; | 2123 get_timestamp_callback_ = get_timestamp_callback; |
| 2118 } | 2124 } |
| 2119 | 2125 |
| 2120 } // namespace content | 2126 } // namespace content |
| OLD | NEW |