Index: content/browser/frame_host/navigation_entry_impl.cc |
diff --git a/content/browser/frame_host/navigation_entry_impl.cc b/content/browser/frame_host/navigation_entry_impl.cc |
index b021d5eda18cea37a92d27924094752c5b77a5b7..fe96bad6b1b777f56101ac2c8488060159683136 100644 |
--- a/content/browser/frame_host/navigation_entry_impl.cc |
+++ b/content/browser/frame_host/navigation_entry_impl.cc |
@@ -7,6 +7,9 @@ |
#include "base/metrics/histogram.h" |
#include "base/strings/string_util.h" |
#include "base/strings/utf_string_conversions.h" |
+#include "content/browser/frame_host/navigation_controller_impl.h" |
+#include "content/common/frame_messages.h" |
+#include "content/public/browser/browser_context.h" |
#include "content/public/common/content_constants.h" |
#include "content/public/common/url_constants.h" |
#include "net/base/net_util.h" |
@@ -21,6 +24,36 @@ static int GetUniqueIDInConstructor() { |
namespace content { |
+namespace { |
+ |
+FrameMsg_Navigate_Type::Value GetNavigationType( |
+ BrowserContext* browser_context, const NavigationEntryImpl* entry, |
+ NavigationController::ReloadType reload_type) { |
+ switch (reload_type) { |
+ case NavigationControllerImpl::RELOAD: |
+ return FrameMsg_Navigate_Type::RELOAD; |
+ case NavigationControllerImpl::RELOAD_IGNORING_CACHE: |
+ return FrameMsg_Navigate_Type::RELOAD_IGNORING_CACHE; |
+ case NavigationControllerImpl::RELOAD_ORIGINAL_REQUEST_URL: |
+ return FrameMsg_Navigate_Type::RELOAD_ORIGINAL_REQUEST_URL; |
+ case NavigationControllerImpl::NO_RELOAD: |
+ break; // Fall through to rest of function. |
+ } |
+ |
+ // |RenderViewImpl::PopulateStateFromPendingNavigationParams| differentiates |
+ // between |RESTORE_WITH_POST| and |RESTORE|. |
+ if (entry->restore_type() == |
+ NavigationEntryImpl::RESTORE_LAST_SESSION_EXITED_CLEANLY) { |
+ if (entry->GetHasPostData()) |
+ return FrameMsg_Navigate_Type::RESTORE_WITH_POST; |
+ return FrameMsg_Navigate_Type::RESTORE; |
+ } |
+ |
+ return FrameMsg_Navigate_Type::NORMAL; |
+} |
+ |
+} // namespace |
+ |
int NavigationEntryImpl::kInvalidBindings = -1; |
NavigationEntry* NavigationEntry::Create() { |
@@ -356,4 +389,65 @@ void NavigationEntryImpl::SetScreenshotPNGData( |
UMA_HISTOGRAM_MEMORY_KB("Overscroll.ScreenshotSize", screenshot_->size()); |
} |
+void NavigationEntryImpl::MakeNavigateParams( |
+ const NavigationControllerImpl& controller, |
+ NavigationController::ReloadType reload_type, |
+ base::TimeTicks navigation_start, |
+ FrameMsg_Navigate_Params* params) const { |
+ params->page_id = GetPageID(); |
+ params->should_clear_history_list = should_clear_history_list(); |
+ params->should_replace_current_entry = should_replace_entry(); |
+ if (should_clear_history_list()) { |
+ // Set the history list related parameters to the same values a |
+ // NavigationController would return before its first navigation. This will |
+ // fully clear the RenderView's view of the session history. |
+ params->pending_history_list_offset = -1; |
+ params->current_history_list_offset = -1; |
+ params->current_history_list_length = 0; |
+ } else { |
+ params->pending_history_list_offset = controller.GetIndexOfEntry(this); |
+ params->current_history_list_offset = |
+ controller.GetLastCommittedEntryIndex(); |
+ params->current_history_list_length = controller.GetEntryCount(); |
+ } |
+ params->url = GetURL(); |
+ if (!GetBaseURLForDataURL().is_empty()) { |
+ params->base_url_for_data_url = GetBaseURLForDataURL(); |
+ params->history_url_for_data_url = GetVirtualURL(); |
+ } |
+ params->referrer = GetReferrer(); |
+ params->transition = GetTransitionType(); |
+ params->page_state = GetPageState(); |
+ params->navigation_type = |
+ GetNavigationType(controller.GetBrowserContext(), this, reload_type); |
+ params->request_time = base::Time::Now(); |
+ params->extra_headers = extra_headers(); |
+ params->transferred_request_child_id = |
+ transferred_global_request_id().child_id; |
+ params->transferred_request_request_id = |
+ transferred_global_request_id().request_id; |
+ params->is_overriding_user_agent = GetIsOverridingUserAgent(); |
+ // Avoid downloading when in view-source mode. |
+ params->allow_download = !IsViewSourceMode(); |
+ params->is_post = GetHasPostData(); |
+ if (GetBrowserInitiatedPostData()) { |
+ params->browser_initiated_post_data.assign( |
+ GetBrowserInitiatedPostData()->front(), |
+ GetBrowserInitiatedPostData()->front() + |
+ GetBrowserInitiatedPostData()->size()); |
+ } |
+ |
+ // Set the redirect chain to the navigation's redirects, unless we are |
+ // returning to a completed navigation (whose previous redirects don't apply). |
+ if (PageTransitionIsNewNavigation(params->transition)) { |
+ params->redirects = GetRedirectChain(); |
+ } else { |
+ params->redirects.clear(); |
+ } |
+ |
+ params->can_load_local_resources = GetCanLoadLocalResources(); |
+ params->frame_to_navigate = GetFrameToNavigate(); |
+ params->browser_navigation_start = navigation_start; |
+} |
+ |
} // namespace content |