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

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: Addressed comments Created 4 years, 5 months 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 <string> 10 #include <string>
11 11
12 #include "base/memory/ref_counted.h" 12 #include "base/memory/ref_counted.h"
13 #include "base/time/time.h" 13 #include "base/time/time.h"
14 #include "build/build_config.h" 14 #include "build/build_config.h"
15 #include "content/common/content_export.h" 15 #include "content/common/content_export.h"
16 #include "content/common/frame_message_enums.h" 16 #include "content/common/frame_message_enums.h"
17 #include "content/common/resource_request_body_impl.h" 17 #include "content/common/resource_request_body_impl.h"
18 #include "content/public/common/page_state.h" 18 #include "content/public/common/page_state.h"
19 #include "content/public/common/referrer.h" 19 #include "content/public/common/referrer.h"
20 #include "content/public/common/request_context_type.h" 20 #include "content/public/common/request_context_type.h"
21 #include "ui/base/page_transition_types.h" 21 #include "ui/base/page_transition_types.h"
22 #include "url/gurl.h" 22 #include "url/gurl.h"
23 #include "url/origin.h"
23 24
24 namespace content { 25 namespace content {
25 26
26 // The LoFi state which determines whether to add the Lo-Fi header. 27 // The LoFi state which determines whether to add the Lo-Fi header.
27 enum LoFiState { 28 enum LoFiState {
28 // Let the browser process decide whether or not to request the Lo-Fi version. 29 // Let the browser process decide whether or not to request the Lo-Fi version.
29 LOFI_UNSPECIFIED = 0, 30 LOFI_UNSPECIFIED = 0,
30 31
31 // Request a normal (non-Lo-Fi) version of the resource. 32 // Request a normal (non-Lo-Fi) version of the resource.
32 LOFI_OFF, 33 LOFI_OFF,
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
137 // PlzNavigate: parameters needed to start a navigation on the IO thread, 138 // PlzNavigate: parameters needed to start a navigation on the IO thread,
138 // following a renderer-initiated navigation request. 139 // following a renderer-initiated navigation request.
139 struct CONTENT_EXPORT BeginNavigationParams { 140 struct CONTENT_EXPORT BeginNavigationParams {
140 // TODO(clamy): See if it is possible to reuse this in 141 // TODO(clamy): See if it is possible to reuse this in
141 // ResourceMsg_Request_Params. 142 // ResourceMsg_Request_Params.
142 BeginNavigationParams(); 143 BeginNavigationParams();
143 BeginNavigationParams(std::string headers, 144 BeginNavigationParams(std::string headers,
144 int load_flags, 145 int load_flags,
145 bool has_user_gesture, 146 bool has_user_gesture,
146 bool skip_service_worker, 147 bool skip_service_worker,
147 RequestContextType request_context_type); 148 RequestContextType request_context_type,
149 const url::Origin& initiator);
148 BeginNavigationParams(const BeginNavigationParams& other); 150 BeginNavigationParams(const BeginNavigationParams& other);
149 151
150 // Additional HTTP request headers. 152 // Additional HTTP request headers.
151 std::string headers; 153 std::string headers;
152 154
153 // net::URLRequest load flags (net::LOAD_NORMAL) by default). 155 // net::URLRequest load flags (net::LOAD_NORMAL) by default).
154 int load_flags; 156 int load_flags;
155 157
156 // True if the request was user initiated. 158 // True if the request was user initiated.
157 bool has_user_gesture; 159 bool has_user_gesture;
158 160
159 // True if the ServiceWorker should be skipped. 161 // True if the ServiceWorker should be skipped.
160 bool skip_service_worker; 162 bool skip_service_worker;
161 163
162 // Indicates the request context type. 164 // Indicates the request context type.
163 RequestContextType request_context_type; 165 RequestContextType request_context_type;
166
167 // Indicates the initiator of the request. Normally this is the origin of the
168 // url of the navigation. In auxilliary navigations, this is the origin of
nasko 2016/06/28 18:32:23 Really? I always thought of initiator as the curre
clamy 2016/06/29 11:23:20 I don't know. I followed the comments of the Reque
169 // the document that triggered the navigation.
170 url::Origin initiator;
164 }; 171 };
165 172
166 // Provided by the browser ----------------------------------------------------- 173 // Provided by the browser -----------------------------------------------------
167 // 174 //
168 // These structs are sent by the browser to the renderer to start/commit a 175 // These structs are sent by the browser to the renderer to start/commit a
169 // navigation depending on whether browser-side navigation is enabled. 176 // navigation depending on whether browser-side navigation is enabled.
170 // Parameters used both in the current architecture and PlzNavigate should be 177 // Parameters used both in the current architecture and PlzNavigate should be
171 // put in RequestNavigationParams. Parameters only used by the current 178 // put in RequestNavigationParams. Parameters only used by the current
172 // architecture should go in StartNavigationParams. 179 // architecture should go in StartNavigationParams.
173 180
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
323 ~NavigationParams(); 330 ~NavigationParams();
324 331
325 CommonNavigationParams common_params; 332 CommonNavigationParams common_params;
326 StartNavigationParams start_params; 333 StartNavigationParams start_params;
327 RequestNavigationParams request_params; 334 RequestNavigationParams request_params;
328 }; 335 };
329 336
330 } // namespace content 337 } // namespace content
331 338
332 #endif // CONTENT_COMMON_NAVIGATION_PARAMS_H_ 339 #endif // CONTENT_COMMON_NAVIGATION_PARAMS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698