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

Unified 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 side-by-side diff with in-line comments
Download patch
« 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 »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/frame_host/navigation_request.h
diff --git a/content/browser/frame_host/navigation_request.h b/content/browser/frame_host/navigation_request.h
index 12b3e7ef5414ddf4c634f1a32081a5690de1712c..9024de2a383182cb5c61fa368b8c088dbd51c274 100644
--- a/content/browser/frame_host/navigation_request.h
+++ b/content/browser/frame_host/navigation_request.h
@@ -174,6 +174,16 @@ class CONTENT_EXPORT NavigationRequest : public NavigationURLLoaderDelegate {
int nav_entry_id() const { return nav_entry_id_; }
private:
+ // This enum describes the result of a Content Security Policy (CSP) check for
+ // the request.
+ enum ContentSecurityPolicyCheckResult {
+ // The request should be allowed to continue. PASSED could mean that the
+ // request did not violate any CSP, or that it violated a report-only CSP.
+ CONTENT_SECURITY_POLICY_CHECK_PASSED,
+ // The request should be blocked because it violated an enforced CSP.
+ CONTENT_SECURITY_POLICY_CHECK_FAILED,
+ };
+
NavigationRequest(FrameTreeNode* frame_tree_node,
const CommonNavigationParams& common_params,
const BeginNavigationParams& begin_params,
@@ -209,6 +219,15 @@ class CONTENT_EXPORT NavigationRequest : public NavigationURLLoaderDelegate {
// be destroyed after this call.
void CommitNavigation();
+ // Check whether a request should be allowed to continue or should be blocked
+ // because it violates a CSP. This method can have two side effects:
+ // - If a CSP is configured to send reports and the request violates the CSP,
+ // a report will be sent.
+ // - The navigation request may be upgraded from HTTP to HTTPS if a CSP is
+ // configured to upgrade insecure requests.
+ ContentSecurityPolicyCheckResult CheckContentSecurityPolicyFrameSrc(
+ bool is_redirect);
+
FrameTreeNode* frame_tree_node_;
// Initialized on creation of the NavigationRequest. Sent to the renderer when
« 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