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

Unified Diff: content/browser/frame_host/navigation_request.h

Issue 2909513002: Move PlzNavigate frame-src CSP check to NavigationRequest (Closed)
Patch Set: comment tweaks Created 3 years, 7 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
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);
Mike West 2017/05/30 07:27:51 Style nit: If this was blink, I'd ask for this to
estark 2017/06/01 04:12:51 Nasko: any preference? Personally I'd be more incl
nasko 2017/06/05 20:46:30 bools are used quite a bit through content/, so I'
estark 2017/06/06 00:38:03 Acknowledged.
+
FrameTreeNode* frame_tree_node_;
// Initialized on creation of the NavigationRequest. Sent to the renderer when

Powered by Google App Engine
This is Rietveld 408576698