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

Side by Side Diff: content/browser/frame_host/navigation_request.h

Issue 2909513002: Move PlzNavigate frame-src CSP check to NavigationRequest (Closed)
Patch Set: rebase Created 3 years, 6 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_BROWSER_FRAME_HOST_NAVIGATION_REQUEST_H_ 5 #ifndef CONTENT_BROWSER_FRAME_HOST_NAVIGATION_REQUEST_H_
6 #define CONTENT_BROWSER_FRAME_HOST_NAVIGATION_REQUEST_H_ 6 #define CONTENT_BROWSER_FRAME_HOST_NAVIGATION_REQUEST_H_
7 7
8 #include <memory> 8 #include <memory>
9 9
10 #include "base/callback_forward.h" 10 #include "base/callback_forward.h"
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
167 RenderFrameHostImpl* render_frame_host); 167 RenderFrameHostImpl* render_frame_host);
168 168
169 void set_on_start_checks_complete_closure_for_testing( 169 void set_on_start_checks_complete_closure_for_testing(
170 const base::Closure& closure) { 170 const base::Closure& closure) {
171 on_start_checks_complete_closure_ = closure; 171 on_start_checks_complete_closure_ = closure;
172 } 172 }
173 173
174 int nav_entry_id() const { return nav_entry_id_; } 174 int nav_entry_id() const { return nav_entry_id_; }
175 175
176 private: 176 private:
177 // This enum describes the result of a Content Security Policy (CSP) check for
178 // the request.
179 enum ContentSecurityPolicyCheckResult {
180 // The request should be allowed to continue. PASSED could mean that the
181 // request did not violate any CSP, or that it violated a report-only CSP.
182 CONTENT_SECURITY_POLICY_CHECK_PASSED,
183 // The request should be blocked because it violated an enforced CSP.
184 CONTENT_SECURITY_POLICY_CHECK_FAILED,
185 };
186
177 NavigationRequest(FrameTreeNode* frame_tree_node, 187 NavigationRequest(FrameTreeNode* frame_tree_node,
178 const CommonNavigationParams& common_params, 188 const CommonNavigationParams& common_params,
179 const BeginNavigationParams& begin_params, 189 const BeginNavigationParams& begin_params,
180 const RequestNavigationParams& request_params, 190 const RequestNavigationParams& request_params,
181 bool browser_initiated, 191 bool browser_initiated,
182 bool may_transfer, 192 bool may_transfer,
183 const FrameNavigationEntry* frame_navigation_entry, 193 const FrameNavigationEntry* frame_navigation_entry,
184 const NavigationEntryImpl* navitation_entry); 194 const NavigationEntryImpl* navitation_entry);
185 195
186 // NavigationURLLoaderDelegate implementation. 196 // NavigationURLLoaderDelegate implementation.
(...skipping 15 matching lines...) Expand all
202 // NavigationHandle. 212 // NavigationHandle.
203 void OnStartChecksComplete(NavigationThrottle::ThrottleCheckResult result); 213 void OnStartChecksComplete(NavigationThrottle::ThrottleCheckResult result);
204 void OnRedirectChecksComplete(NavigationThrottle::ThrottleCheckResult result); 214 void OnRedirectChecksComplete(NavigationThrottle::ThrottleCheckResult result);
205 void OnWillProcessResponseChecksComplete( 215 void OnWillProcessResponseChecksComplete(
206 NavigationThrottle::ThrottleCheckResult result); 216 NavigationThrottle::ThrottleCheckResult result);
207 217
208 // Have a RenderFrameHost commit the navigation. The NavigationRequest will 218 // Have a RenderFrameHost commit the navigation. The NavigationRequest will
209 // be destroyed after this call. 219 // be destroyed after this call.
210 void CommitNavigation(); 220 void CommitNavigation();
211 221
222 // Check whether a request should be allowed to continue or should be blocked
223 // because it violates a CSP. This method can have two side effects:
224 // - If a CSP is configured to send reports and the request violates the CSP,
225 // a report will be sent.
226 // - The navigation request may be upgraded from HTTP to HTTPS if a CSP is
227 // configured to upgrade insecure requests.
228 ContentSecurityPolicyCheckResult CheckContentSecurityPolicyFrameSrc(
229 bool is_redirect);
230
212 FrameTreeNode* frame_tree_node_; 231 FrameTreeNode* frame_tree_node_;
213 232
214 // Initialized on creation of the NavigationRequest. Sent to the renderer when 233 // Initialized on creation of the NavigationRequest. Sent to the renderer when
215 // the navigation is ready to commit. 234 // the navigation is ready to commit.
216 // Note: When the navigation is ready to commit, the url in |common_params| 235 // Note: When the navigation is ready to commit, the url in |common_params|
217 // will be set to the final navigation url, obtained after following all 236 // will be set to the final navigation url, obtained after following all
218 // redirects. 237 // redirects.
219 // Note: |common_params_| and |begin_params_| are not const as they can be 238 // Note: |common_params_| and |begin_params_| are not const as they can be
220 // modified during redirects. 239 // modified during redirects.
221 // Note: |request_params_| is not const because service_worker_provider_id 240 // Note: |request_params_| is not const because service_worker_provider_id
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
265 mojo::ScopedDataPipeConsumerHandle handle_; 284 mojo::ScopedDataPipeConsumerHandle handle_;
266 285
267 base::Closure on_start_checks_complete_closure_; 286 base::Closure on_start_checks_complete_closure_;
268 287
269 DISALLOW_COPY_AND_ASSIGN(NavigationRequest); 288 DISALLOW_COPY_AND_ASSIGN(NavigationRequest);
270 }; 289 };
271 290
272 } // namespace content 291 } // namespace content
273 292
274 #endif // CONTENT_BROWSER_FRAME_HOST_NAVIGATION_REQUEST_H_ 293 #endif // CONTENT_BROWSER_FRAME_HOST_NAVIGATION_REQUEST_H_
OLDNEW
« no previous file with comments | « content/browser/frame_host/ancestor_throttle.cc ('k') | content/browser/frame_host/navigation_request.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698