| 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 #include "content/browser/frame_host/navigation_controller_impl.h" | 5 #include "content/browser/frame_host/navigation_controller_impl.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/debug/trace_event.h" | 8 #include "base/debug/trace_event.h" |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/strings/string_number_conversions.h" // Temporary | 10 #include "base/strings/string_number_conversions.h" // Temporary |
| (...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 301 if (!entry) | 301 if (!entry) |
| 302 return; | 302 return; |
| 303 | 303 |
| 304 if (reload_type == NavigationControllerImpl::RELOAD_ORIGINAL_REQUEST_URL && | 304 if (reload_type == NavigationControllerImpl::RELOAD_ORIGINAL_REQUEST_URL && |
| 305 entry->GetOriginalRequestURL().is_valid() && !entry->GetHasPostData()) { | 305 entry->GetOriginalRequestURL().is_valid() && !entry->GetHasPostData()) { |
| 306 // We may have been redirected when navigating to the current URL. | 306 // We may have been redirected when navigating to the current URL. |
| 307 // Use the URL the user originally intended to visit, if it's valid and if a | 307 // Use the URL the user originally intended to visit, if it's valid and if a |
| 308 // POST wasn't involved; the latter case avoids issues with sending data to | 308 // POST wasn't involved; the latter case avoids issues with sending data to |
| 309 // the wrong page. | 309 // the wrong page. |
| 310 entry->SetURL(entry->GetOriginalRequestURL()); | 310 entry->SetURL(entry->GetOriginalRequestURL()); |
| 311 entry->SetReferrer(Referrer()); |
| 311 } | 312 } |
| 312 | 313 |
| 313 if (g_check_for_repost && check_for_repost && | 314 if (g_check_for_repost && check_for_repost && |
| 314 entry->GetHasPostData()) { | 315 entry->GetHasPostData()) { |
| 315 // The user is asking to reload a page with POST data. Prompt to make sure | 316 // The user is asking to reload a page with POST data. Prompt to make sure |
| 316 // they really want to do this. If they do, the dialog will call us back | 317 // they really want to do this. If they do, the dialog will call us back |
| 317 // with check_for_repost = false. | 318 // with check_for_repost = false. |
| 318 delegate_->NotifyBeforeFormRepostWarningShow(); | 319 delegate_->NotifyBeforeFormRepostWarningShow(); |
| 319 | 320 |
| 320 pending_reload_ = reload_type; | 321 pending_reload_ = reload_type; |
| (...skipping 728 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1049 // guaranteed to exist by ClassifyNavigation, and we just need to update it | 1050 // guaranteed to exist by ClassifyNavigation, and we just need to update it |
| 1050 // with new information from the renderer. | 1051 // with new information from the renderer. |
| 1051 int entry_index = GetEntryIndexWithPageID(rvh->GetSiteInstance(), | 1052 int entry_index = GetEntryIndexWithPageID(rvh->GetSiteInstance(), |
| 1052 params.page_id); | 1053 params.page_id); |
| 1053 DCHECK(entry_index >= 0 && | 1054 DCHECK(entry_index >= 0 && |
| 1054 entry_index < static_cast<int>(entries_.size())); | 1055 entry_index < static_cast<int>(entries_.size())); |
| 1055 NavigationEntryImpl* entry = entries_[entry_index].get(); | 1056 NavigationEntryImpl* entry = entries_[entry_index].get(); |
| 1056 | 1057 |
| 1057 // The URL may have changed due to redirects. | 1058 // The URL may have changed due to redirects. |
| 1058 entry->SetURL(params.url); | 1059 entry->SetURL(params.url); |
| 1060 entry->SetReferrer(params.referrer); |
| 1059 if (entry->update_virtual_url_with_url()) | 1061 if (entry->update_virtual_url_with_url()) |
| 1060 UpdateVirtualURLToURL(entry, params.url); | 1062 UpdateVirtualURLToURL(entry, params.url); |
| 1061 | 1063 |
| 1062 // The redirected to page should not inherit the favicon from the previous | 1064 // The redirected to page should not inherit the favicon from the previous |
| 1063 // page. | 1065 // page. |
| 1064 if (PageTransitionIsRedirect(params.transition)) | 1066 if (PageTransitionIsRedirect(params.transition)) |
| 1065 entry->GetFavicon() = FaviconStatus(); | 1067 entry->GetFavicon() = FaviconStatus(); |
| 1066 | 1068 |
| 1067 // The site instance will normally be the same except during session restore, | 1069 // The site instance will normally be the same except during session restore, |
| 1068 // when no site instance will be assigned. | 1070 // when no site instance will be assigned. |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1102 | 1104 |
| 1103 // We assign the entry's unique ID to be that of the new one. Since this is | 1105 // We assign the entry's unique ID to be that of the new one. Since this is |
| 1104 // always the result of a user action, we want to dismiss infobars, etc. like | 1106 // always the result of a user action, we want to dismiss infobars, etc. like |
| 1105 // a regular user-initiated navigation. | 1107 // a regular user-initiated navigation. |
| 1106 existing_entry->set_unique_id(pending_entry_->GetUniqueID()); | 1108 existing_entry->set_unique_id(pending_entry_->GetUniqueID()); |
| 1107 | 1109 |
| 1108 // The URL may have changed due to redirects. | 1110 // The URL may have changed due to redirects. |
| 1109 if (existing_entry->update_virtual_url_with_url()) | 1111 if (existing_entry->update_virtual_url_with_url()) |
| 1110 UpdateVirtualURLToURL(existing_entry, params.url); | 1112 UpdateVirtualURLToURL(existing_entry, params.url); |
| 1111 existing_entry->SetURL(params.url); | 1113 existing_entry->SetURL(params.url); |
| 1114 existing_entry->SetReferrer(params.referrer); |
| 1112 | 1115 |
| 1113 // The page may have been requested with a different HTTP method. | 1116 // The page may have been requested with a different HTTP method. |
| 1114 existing_entry->SetHasPostData(params.is_post); | 1117 existing_entry->SetHasPostData(params.is_post); |
| 1115 existing_entry->SetPostID(params.post_id); | 1118 existing_entry->SetPostID(params.post_id); |
| 1116 | 1119 |
| 1117 DiscardNonCommittedEntries(); | 1120 DiscardNonCommittedEntries(); |
| 1118 } | 1121 } |
| 1119 | 1122 |
| 1120 void NavigationControllerImpl::RendererDidNavigateInPage( | 1123 void NavigationControllerImpl::RendererDidNavigateInPage( |
| 1121 RenderViewHost* rvh, | 1124 RenderViewHost* rvh, |
| (...skipping 589 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1711 } | 1714 } |
| 1712 } | 1715 } |
| 1713 } | 1716 } |
| 1714 | 1717 |
| 1715 void NavigationControllerImpl::SetGetTimestampCallbackForTest( | 1718 void NavigationControllerImpl::SetGetTimestampCallbackForTest( |
| 1716 const base::Callback<base::Time()>& get_timestamp_callback) { | 1719 const base::Callback<base::Time()>& get_timestamp_callback) { |
| 1717 get_timestamp_callback_ = get_timestamp_callback; | 1720 get_timestamp_callback_ = get_timestamp_callback; |
| 1718 } | 1721 } |
| 1719 | 1722 |
| 1720 } // namespace content | 1723 } // namespace content |
| OLD | NEW |