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

Unified Diff: content/common/navigation_params.h

Issue 1018383002: Make NavigationParams clearer (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase + addressed comment Created 5 years, 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/common/frame_messages.h ('k') | content/common/navigation_params.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/common/navigation_params.h
diff --git a/content/common/navigation_params.h b/content/common/navigation_params.h
index 9b3fccf4ab78e61b656a68d5e077f0c0a1611989..ce34bcc04bdf1d7f7bab3adab382715c5587b28f 100644
--- a/content/common/navigation_params.h
+++ b/content/common/navigation_params.h
@@ -21,12 +21,13 @@ class RefCountedMemory;
}
namespace content {
-class NavigationEntry;
// The following structures hold parameters used during a navigation. In
// particular they are used by FrameMsg_Navigate, FrameMsg_CommitNavigation and
// FrameHostMsg_BeginNavigation.
+// Provided by the browser or the renderer -------------------------------------
+
// Used by all navigation IPCs.
struct CONTENT_EXPORT CommonNavigationParams {
CommonNavigationParams();
@@ -76,7 +77,15 @@ struct CONTENT_EXPORT CommonNavigationParams {
GURL history_url_for_data_url;
};
-// PlzNavigate: parameters needed to start a navigation on the IO thread.
+// Provided by the renderer ----------------------------------------------------
+//
+// This struct holds parameters sent by the renderer to the browser. It is only
+// used in PlzNavigate (since in the current architecture, the renderer does not
+// inform the browser of navigations until they commit).
+
+// This struct is not used outside of the PlzNavigate project.
+// PlzNavigate: parameters needed to start a navigation on the IO thread,
+// following a renderer-initiated navigation request.
struct CONTENT_EXPORT BeginNavigationParams {
// TODO(clamy): See if it is possible to reuse this in
// ResourceMsg_Request_Params.
@@ -99,17 +108,73 @@ struct CONTENT_EXPORT BeginNavigationParams {
bool has_user_gesture;
};
-// Used by FrameMsg_Navigate.
-// PlzNavigate: sent to the renderer when the navigation is ready to commit.
-struct CONTENT_EXPORT CommitNavigationParams {
- CommitNavigationParams();
- CommitNavigationParams(bool is_overriding_user_agent,
- base::TimeTicks navigation_start,
- const std::vector<GURL>& redirects,
- bool can_load_local_resources,
- const std::string& frame_to_navigate,
- base::Time request_time);
- ~CommitNavigationParams();
+// Provided by the browser -----------------------------------------------------
+//
+// These structs are sent by the browser to the renderer to start/commit a
+// navigation depending on whether browser-side navigation is enabled.
+// Parameters used both in the current architecture and PlzNavigate should be
+// put in RequestNavigationParams. Parameters only used by the current
+// architecture should go in StartNavigationParams.
+
+// Used by FrameMsg_Navigate. Holds the parameters needed by the renderer to
+// start a browser-initiated navigation besides those in CommonNavigationParams.
+// The difference with the RequestNavigationParams below is that they are only
+// used in the current architecture of navigation, and will not be used by
+// PlzNavigate.
+// PlzNavigate: These are not used.
+struct CONTENT_EXPORT StartNavigationParams {
+ StartNavigationParams();
+ StartNavigationParams(
+ bool is_post,
+ const std::string& extra_headers,
+ const std::vector<unsigned char>& browser_initiated_post_data,
+ bool should_replace_current_entry,
+ int transferred_request_child_id,
+ int transferred_request_request_id);
+ ~StartNavigationParams();
+
+ // Whether the navigation is a POST request (as opposed to a GET).
+ bool is_post;
+
+ // Extra headers (separated by \n) to send during the request.
+ std::string extra_headers;
+
+ // If is_post is true, holds the post_data information from browser. Empty
+ // otherwise.
+ std::vector<unsigned char> browser_initiated_post_data;
+
+ // Informs the RenderView the pending navigation should replace the current
+ // history entry when it commits. This is used for cross-process redirects so
+ // the transferred navigation can recover the navigation state.
+ bool should_replace_current_entry;
+
+ // The following two members identify a previous request that has been
+ // created before this navigation is being transferred to a new render view.
+ // This serves the purpose of recycling the old request.
+ // Unless this refers to a transferred navigation, these values are -1 and -1.
+ int transferred_request_child_id;
+ int transferred_request_request_id;
+};
+
+// Used by FrameMsg_Navigate. Holds the parameters needed by the renderer to
+// start a browser-initiated navigation besides those in CommonNavigationParams.
+// PlzNavigate: sent to the renderer to make it issue a stream request for a
+// navigation that is ready to commit.
+struct CONTENT_EXPORT RequestNavigationParams {
+ RequestNavigationParams();
+ RequestNavigationParams(bool is_overriding_user_agent,
+ base::TimeTicks navigation_start,
+ const std::vector<GURL>& redirects,
+ bool can_load_local_resources,
+ const std::string& frame_to_navigate,
+ base::Time request_time,
+ const PageState& page_state,
+ int32 page_id,
+ int pending_history_list_offset,
+ int current_history_list_offset,
+ int current_history_list_length,
+ bool should_clear_history_list);
+ ~RequestNavigationParams();
// Whether or not the user agent override string should be used.
bool is_overriding_user_agent;
@@ -132,19 +197,6 @@ struct CONTENT_EXPORT CommitNavigationParams {
// infrastructure to set up DocumentState associated with the RenderView.
// TODO(ppi): make it go away.
base::Time request_time;
-};
-
-// Used by FrameMsg_Navigate.
-// PlzNavigate: sent to the renderer when the navigation is ready to commit.
-struct CONTENT_EXPORT HistoryNavigationParams {
- HistoryNavigationParams();
- HistoryNavigationParams(const PageState& page_state,
- int32 page_id,
- int pending_history_list_offset,
- int current_history_list_offset,
- int current_history_list_length,
- bool should_clear_history_list);
- ~HistoryNavigationParams();
// Opaque history state (received by ViewHostMsg_UpdateState).
PageState page_state;
@@ -170,54 +222,19 @@ struct CONTENT_EXPORT HistoryNavigationParams {
bool should_clear_history_list;
};
-// Parameters needed at the start of a navigation. Used by FrameMsg_Navigate.
-// PlzNavigate: these parameters are not used in navigation.
-struct CONTENT_EXPORT StartNavigationParams {
- StartNavigationParams();
- StartNavigationParams(
- bool is_post,
- const std::string& extra_headers,
- const std::vector<unsigned char>& browser_initiated_post_data,
- bool should_replace_current_entry,
- int transferred_request_child_id,
- int transferred_request_request_id);
- ~StartNavigationParams();
-
- // Whether the navigation is a POST request (as opposed to a GET).
- bool is_post;
-
- // Extra headers (separated by \n) to send during the request.
- std::string extra_headers;
-
- // If is_post is true, holds the post_data information from browser. Empty
- // otherwise.
- std::vector<unsigned char> browser_initiated_post_data;
-
- // Informs the RenderView the pending navigation should replace the current
- // history entry when it commits. This is used for cross-process redirects so
- // the transferred navigation can recover the navigation state.
- bool should_replace_current_entry;
-
- // The following two members identify a previous request that has been
- // created before this navigation is being transferred to a new render view.
- // This serves the purpose of recycling the old request.
- // Unless this refers to a transferred navigation, these values are -1 and -1.
- int transferred_request_child_id;
- int transferred_request_request_id;
-};
-
+// Helper struct keeping track in one place of all the parameters the browser
+// needs to provide to the renderer.
struct NavigationParams {
NavigationParams(const CommonNavigationParams& common_params,
const StartNavigationParams& start_params,
- const CommitNavigationParams& commit_params,
- const HistoryNavigationParams& history_params);
+ const RequestNavigationParams& request_params);
~NavigationParams();
CommonNavigationParams common_params;
StartNavigationParams start_params;
- CommitNavigationParams commit_params;
- HistoryNavigationParams history_params;
+ RequestNavigationParams request_params;
};
+
} // namespace content
#endif // CONTENT_COMMON_NAVIGATION_PARAMS_H_
« no previous file with comments | « content/common/frame_messages.h ('k') | content/common/navigation_params.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698