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

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: 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
Index: content/common/navigation_params.h
diff --git a/content/common/navigation_params.h b/content/common/navigation_params.h
index 9b3fccf4ab78e61b656a68d5e077f0c0a1611989..47ec9a85259b3a12869d046a5ca202855b469773 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,31 +77,57 @@ struct CONTENT_EXPORT CommonNavigationParams {
GURL history_url_for_data_url;
};
-// PlzNavigate: parameters needed to start a navigation on the IO thread.
-struct CONTENT_EXPORT BeginNavigationParams {
- // TODO(clamy): See if it is possible to reuse this in
- // ResourceMsg_Request_Params.
- BeginNavigationParams();
- BeginNavigationParams(std::string method,
- std::string headers,
- int load_flags,
- bool has_user_gesture);
+// Provided by the browser -----------------------------------------------------
+//
+// These structs are sent by the browser to the renderer to start (commit with
+// PlzNavigate enabled) a navigation. Parameters used both in the current
+// architecture and PlzNavigate should be put in CommitNavigationParams.
+// 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 CommitNavigationParams above 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();
- // The request method: GET, POST, etc.
- std::string method;
+ // Whether the navigation is a POST request (as opposed to a GET).
+ bool is_post;
- // Additional HTTP request headers.
- std::string headers;
+ // Extra headers (separated by \n) to send during the request.
+ std::string extra_headers;
- // net::URLRequest load flags (net::LOAD_NORMAL) by default).
- int load_flags;
+ // If is_post is true, holds the post_data information from browser. Empty
+ // otherwise.
+ std::vector<unsigned char> browser_initiated_post_data;
- // True if the request was user initiated.
- bool has_user_gesture;
+ // 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.
-// PlzNavigate: sent to the renderer when the navigation is ready to commit.
+// 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 commit a navigation.
struct CONTENT_EXPORT CommitNavigationParams {
CommitNavigationParams();
CommitNavigationParams(bool is_overriding_user_agent,
@@ -108,7 +135,13 @@ struct CONTENT_EXPORT CommitNavigationParams {
const std::vector<GURL>& redirects,
bool can_load_local_resources,
const std::string& frame_to_navigate,
- base::Time request_time);
+ 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);
~CommitNavigationParams();
// Whether or not the user agent override string should be used.
@@ -132,19 +165,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 +190,50 @@ 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 parameters the browser need
+// 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 CommitNavigationParams& commit_params);
~NavigationParams();
CommonNavigationParams common_params;
StartNavigationParams start_params;
CommitNavigationParams commit_params;
- HistoryNavigationParams history_params;
};
+
+// 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.
+ BeginNavigationParams();
+ BeginNavigationParams(std::string method,
+ std::string headers,
+ int load_flags,
+ bool has_user_gesture);
+
+ // The request method: GET, POST, etc.
+ std::string method;
+
+ // Additional HTTP request headers.
+ std::string headers;
+
+ // net::URLRequest load flags (net::LOAD_NORMAL) by default).
+ int load_flags;
+
+ // True if the request was user initiated.
+ bool has_user_gesture;
+};
+
} // namespace content
#endif // CONTENT_COMMON_NAVIGATION_PARAMS_H_

Powered by Google App Engine
This is Rietveld 408576698