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