OLD | NEW |
---|---|
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 #ifndef CONTENT_COMMON_NAVIGATION_PARAMS_H_ | 5 #ifndef CONTENT_COMMON_NAVIGATION_PARAMS_H_ |
6 #define CONTENT_COMMON_NAVIGATION_PARAMS_H_ | 6 #define CONTENT_COMMON_NAVIGATION_PARAMS_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
11 #include "base/time/time.h" | 11 #include "base/time/time.h" |
12 #include "content/common/content_export.h" | 12 #include "content/common/content_export.h" |
13 #include "content/common/frame_message_enums.h" | 13 #include "content/common/frame_message_enums.h" |
14 #include "content/public/common/page_state.h" | 14 #include "content/public/common/page_state.h" |
15 #include "content/public/common/referrer.h" | 15 #include "content/public/common/referrer.h" |
16 #include "ui/base/page_transition_types.h" | 16 #include "ui/base/page_transition_types.h" |
17 #include "url/gurl.h" | 17 #include "url/gurl.h" |
18 | 18 |
19 namespace base { | 19 namespace base { |
20 class RefCountedMemory; | 20 class RefCountedMemory; |
21 } | 21 } |
22 | 22 |
23 namespace content { | 23 namespace content { |
24 class NavigationEntry; | |
25 | 24 |
26 // The following structures hold parameters used during a navigation. In | 25 // The following structures hold parameters used during a navigation. In |
27 // particular they are used by FrameMsg_Navigate, FrameMsg_CommitNavigation and | 26 // particular they are used by FrameMsg_Navigate, FrameMsg_CommitNavigation and |
28 // FrameHostMsg_BeginNavigation. | 27 // FrameHostMsg_BeginNavigation. |
29 | 28 |
29 // Provided by the browser or the renderer ------------------------------------- | |
30 | |
30 // Used by all navigation IPCs. | 31 // Used by all navigation IPCs. |
31 struct CONTENT_EXPORT CommonNavigationParams { | 32 struct CONTENT_EXPORT CommonNavigationParams { |
32 CommonNavigationParams(); | 33 CommonNavigationParams(); |
33 CommonNavigationParams(const GURL& url, | 34 CommonNavigationParams(const GURL& url, |
34 const Referrer& referrer, | 35 const Referrer& referrer, |
35 ui::PageTransition transition, | 36 ui::PageTransition transition, |
36 FrameMsg_Navigate_Type::Value navigation_type, | 37 FrameMsg_Navigate_Type::Value navigation_type, |
37 bool allow_download, | 38 bool allow_download, |
38 base::TimeTicks ui_timestamp, | 39 base::TimeTicks ui_timestamp, |
39 FrameMsg_UILoadMetricsReportType::Value report_type, | 40 FrameMsg_UILoadMetricsReportType::Value report_type, |
(...skipping 29 matching lines...) Expand all Loading... | |
69 | 70 |
70 // Base URL for use in Blink's SubstituteData. | 71 // Base URL for use in Blink's SubstituteData. |
71 // Is only used with data: URLs. | 72 // Is only used with data: URLs. |
72 GURL base_url_for_data_url; | 73 GURL base_url_for_data_url; |
73 | 74 |
74 // History URL for use in Blink's SubstituteData. | 75 // History URL for use in Blink's SubstituteData. |
75 // Is only used with data: URLs. | 76 // Is only used with data: URLs. |
76 GURL history_url_for_data_url; | 77 GURL history_url_for_data_url; |
77 }; | 78 }; |
78 | 79 |
79 // PlzNavigate: parameters needed to start a navigation on the IO thread. | 80 // Provided by the renderer ---------------------------------------------------- |
81 // | |
82 // This struct holds parameters sent by the renderer to the browser. It is only | |
83 // used in PlzNavigate (since in the current architecture, the renderer does not | |
84 // inform the browser of navigations until they commit). | |
85 | |
86 // This struct is not used outside of the PlzNavigate project. | |
87 // PlzNavigate: parameters needed to start a navigation on the IO thread, | |
88 // following a renderer-initiated navigation request. | |
80 struct CONTENT_EXPORT BeginNavigationParams { | 89 struct CONTENT_EXPORT BeginNavigationParams { |
81 // TODO(clamy): See if it is possible to reuse this in | 90 // TODO(clamy): See if it is possible to reuse this in |
82 // ResourceMsg_Request_Params. | 91 // ResourceMsg_Request_Params. |
83 BeginNavigationParams(); | 92 BeginNavigationParams(); |
84 BeginNavigationParams(std::string method, | 93 BeginNavigationParams(std::string method, |
85 std::string headers, | 94 std::string headers, |
86 int load_flags, | 95 int load_flags, |
87 bool has_user_gesture); | 96 bool has_user_gesture); |
88 | 97 |
89 // The request method: GET, POST, etc. | 98 // The request method: GET, POST, etc. |
90 std::string method; | 99 std::string method; |
91 | 100 |
92 // Additional HTTP request headers. | 101 // Additional HTTP request headers. |
93 std::string headers; | 102 std::string headers; |
94 | 103 |
95 // net::URLRequest load flags (net::LOAD_NORMAL) by default). | 104 // net::URLRequest load flags (net::LOAD_NORMAL) by default). |
96 int load_flags; | 105 int load_flags; |
97 | 106 |
98 // True if the request was user initiated. | 107 // True if the request was user initiated. |
99 bool has_user_gesture; | 108 bool has_user_gesture; |
100 }; | 109 }; |
101 | 110 |
102 // Used by FrameMsg_Navigate. | 111 // Provided by the browser ----------------------------------------------------- |
103 // PlzNavigate: sent to the renderer when the navigation is ready to commit. | 112 // |
104 struct CONTENT_EXPORT CommitNavigationParams { | 113 // These structs are sent by the browser to the renderer to start/commit a |
105 CommitNavigationParams(); | 114 // navigation depending on whether browser-side navigation is enabled. |
106 CommitNavigationParams(bool is_overriding_user_agent, | 115 // Parameters used both in the current architecture and PlzNavigate should be |
107 base::TimeTicks navigation_start, | 116 // put in RequestNavigationParams. Parameters only used by the current |
108 const std::vector<GURL>& redirects, | 117 // architecture should go in StartNavigationParams. |
109 bool can_load_local_resources, | 118 |
110 const std::string& frame_to_navigate, | 119 // Used by FrameMsg_Navigate. Holds the parameters needed by the renderer to |
111 base::Time request_time); | 120 // start a browser-initiated navigation besides those in CommonNavigationParams. |
112 ~CommitNavigationParams(); | 121 // The difference with the RequestNavigationParams below is that they are only |
122 // used in the current architecture of navigation, and will not be used by | |
123 // PlzNavigate. | |
124 // PlzNavigate: These are not used. | |
125 struct CONTENT_EXPORT StartNavigationParams { | |
126 StartNavigationParams(); | |
127 StartNavigationParams( | |
128 bool is_post, | |
129 const std::string& extra_headers, | |
130 const std::vector<unsigned char>& browser_initiated_post_data, | |
131 bool should_replace_current_entry, | |
132 int transferred_request_child_id, | |
133 int transferred_request_request_id); | |
134 ~StartNavigationParams(); | |
135 | |
136 // Whether the navigation is a POST request (as opposed to a GET). | |
137 bool is_post; | |
138 | |
139 // Extra headers (separated by \n) to send during the request. | |
140 std::string extra_headers; | |
141 | |
142 // If is_post is true, holds the post_data information from browser. Empty | |
143 // otherwise. | |
144 std::vector<unsigned char> browser_initiated_post_data; | |
145 | |
146 // Informs the RenderView the pending navigation should replace the current | |
147 // history entry when it commits. This is used for cross-process redirects so | |
148 // the transferred navigation can recover the navigation state. | |
149 bool should_replace_current_entry; | |
150 | |
151 // The following two members identify a previous request that has been | |
152 // created before this navigation is being transferred to a new render view. | |
153 // This serves the purpose of recycling the old request. | |
154 // Unless this refers to a transferred navigation, these values are -1 and -1. | |
155 int transferred_request_child_id; | |
156 int transferred_request_request_id; | |
157 }; | |
158 | |
159 // Used by FrameMsg_Navigate. Holds the parameters needed by the renderer to | |
160 // start a browser-initiated navigation besides those in CommonNavigationParams. | |
161 // PlzNavigate: sent to the renderer to commit a navigation. | |
Charlie Reis
2015/03/20 21:07:34
Please change this last sentence to:
PlzNavigate:
clamy
2015/03/24 13:33:38
Done.
| |
162 struct CONTENT_EXPORT RequestNavigationParams { | |
163 RequestNavigationParams(); | |
164 RequestNavigationParams(bool is_overriding_user_agent, | |
165 base::TimeTicks navigation_start, | |
166 const std::vector<GURL>& redirects, | |
167 bool can_load_local_resources, | |
168 const std::string& frame_to_navigate, | |
169 base::Time request_time, | |
170 const PageState& page_state, | |
171 int32 page_id, | |
172 int pending_history_list_offset, | |
173 int current_history_list_offset, | |
174 int current_history_list_length, | |
175 bool should_clear_history_list); | |
176 ~RequestNavigationParams(); | |
113 | 177 |
114 // Whether or not the user agent override string should be used. | 178 // Whether or not the user agent override string should be used. |
115 bool is_overriding_user_agent; | 179 bool is_overriding_user_agent; |
116 | 180 |
117 // The navigationStart time to expose through the Navigation Timing API to JS. | 181 // The navigationStart time to expose through the Navigation Timing API to JS. |
118 base::TimeTicks browser_navigation_start; | 182 base::TimeTicks browser_navigation_start; |
119 | 183 |
120 // Any redirect URLs that occurred before |url|. Useful for cross-process | 184 // Any redirect URLs that occurred before |url|. Useful for cross-process |
121 // navigations; defaults to empty. | 185 // navigations; defaults to empty. |
122 std::vector<GURL> redirects; | 186 std::vector<GURL> redirects; |
123 | 187 |
124 // Whether or not this url should be allowed to access local file:// | 188 // Whether or not this url should be allowed to access local file:// |
125 // resources. | 189 // resources. |
126 bool can_load_local_resources; | 190 bool can_load_local_resources; |
127 | 191 |
128 // If not empty, which frame to navigate. | 192 // If not empty, which frame to navigate. |
129 std::string frame_to_navigate; | 193 std::string frame_to_navigate; |
130 | 194 |
131 // The time the request was created. This is used by the old performance | 195 // The time the request was created. This is used by the old performance |
132 // infrastructure to set up DocumentState associated with the RenderView. | 196 // infrastructure to set up DocumentState associated with the RenderView. |
133 // TODO(ppi): make it go away. | 197 // TODO(ppi): make it go away. |
134 base::Time request_time; | 198 base::Time request_time; |
135 }; | |
136 | |
137 // Used by FrameMsg_Navigate. | |
138 // PlzNavigate: sent to the renderer when the navigation is ready to commit. | |
139 struct CONTENT_EXPORT HistoryNavigationParams { | |
140 HistoryNavigationParams(); | |
141 HistoryNavigationParams(const PageState& page_state, | |
142 int32 page_id, | |
143 int pending_history_list_offset, | |
144 int current_history_list_offset, | |
145 int current_history_list_length, | |
146 bool should_clear_history_list); | |
147 ~HistoryNavigationParams(); | |
148 | 199 |
149 // Opaque history state (received by ViewHostMsg_UpdateState). | 200 // Opaque history state (received by ViewHostMsg_UpdateState). |
150 PageState page_state; | 201 PageState page_state; |
151 | 202 |
152 // The page_id for this navigation, or -1 if it is a new navigation. Back, | 203 // The page_id for this navigation, or -1 if it is a new navigation. Back, |
153 // Forward, and Reload navigations should have a valid page_id. If the load | 204 // Forward, and Reload navigations should have a valid page_id. If the load |
154 // succeeds, then this page_id will be reflected in the resultant | 205 // succeeds, then this page_id will be reflected in the resultant |
155 // FrameHostMsg_DidCommitProvisionalLoad message. | 206 // FrameHostMsg_DidCommitProvisionalLoad message. |
156 int32 page_id; | 207 int32 page_id; |
157 | 208 |
158 // For history navigations, this is the offset in the history list of the | 209 // For history navigations, this is the offset in the history list of the |
159 // pending load. For non-history navigations, this will be ignored. | 210 // pending load. For non-history navigations, this will be ignored. |
160 int pending_history_list_offset; | 211 int pending_history_list_offset; |
161 | 212 |
162 // Where its current page contents reside in session history and the total | 213 // Where its current page contents reside in session history and the total |
163 // size of the session history list. | 214 // size of the session history list. |
164 int current_history_list_offset; | 215 int current_history_list_offset; |
165 int current_history_list_length; | 216 int current_history_list_length; |
166 | 217 |
167 // Whether session history should be cleared. In that case, the RenderView | 218 // Whether session history should be cleared. In that case, the RenderView |
168 // needs to notify the browser that the clearing was succesful when the | 219 // needs to notify the browser that the clearing was succesful when the |
169 // navigation commits. | 220 // navigation commits. |
170 bool should_clear_history_list; | 221 bool should_clear_history_list; |
171 }; | 222 }; |
172 | 223 |
173 // Parameters needed at the start of a navigation. Used by FrameMsg_Navigate. | 224 // Helper struct keeping track in one place of all the parameters the browser |
174 // PlzNavigate: these parameters are not used in navigation. | 225 // needs to provide to the renderer. |
175 struct CONTENT_EXPORT StartNavigationParams { | |
176 StartNavigationParams(); | |
177 StartNavigationParams( | |
178 bool is_post, | |
179 const std::string& extra_headers, | |
180 const std::vector<unsigned char>& browser_initiated_post_data, | |
181 bool should_replace_current_entry, | |
182 int transferred_request_child_id, | |
183 int transferred_request_request_id); | |
184 ~StartNavigationParams(); | |
185 | |
186 // Whether the navigation is a POST request (as opposed to a GET). | |
187 bool is_post; | |
188 | |
189 // Extra headers (separated by \n) to send during the request. | |
190 std::string extra_headers; | |
191 | |
192 // If is_post is true, holds the post_data information from browser. Empty | |
193 // otherwise. | |
194 std::vector<unsigned char> browser_initiated_post_data; | |
195 | |
196 // Informs the RenderView the pending navigation should replace the current | |
197 // history entry when it commits. This is used for cross-process redirects so | |
198 // the transferred navigation can recover the navigation state. | |
199 bool should_replace_current_entry; | |
200 | |
201 // The following two members identify a previous request that has been | |
202 // created before this navigation is being transferred to a new render view. | |
203 // This serves the purpose of recycling the old request. | |
204 // Unless this refers to a transferred navigation, these values are -1 and -1. | |
205 int transferred_request_child_id; | |
206 int transferred_request_request_id; | |
207 }; | |
208 | |
209 struct NavigationParams { | 226 struct NavigationParams { |
210 NavigationParams(const CommonNavigationParams& common_params, | 227 NavigationParams(const CommonNavigationParams& common_params, |
211 const StartNavigationParams& start_params, | 228 const StartNavigationParams& start_params, |
212 const CommitNavigationParams& commit_params, | 229 const RequestNavigationParams& request_params); |
213 const HistoryNavigationParams& history_params); | |
214 ~NavigationParams(); | 230 ~NavigationParams(); |
215 | 231 |
216 CommonNavigationParams common_params; | 232 CommonNavigationParams common_params; |
217 StartNavigationParams start_params; | 233 StartNavigationParams start_params; |
218 CommitNavigationParams commit_params; | 234 RequestNavigationParams request_params; |
219 HistoryNavigationParams history_params; | |
220 }; | 235 }; |
236 | |
221 } // namespace content | 237 } // namespace content |
222 | 238 |
223 #endif // CONTENT_COMMON_NAVIGATION_PARAMS_H_ | 239 #endif // CONTENT_COMMON_NAVIGATION_PARAMS_H_ |
OLD | NEW |