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 c7a84de7ff38c08f8db23c1c33af7a462c4c7cd5..82b97f9ec21639f5e01fb1706b3a37a6b6557890 100644 |
--- a/content/browser/frame_host/navigation_entry_impl.cc |
+++ b/content/browser/frame_host/navigation_entry_impl.cc |
@@ -7,7 +7,6 @@ |
#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/navigation_params.h" |
#include "content/public/common/content_constants.h" |
#include "content/public/common/url_constants.h" |
@@ -387,38 +386,6 @@ NavigationEntryImpl* NavigationEntryImpl::Clone() const { |
return copy; |
} |
-void NavigationEntryImpl::ResetForCommit() { |
- // Any state that only matters when a navigation entry is pending should be |
- // cleared here. |
- // TODO(creis): This state should be moved to NavigationRequest once |
- // PlzNavigate is enabled. |
- SetBrowserInitiatedPostData(nullptr); |
- set_source_site_instance(nullptr); |
- set_is_renderer_initiated(false); |
- set_transferred_global_request_id(GlobalRequestID()); |
- set_should_replace_entry(false); |
- |
- set_should_clear_history_list(false); |
- set_frame_tree_node_id(-1); |
- |
-#if defined(OS_ANDROID) |
- // Reset the time stamp so that the metrics are not reported if this entry is |
- // loaded again in the future. |
- set_intent_received_timestamp(base::TimeTicks()); |
-#endif |
-} |
- |
-void NavigationEntryImpl::SetScreenshotPNGData( |
- scoped_refptr<base::RefCountedBytes> png_data) { |
- screenshot_ = png_data; |
- if (screenshot_.get()) |
- UMA_HISTOGRAM_MEMORY_KB("Overscroll.ScreenshotSize", screenshot_->size()); |
-} |
- |
-GURL NavigationEntryImpl::GetHistoryURLForDataURL() const { |
- return GetBaseURLForDataURL().is_empty() ? GURL() : GetVirtualURL(); |
-} |
- |
CommonNavigationParams NavigationEntryImpl::ConstructCommonNavigationParams( |
FrameMsg_Navigate_Type::Value navigation_type) const { |
FrameMsg_UILoadMetricsReportType::Value report_type = |
@@ -436,8 +403,27 @@ CommonNavigationParams NavigationEntryImpl::ConstructCommonNavigationParams( |
GetHistoryURLForDataURL()); |
} |
-CommitNavigationParams NavigationEntryImpl::ConstructCommitNavigationParams( |
- base::TimeTicks navigation_start) const { |
+StartNavigationParams NavigationEntryImpl::ConstructStartNavigationParams() |
+ const { |
+ std::vector<unsigned char> browser_initiated_post_data; |
+ if (GetBrowserInitiatedPostData()) { |
+ browser_initiated_post_data.assign( |
+ GetBrowserInitiatedPostData()->front(), |
+ GetBrowserInitiatedPostData()->front() + |
+ GetBrowserInitiatedPostData()->size()); |
+ } |
+ |
+ return StartNavigationParams( |
+ GetHasPostData(), extra_headers(), browser_initiated_post_data, |
+ should_replace_entry(), transferred_global_request_id().child_id, |
+ transferred_global_request_id().request_id); |
+} |
+ |
+RequestNavigationParams NavigationEntryImpl::ConstructRequestNavigationParams( |
+ base::TimeTicks navigation_start, |
+ int pending_history_list_offset, |
+ int current_history_list_offset, |
+ int current_history_list_length) const { |
// Set the redirect chain to the navigation's redirects, unless returning to a |
// completed navigation (whose previous redirects don't apply). |
std::vector<GURL> redirects; |
@@ -445,44 +431,55 @@ CommitNavigationParams NavigationEntryImpl::ConstructCommitNavigationParams( |
redirects = GetRedirectChain(); |
} |
- return CommitNavigationParams(GetIsOverridingUserAgent(), navigation_start, |
- redirects, GetCanLoadLocalResources(), |
- GetFrameToNavigate(), base::Time::Now()); |
-} |
- |
-HistoryNavigationParams NavigationEntryImpl::ConstructHistoryNavigationParams( |
- NavigationControllerImpl* controller) const { |
- int pending_history_list_offset = controller->GetIndexOfEntry(this); |
- int current_history_list_offset = controller->GetLastCommittedEntryIndex(); |
- int current_history_list_length = controller->GetEntryCount(); |
+ int pending_offset_to_send = pending_history_list_offset; |
Charlie Reis
2015/03/20 21:07:34
nit: Is there a reason to make copies of these?
clamy
2015/03/24 13:33:38
I thought it would be weird and not very readable
|
+ int current_offset_to_send = current_history_list_offset; |
+ int current_length_to_send = current_history_list_length; |
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. |
- pending_history_list_offset = -1; |
- current_history_list_offset = -1; |
- current_history_list_length = 0; |
+ pending_offset_to_send = -1; |
+ current_offset_to_send = -1; |
+ current_length_to_send = 0; |
} |
- return HistoryNavigationParams( |
- GetPageState(), GetPageID(), pending_history_list_offset, |
- current_history_list_offset, current_history_list_length, |
+ return RequestNavigationParams( |
+ GetIsOverridingUserAgent(), navigation_start, redirects, |
+ GetCanLoadLocalResources(), GetFrameToNavigate(), base::Time::Now(), |
+ GetPageState(), GetPageID(), pending_offset_to_send, |
+ current_offset_to_send, current_length_to_send, |
should_clear_history_list()); |
} |
-StartNavigationParams NavigationEntryImpl::ConstructStartNavigationParams() |
- const { |
- std::vector<unsigned char> browser_initiated_post_data; |
- if (GetBrowserInitiatedPostData()) { |
- browser_initiated_post_data.assign( |
- GetBrowserInitiatedPostData()->front(), |
- GetBrowserInitiatedPostData()->front() + |
- GetBrowserInitiatedPostData()->size()); |
- } |
+void NavigationEntryImpl::ResetForCommit() { |
+ // Any state that only matters when a navigation entry is pending should be |
+ // cleared here. |
+ // TODO(creis): This state should be moved to NavigationRequest once |
+ // PlzNavigate is enabled. |
+ SetBrowserInitiatedPostData(nullptr); |
+ set_source_site_instance(nullptr); |
+ set_is_renderer_initiated(false); |
+ set_transferred_global_request_id(GlobalRequestID()); |
+ set_should_replace_entry(false); |
- return StartNavigationParams( |
- GetHasPostData(), extra_headers(), browser_initiated_post_data, |
- should_replace_entry(), transferred_global_request_id().child_id, |
- transferred_global_request_id().request_id); |
+ set_should_clear_history_list(false); |
+ set_frame_tree_node_id(-1); |
+ |
+#if defined(OS_ANDROID) |
+ // Reset the time stamp so that the metrics are not reported if this entry is |
+ // loaded again in the future. |
+ set_intent_received_timestamp(base::TimeTicks()); |
+#endif |
+} |
+ |
+void NavigationEntryImpl::SetScreenshotPNGData( |
+ scoped_refptr<base::RefCountedBytes> png_data) { |
+ screenshot_ = png_data; |
+ if (screenshot_.get()) |
+ UMA_HISTOGRAM_MEMORY_KB("Overscroll.ScreenshotSize", screenshot_->size()); |
+} |
+ |
+GURL NavigationEntryImpl::GetHistoryURLForDataURL() const { |
+ return GetBaseURLForDataURL().is_empty() ? GURL() : GetVirtualURL(); |
} |
} // namespace content |