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 <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <map> | 10 #include <map> |
11 #include <string> | 11 #include <string> |
12 | 12 |
13 #include "base/memory/ref_counted.h" | 13 #include "base/memory/ref_counted.h" |
| 14 #include "base/optional.h" |
14 #include "base/time/time.h" | 15 #include "base/time/time.h" |
15 #include "build/build_config.h" | 16 #include "build/build_config.h" |
16 #include "content/common/content_export.h" | 17 #include "content/common/content_export.h" |
17 #include "content/common/frame_message_enums.h" | 18 #include "content/common/frame_message_enums.h" |
18 #include "content/common/navigation_gesture.h" | 19 #include "content/common/navigation_gesture.h" |
19 #include "content/common/resource_request_body_impl.h" | 20 #include "content/common/resource_request_body_impl.h" |
20 #include "content/public/common/page_state.h" | 21 #include "content/public/common/page_state.h" |
21 #include "content/public/common/referrer.h" | 22 #include "content/public/common/referrer.h" |
22 #include "content/public/common/request_context_type.h" | 23 #include "content/public/common/request_context_type.h" |
23 #include "content/public/common/resource_response.h" | 24 #include "content/public/common/resource_response.h" |
24 #include "ui/base/page_transition_types.h" | 25 #include "ui/base/page_transition_types.h" |
25 #include "url/gurl.h" | 26 #include "url/gurl.h" |
| 27 #include "url/origin.h" |
26 | 28 |
27 namespace content { | 29 namespace content { |
28 | 30 |
29 // The LoFi state which determines whether to add the Lo-Fi header. | 31 // The LoFi state which determines whether to add the Lo-Fi header. |
30 enum LoFiState { | 32 enum LoFiState { |
31 // Let the browser process decide whether or not to request the Lo-Fi version. | 33 // Let the browser process decide whether or not to request the Lo-Fi version. |
32 LOFI_UNSPECIFIED = 0, | 34 LOFI_UNSPECIFIED = 0, |
33 | 35 |
34 // Request a normal (non-Lo-Fi) version of the resource. | 36 // Request a normal (non-Lo-Fi) version of the resource. |
35 LOFI_OFF, | 37 LOFI_OFF, |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
143 // This struct is not used outside of the PlzNavigate project. | 145 // This struct is not used outside of the PlzNavigate project. |
144 // PlzNavigate: parameters needed to start a navigation on the IO thread, | 146 // PlzNavigate: parameters needed to start a navigation on the IO thread, |
145 // following a renderer-initiated navigation request. | 147 // following a renderer-initiated navigation request. |
146 struct CONTENT_EXPORT BeginNavigationParams { | 148 struct CONTENT_EXPORT BeginNavigationParams { |
147 // TODO(clamy): See if it is possible to reuse this in | 149 // TODO(clamy): See if it is possible to reuse this in |
148 // ResourceMsg_Request_Params. | 150 // ResourceMsg_Request_Params. |
149 BeginNavigationParams(); | 151 BeginNavigationParams(); |
150 BeginNavigationParams(std::string headers, | 152 BeginNavigationParams(std::string headers, |
151 int load_flags, | 153 int load_flags, |
152 bool skip_service_worker, | 154 bool skip_service_worker, |
153 RequestContextType request_context_type); | 155 RequestContextType request_context_type, |
| 156 const base::Optional<url::Origin>& initiator); |
154 BeginNavigationParams(const BeginNavigationParams& other); | 157 BeginNavigationParams(const BeginNavigationParams& other); |
| 158 ~BeginNavigationParams(); |
155 | 159 |
156 // Additional HTTP request headers. | 160 // Additional HTTP request headers. |
157 std::string headers; | 161 std::string headers; |
158 | 162 |
159 // net::URLRequest load flags (net::LOAD_NORMAL) by default). | 163 // net::URLRequest load flags (net::LOAD_NORMAL) by default). |
160 int load_flags; | 164 int load_flags; |
161 | 165 |
162 // True if the ServiceWorker should be skipped. | 166 // True if the ServiceWorker should be skipped. |
163 bool skip_service_worker; | 167 bool skip_service_worker; |
164 | 168 |
165 // Indicates the request context type. | 169 // Indicates the request context type. |
166 RequestContextType request_context_type; | 170 RequestContextType request_context_type; |
167 | 171 |
168 // See WebSearchableFormData for a description of these. | 172 // See WebSearchableFormData for a description of these. |
169 GURL searchable_form_url; | 173 GURL searchable_form_url; |
170 std::string searchable_form_encoding; | 174 std::string searchable_form_encoding; |
| 175 |
| 176 // Indicates the initiator of the request. In auxilliary navigations, this is |
| 177 // the origin of the document that triggered the navigation. This parameter |
| 178 // can be null during browser-initiated navigations. |
| 179 base::Optional<url::Origin> initiator; |
171 }; | 180 }; |
172 | 181 |
173 // Provided by the browser ----------------------------------------------------- | 182 // Provided by the browser ----------------------------------------------------- |
174 // | 183 // |
175 // These structs are sent by the browser to the renderer to start/commit a | 184 // These structs are sent by the browser to the renderer to start/commit a |
176 // navigation depending on whether browser-side navigation is enabled. | 185 // navigation depending on whether browser-side navigation is enabled. |
177 // Parameters used both in the current architecture and PlzNavigate should be | 186 // Parameters used both in the current architecture and PlzNavigate should be |
178 // put in RequestNavigationParams. Parameters only used by the current | 187 // put in RequestNavigationParams. Parameters only used by the current |
179 // architecture should go in StartNavigationParams. | 188 // architecture should go in StartNavigationParams. |
180 | 189 |
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
347 ~NavigationParams(); | 356 ~NavigationParams(); |
348 | 357 |
349 CommonNavigationParams common_params; | 358 CommonNavigationParams common_params; |
350 StartNavigationParams start_params; | 359 StartNavigationParams start_params; |
351 RequestNavigationParams request_params; | 360 RequestNavigationParams request_params; |
352 }; | 361 }; |
353 | 362 |
354 } // namespace content | 363 } // namespace content |
355 | 364 |
356 #endif // CONTENT_COMMON_NAVIGATION_PARAMS_H_ | 365 #endif // CONTENT_COMMON_NAVIGATION_PARAMS_H_ |
OLD | NEW |