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; | 24 class NavigationEntry; |
25 | 25 |
26 // The following structures hold parameters used during a navigation. In | 26 // The following structures hold parameters used during a navigation. In |
27 // particular they are used by FrameMsg_Navigate, FrameMsg_CommitNavigation and | 27 // particular they are used by FrameMsg_Navigate, FrameMsg_CommitNavigation and |
28 // FrameHostMsg_BeginNavigation. | 28 // FrameHostMsg_BeginNavigation. |
29 // TODO(clamy): Depending on the avancement of the history refactoring move the | |
30 // history parameters from FrameMsg_Navigate into one of the structs. | |
31 | 29 |
32 // Used by all navigation IPCs. | 30 // Used by all navigation IPCs. |
33 struct CONTENT_EXPORT CommonNavigationParams { | 31 struct CONTENT_EXPORT CommonNavigationParams { |
34 CommonNavigationParams(); | 32 CommonNavigationParams(); |
35 CommonNavigationParams(const GURL& url, | 33 CommonNavigationParams(const GURL& url, |
36 const Referrer& referrer, | 34 const Referrer& referrer, |
37 ui::PageTransition transition, | 35 ui::PageTransition transition, |
38 FrameMsg_Navigate_Type::Value navigation_type, | 36 FrameMsg_Navigate_Type::Value navigation_type, |
39 bool allow_download, | 37 bool allow_download, |
40 base::TimeTicks ui_timestamp, | 38 base::TimeTicks ui_timestamp, |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
99 | 97 |
100 // True if the request was user initiated. | 98 // True if the request was user initiated. |
101 bool has_user_gesture; | 99 bool has_user_gesture; |
102 }; | 100 }; |
103 | 101 |
104 // Used by FrameMsg_Navigate. | 102 // Used by FrameMsg_Navigate. |
105 // PlzNavigate: sent to the renderer when the navigation is ready to commit. | 103 // PlzNavigate: sent to the renderer when the navigation is ready to commit. |
106 struct CONTENT_EXPORT CommitNavigationParams { | 104 struct CONTENT_EXPORT CommitNavigationParams { |
107 CommitNavigationParams(); | 105 CommitNavigationParams(); |
108 CommitNavigationParams(bool is_overriding_user_agent, | 106 CommitNavigationParams(bool is_overriding_user_agent, |
109 base::TimeTicks navigation_start); | 107 base::TimeTicks navigation_start, |
108 const std::vector<GURL>& redirects, | |
109 bool can_load_local_resources, | |
110 const std::string& frame_to_navigate, | |
111 base::Time request_time); | |
110 ~CommitNavigationParams(); | 112 ~CommitNavigationParams(); |
111 | 113 |
112 // Whether or not the user agent override string should be used. | 114 // Whether or not the user agent override string should be used. |
113 bool is_overriding_user_agent; | 115 bool is_overriding_user_agent; |
114 | 116 |
115 // The navigationStart time to expose through the Navigation Timing API to JS. | 117 // The navigationStart time to expose through the Navigation Timing API to JS. |
116 base::TimeTicks browser_navigation_start; | 118 base::TimeTicks browser_navigation_start; |
117 | 119 |
118 // TODO(clamy): Move the redirect chain here. | 120 // Any redirect URLs that occurred before |url|. Useful for cross-process |
121 // navigations; defaults to empty. | |
122 std::vector<GURL> redirects; | |
123 | |
124 // Whether or not this url should be allowed to access local file:// | |
125 // resources. | |
126 bool can_load_local_resources; | |
127 | |
128 // If not empty, which frame to navigate. | |
129 std::string frame_to_navigate; | |
130 | |
131 // The time the request was created. This is used by the old performance | |
132 // infrastructure to set up DocumentState associated with the RenderView. | |
133 // TODO(ppi): make it go away. | |
134 base::Time request_time; | |
119 }; | 135 }; |
120 | 136 |
121 // Used by FrameMsg_Navigate. | 137 // Used by FrameMsg_Navigate. |
122 // PlzNavigate: sent to the renderer when the navigation is ready to commit. | 138 // PlzNavigate: sent to the renderer when the navigation is ready to commit. |
Charlie Reis
2015/03/17 04:01:03
Why are there different structs for Commit params
| |
123 struct CONTENT_EXPORT HistoryNavigationParams { | 139 struct CONTENT_EXPORT HistoryNavigationParams { |
124 HistoryNavigationParams(); | 140 HistoryNavigationParams(); |
125 HistoryNavigationParams(const PageState& page_state, | 141 HistoryNavigationParams(const PageState& page_state, |
126 int32 page_id, | 142 int32 page_id, |
127 int pending_history_list_offset, | 143 int pending_history_list_offset, |
128 int current_history_list_offset, | 144 int current_history_list_offset, |
129 int current_history_list_length, | 145 int current_history_list_length, |
130 bool should_clear_history_list); | 146 bool should_clear_history_list); |
131 ~HistoryNavigationParams(); | 147 ~HistoryNavigationParams(); |
132 | 148 |
(...skipping 14 matching lines...) Expand all Loading... | |
147 // size of the session history list. | 163 // size of the session history list. |
148 int current_history_list_offset; | 164 int current_history_list_offset; |
149 int current_history_list_length; | 165 int current_history_list_length; |
150 | 166 |
151 // Whether session history should be cleared. In that case, the RenderView | 167 // Whether session history should be cleared. In that case, the RenderView |
152 // needs to notify the browser that the clearing was succesful when the | 168 // needs to notify the browser that the clearing was succesful when the |
153 // navigation commits. | 169 // navigation commits. |
154 bool should_clear_history_list; | 170 bool should_clear_history_list; |
155 }; | 171 }; |
156 | 172 |
173 // Parameters needed at the start of a navigation. Used by FrameMsg_Navigate. | |
174 // PlzNavigate: these parameters are not used in navigation. | |
175 struct CONTENT_EXPORT StartNavigationParams { | |
Charlie Reis
2015/03/17 04:01:03
Why is Start listed last? This should be declared
| |
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 { | |
210 NavigationParams(const CommonNavigationParams& common_params, | |
211 const StartNavigationParams& start_params, | |
212 const CommitNavigationParams& commit_params, | |
213 const HistoryNavigationParams& history_params); | |
214 ~NavigationParams(); | |
215 | |
216 CommonNavigationParams common_params; | |
217 StartNavigationParams start_params; | |
218 CommitNavigationParams commit_params; | |
219 HistoryNavigationParams history_params; | |
220 }; | |
157 } // namespace content | 221 } // namespace content |
158 | 222 |
159 #endif // CONTENT_COMMON_NAVIGATION_PARAMS_H_ | 223 #endif // CONTENT_COMMON_NAVIGATION_PARAMS_H_ |
OLD | NEW |