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

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

Issue 2655463006: PlzNavigate: Enforce 'frame-src' CSP on the browser. (Closed)
Patch Set: Addressed comments Created 3 years, 9 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/render_frame_host_impl.h
diff --git a/content/browser/frame_host/render_frame_host_impl.h b/content/browser/frame_host/render_frame_host_impl.h
index 74ee70b1b2541002d192b8df3fbf34ed5a768c1a..adcd5a411b76010899c1249b2bc12c76395985e6 100644
--- a/content/browser/frame_host/render_frame_host_impl.h
+++ b/content/browser/frame_host/render_frame_host_impl.h
@@ -30,7 +30,7 @@
#include "content/common/accessibility_mode_enums.h"
#include "content/common/ax_content_node_data.h"
#include "content/common/content_export.h"
-#include "content/common/content_security_policy/content_security_policy.h"
+#include "content/common/content_security_policy/csp_context.h"
#include "content/common/download/mhtml_save_status.h"
#include "content/common/frame.mojom.h"
#include "content/common/frame_message_enums.h"
@@ -115,7 +115,8 @@ class CONTENT_EXPORT RenderFrameHostImpl
public BrowserAccessibilityDelegate,
public SiteInstanceImpl::Observer,
public NON_EXPORTED_BASE(
- service_manager::InterfaceFactory<media::mojom::InterfaceFactory>) {
+ service_manager::InterfaceFactory<media::mojom::InterfaceFactory>),
+ public CSPContext {
public:
using AXTreeSnapshotCallback =
base::Callback<void(
@@ -208,6 +209,12 @@ class CONTENT_EXPORT RenderFrameHostImpl
// SiteInstanceImpl::Observer
void RenderProcessGone(SiteInstanceImpl* site_instance) override;
+ // CSPContext
+ void LogToConsole(const std::string& message) override;
+ void ReportContentSecurityPolicyViolation(
+ const CSPViolationParams& violation_params) override;
+ bool SchemeShouldBypassCSP(const base::StringPiece& scheme) override;
+
// Creates a RenderFrame in the renderer process.
bool CreateRenderFrame(int proxy_routing_id,
int opener_routing_id,
@@ -246,6 +253,9 @@ class CONTENT_EXPORT RenderFrameHostImpl
const mojom::CreateNewWindowParams& params,
SessionStorageNamespace* session_storage_namespace);
+ // Update this frame's last committed origin.
+ void SetLastCommittedOrigin(const url::Origin& origin);
+
RenderViewHostImpl* render_view_host() { return render_view_host_; }
RenderFrameHostDelegate* delegate() { return delegate_; }
FrameTreeNode* frame_tree_node() { return frame_tree_node_; }
@@ -266,11 +276,6 @@ class CONTENT_EXPORT RenderFrameHostImpl
last_successful_url_ = url;
}
- // Update this frame's last committed origin.
- void set_last_committed_origin(const url::Origin& origin) {
- last_committed_origin_ = origin;
- }
-
// Returns the associated WebUI or null if none applies.
WebUIImpl* web_ui() const { return web_ui_.get(); }
@@ -711,9 +716,15 @@ class CONTENT_EXPORT RenderFrameHostImpl
void OnDidChangeName(const std::string& name, const std::string& unique_name);
void OnDidSetFeaturePolicyHeader(
const ParsedFeaturePolicyHeader& parsed_header);
+
+ // A CSP |header| has been added.
+ // RFC2616, section 4.2 specifies that headers appearing multiple times can be
+ // combined with a comma. Hence zero, one or several |policies| are added to
+ // the document.
void OnDidAddContentSecurityPolicy(
const ContentSecurityPolicyHeader& header,
- const std::vector<ContentSecurityPolicy>& policy);
+ const std::vector<ContentSecurityPolicy>& policies);
+
void OnEnforceInsecureRequestPolicy(blink::WebInsecureRequestPolicy policy);
void OnUpdateToUniqueOrigin(bool is_potentially_trustworthy_unique_origin);
void OnDidChangeSandboxFlags(int32_t frame_routing_id,

Powered by Google App Engine
This is Rietveld 408576698