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

Side by Side Diff: content/common/navigation_params.h

Issue 2099243002: PlzNavigate: properly set the initiator of the navigation (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 4 years, 1 month 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 unified diff | Download patch
OLDNEW
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
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);
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;
170
171 // Indicates the initiator of the request. In auxilliary navigations, this is
172 // the origin of the document that triggered the navigation. This parameter
173 // can be null during browser-initiated navigations.
nasko 2016/11/18 19:49:15 nit: s/during/for/
174 base::Optional<url::Origin> initiator;
166 }; 175 };
167 176
168 // Provided by the browser ----------------------------------------------------- 177 // Provided by the browser -----------------------------------------------------
169 // 178 //
170 // These structs are sent by the browser to the renderer to start/commit a 179 // These structs are sent by the browser to the renderer to start/commit a
171 // navigation depending on whether browser-side navigation is enabled. 180 // navigation depending on whether browser-side navigation is enabled.
172 // Parameters used both in the current architecture and PlzNavigate should be 181 // Parameters used both in the current architecture and PlzNavigate should be
173 // put in RequestNavigationParams. Parameters only used by the current 182 // put in RequestNavigationParams. Parameters only used by the current
174 // architecture should go in StartNavigationParams. 183 // architecture should go in StartNavigationParams.
175 184
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
342 ~NavigationParams(); 351 ~NavigationParams();
343 352
344 CommonNavigationParams common_params; 353 CommonNavigationParams common_params;
345 StartNavigationParams start_params; 354 StartNavigationParams start_params;
346 RequestNavigationParams request_params; 355 RequestNavigationParams request_params;
347 }; 356 };
348 357
349 } // namespace content 358 } // namespace content
350 359
351 #endif // CONTENT_COMMON_NAVIGATION_PARAMS_H_ 360 #endif // CONTENT_COMMON_NAVIGATION_PARAMS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698