OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/web_contents/navigation_controller_impl.h" | 5 #include "content/browser/web_contents/navigation_controller_impl.h" |
6 | 6 |
7 #include "base/file_util.h" | 7 #include "base/file_util.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/string_number_conversions.h" // Temporary | 9 #include "base/string_number_conversions.h" // Temporary |
10 #include "base/string_util.h" | 10 #include "base/string_util.h" |
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
235 // And finish the restore. | 235 // And finish the restore. |
236 FinishRestore(selected_navigation, from_last_session); | 236 FinishRestore(selected_navigation, from_last_session); |
237 } | 237 } |
238 | 238 |
239 void NavigationControllerImpl::Reload(bool check_for_repost) { | 239 void NavigationControllerImpl::Reload(bool check_for_repost) { |
240 ReloadInternal(check_for_repost, RELOAD); | 240 ReloadInternal(check_for_repost, RELOAD); |
241 } | 241 } |
242 void NavigationControllerImpl::ReloadIgnoringCache(bool check_for_repost) { | 242 void NavigationControllerImpl::ReloadIgnoringCache(bool check_for_repost) { |
243 ReloadInternal(check_for_repost, RELOAD_IGNORING_CACHE); | 243 ReloadInternal(check_for_repost, RELOAD_IGNORING_CACHE); |
244 } | 244 } |
| 245 void NavigationControllerImpl::ReloadOriginalRequestURL(bool check_for_repost) { |
| 246 ReloadInternal(check_for_repost, RELOAD_ORIGINAL_REQUEST_URL); |
| 247 } |
245 | 248 |
246 void NavigationControllerImpl::ReloadInternal(bool check_for_repost, | 249 void NavigationControllerImpl::ReloadInternal(bool check_for_repost, |
247 ReloadType reload_type) { | 250 ReloadType reload_type) { |
248 // Reloading a transient entry does nothing. | 251 // Reloading a transient entry does nothing. |
249 if (transient_entry_index_ != -1) | 252 if (transient_entry_index_ != -1) |
250 return; | 253 return; |
251 | 254 |
252 DiscardNonCommittedEntriesInternal(); | 255 DiscardNonCommittedEntriesInternal(); |
253 int current_index = GetCurrentEntryIndex(); | 256 int current_index = GetCurrentEntryIndex(); |
254 // If we are no where, then we can't reload. TODO(darin): We should add a | 257 // If we are no where, then we can't reload. TODO(darin): We should add a |
(...skipping 627 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
882 new_entry->SetURL(params.url); | 885 new_entry->SetURL(params.url); |
883 if (update_virtual_url) | 886 if (update_virtual_url) |
884 UpdateVirtualURLToURL(new_entry, params.url); | 887 UpdateVirtualURLToURL(new_entry, params.url); |
885 new_entry->SetReferrer(params.referrer); | 888 new_entry->SetReferrer(params.referrer); |
886 new_entry->SetPageID(params.page_id); | 889 new_entry->SetPageID(params.page_id); |
887 new_entry->SetTransitionType(params.transition); | 890 new_entry->SetTransitionType(params.transition); |
888 new_entry->set_site_instance( | 891 new_entry->set_site_instance( |
889 static_cast<SiteInstanceImpl*>(web_contents_->GetSiteInstance())); | 892 static_cast<SiteInstanceImpl*>(web_contents_->GetSiteInstance())); |
890 new_entry->SetHasPostData(params.is_post); | 893 new_entry->SetHasPostData(params.is_post); |
891 new_entry->SetPostID(params.post_id); | 894 new_entry->SetPostID(params.post_id); |
| 895 new_entry->SetOriginalRequestURL(params.original_request_url); |
892 new_entry->SetIsOverridingUserAgent(params.is_overriding_user_agent); | 896 new_entry->SetIsOverridingUserAgent(params.is_overriding_user_agent); |
893 | 897 |
894 if (params.redirects.size() > 0) | |
895 new_entry->SetOriginalRequestURL(params.redirects[0]); | |
896 else | |
897 new_entry->SetOriginalRequestURL(params.url); | |
898 | |
899 InsertOrReplaceEntry(new_entry, *did_replace_entry); | 898 InsertOrReplaceEntry(new_entry, *did_replace_entry); |
900 } | 899 } |
901 | 900 |
902 void NavigationControllerImpl::RendererDidNavigateToExistingPage( | 901 void NavigationControllerImpl::RendererDidNavigateToExistingPage( |
903 const ViewHostMsg_FrameNavigate_Params& params) { | 902 const ViewHostMsg_FrameNavigate_Params& params) { |
904 // We should only get here for main frame navigations. | 903 // We should only get here for main frame navigations. |
905 DCHECK(content::PageTransitionIsMainFrame(params.transition)); | 904 DCHECK(content::PageTransitionIsMainFrame(params.transition)); |
906 | 905 |
907 // This is a back/forward navigation. The existing page for the ID is | 906 // This is a back/forward navigation. The existing page for the ID is |
908 // guaranteed to exist by ClassifyNavigation, and we just need to update it | 907 // guaranteed to exist by ClassifyNavigation, and we just need to update it |
(...skipping 545 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1454 for (int i = 0; i < max_index; i++) { | 1453 for (int i = 0; i < max_index; i++) { |
1455 // When cloning a tab, copy all entries except interstitial pages | 1454 // When cloning a tab, copy all entries except interstitial pages |
1456 if (source.entries_[i].get()->GetPageType() != | 1455 if (source.entries_[i].get()->GetPageType() != |
1457 content::PAGE_TYPE_INTERSTITIAL) { | 1456 content::PAGE_TYPE_INTERSTITIAL) { |
1458 entries_.insert(entries_.begin() + insert_index++, | 1457 entries_.insert(entries_.begin() + insert_index++, |
1459 linked_ptr<NavigationEntryImpl>( | 1458 linked_ptr<NavigationEntryImpl>( |
1460 new NavigationEntryImpl(*source.entries_[i]))); | 1459 new NavigationEntryImpl(*source.entries_[i]))); |
1461 } | 1460 } |
1462 } | 1461 } |
1463 } | 1462 } |
OLD | NEW |