Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(293)

Side by Side Diff: content/browser/web_contents/navigation_controller_impl.cc

Issue 10704048: [RDS] Reloads a page using the original request URL (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Rebase fix Created 8 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 225 matching lines...) Expand 10 before | Expand all | Expand 10 after
236 // And finish the restore. 236 // And finish the restore.
237 FinishRestore(selected_navigation, from_last_session); 237 FinishRestore(selected_navigation, from_last_session);
238 } 238 }
239 239
240 void NavigationControllerImpl::Reload(bool check_for_repost) { 240 void NavigationControllerImpl::Reload(bool check_for_repost) {
241 ReloadInternal(check_for_repost, RELOAD); 241 ReloadInternal(check_for_repost, RELOAD);
242 } 242 }
243 void NavigationControllerImpl::ReloadIgnoringCache(bool check_for_repost) { 243 void NavigationControllerImpl::ReloadIgnoringCache(bool check_for_repost) {
244 ReloadInternal(check_for_repost, RELOAD_IGNORING_CACHE); 244 ReloadInternal(check_for_repost, RELOAD_IGNORING_CACHE);
245 } 245 }
246 void NavigationControllerImpl::ReloadOriginalRequestURL(bool check_for_repost) {
247 ReloadInternal(check_for_repost, RELOAD_ORIGINAL_REQUEST_URL);
248 }
246 249
247 void NavigationControllerImpl::ReloadInternal(bool check_for_repost, 250 void NavigationControllerImpl::ReloadInternal(bool check_for_repost,
248 ReloadType reload_type) { 251 ReloadType reload_type) {
249 // Reloading a transient entry does nothing. 252 // Reloading a transient entry does nothing.
250 if (transient_entry_index_ != -1) 253 if (transient_entry_index_ != -1)
251 return; 254 return;
252 255
253 DiscardNonCommittedEntriesInternal(); 256 DiscardNonCommittedEntriesInternal();
254 int current_index = GetCurrentEntryIndex(); 257 int current_index = GetCurrentEntryIndex();
255 // If we are no where, then we can't reload. TODO(darin): We should add a 258 // If we are no where, then we can't reload. TODO(darin): We should add a
(...skipping 688 matching lines...) Expand 10 before | Expand all | Expand 10 after
944 new_entry->SetURL(params.url); 947 new_entry->SetURL(params.url);
945 if (update_virtual_url) 948 if (update_virtual_url)
946 UpdateVirtualURLToURL(new_entry, params.url); 949 UpdateVirtualURLToURL(new_entry, params.url);
947 new_entry->SetReferrer(params.referrer); 950 new_entry->SetReferrer(params.referrer);
948 new_entry->SetPageID(params.page_id); 951 new_entry->SetPageID(params.page_id);
949 new_entry->SetTransitionType(params.transition); 952 new_entry->SetTransitionType(params.transition);
950 new_entry->set_site_instance( 953 new_entry->set_site_instance(
951 static_cast<SiteInstanceImpl*>(web_contents_->GetSiteInstance())); 954 static_cast<SiteInstanceImpl*>(web_contents_->GetSiteInstance()));
952 new_entry->SetHasPostData(params.is_post); 955 new_entry->SetHasPostData(params.is_post);
953 new_entry->SetPostID(params.post_id); 956 new_entry->SetPostID(params.post_id);
957 new_entry->SetOriginalRequestURL(params.original_request_url);
954 new_entry->SetIsOverridingUserAgent(params.is_overriding_user_agent); 958 new_entry->SetIsOverridingUserAgent(params.is_overriding_user_agent);
955 959
956 if (params.redirects.size() > 0)
957 new_entry->SetOriginalRequestURL(params.redirects[0]);
958 else
959 new_entry->SetOriginalRequestURL(params.url);
960
961 InsertOrReplaceEntry(new_entry, *did_replace_entry); 960 InsertOrReplaceEntry(new_entry, *did_replace_entry);
962 } 961 }
963 962
964 void NavigationControllerImpl::RendererDidNavigateToExistingPage( 963 void NavigationControllerImpl::RendererDidNavigateToExistingPage(
965 const ViewHostMsg_FrameNavigate_Params& params) { 964 const ViewHostMsg_FrameNavigate_Params& params) {
966 // We should only get here for main frame navigations. 965 // We should only get here for main frame navigations.
967 DCHECK(content::PageTransitionIsMainFrame(params.transition)); 966 DCHECK(content::PageTransitionIsMainFrame(params.transition));
968 967
969 // This is a back/forward navigation. The existing page for the ID is 968 // This is a back/forward navigation. The existing page for the ID is
970 // guaranteed to exist by ClassifyNavigation, and we just need to update it 969 // guaranteed to exist by ClassifyNavigation, and we just need to update it
(...skipping 545 matching lines...) Expand 10 before | Expand all | Expand 10 after
1516 for (int i = 0; i < max_index; i++) { 1515 for (int i = 0; i < max_index; i++) {
1517 // When cloning a tab, copy all entries except interstitial pages 1516 // When cloning a tab, copy all entries except interstitial pages
1518 if (source.entries_[i].get()->GetPageType() != 1517 if (source.entries_[i].get()->GetPageType() !=
1519 content::PAGE_TYPE_INTERSTITIAL) { 1518 content::PAGE_TYPE_INTERSTITIAL) {
1520 entries_.insert(entries_.begin() + insert_index++, 1519 entries_.insert(entries_.begin() + insert_index++,
1521 linked_ptr<NavigationEntryImpl>( 1520 linked_ptr<NavigationEntryImpl>(
1522 new NavigationEntryImpl(*source.entries_[i]))); 1521 new NavigationEntryImpl(*source.entries_[i])));
1523 } 1522 }
1524 } 1523 }
1525 } 1524 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698