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

Unified Diff: content/browser/frame_host/frame_tree_node.cc

Issue 2655663004: Introduce content-side Feature Policy object and maintain in parallel with renderer policy. (Closed)
Patch Set: Move FeaturePolicy to RenderFrameHostImpl Created 3 years, 10 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/frame_tree_node.cc
diff --git a/content/browser/frame_host/frame_tree_node.cc b/content/browser/frame_host/frame_tree_node.cc
index 4ec94a661a226da74628f9462a2f8ca40c52ca3a..f590625f40fec2d732bf55368c8bee6129c12b98 100644
--- a/content/browser/frame_host/frame_tree_node.cc
+++ b/content/browser/frame_host/frame_tree_node.cc
@@ -18,6 +18,7 @@
#include "content/browser/frame_host/navigator.h"
#include "content/browser/frame_host/render_frame_host_impl.h"
#include "content/browser/renderer_host/render_view_host_impl.h"
+#include "content/common/feature_policy/feature_policy.h"
#include "content/common/frame_messages.h"
#include "content/common/site_isolation_policy.h"
#include "content/public/browser/browser_thread.h"
@@ -283,11 +284,17 @@ void FrameTreeNode::SetFrameName(const std::string& name,
void FrameTreeNode::SetFeaturePolicyHeader(
const ParsedFeaturePolicyHeader& parsed_header) {
+ ResetFeaturePolicy();
replication_state_.feature_policy_header = parsed_header;
+ current_frame_host()->GetFeaturePolicy()->SetHeaderPolicy(parsed_header);
alexmos 2017/02/07 00:21:35 Could we move this call to RFHI::OnDidSetFeaturePo
iclelland 2017/02/08 05:14:42 Done -- you're absolutely right that it doesn't ma
}
void FrameTreeNode::ResetFeaturePolicy() {
replication_state_.feature_policy_header.clear();
+ FeaturePolicy* parent_policy =
+ parent() ? parent()->current_frame_host()->GetFeaturePolicy() : nullptr;
+ current_frame_host()->SetFeaturePolicy(
alexmos 2017/02/07 00:21:35 Similarly, it might be safer to call this on the r
iclelland 2017/02/07 15:47:37 I can definitely do that -- and it brings up the i
alexmos 2017/02/07 23:15:15 Right, at the point where ResetFeaturePolicy is ca
iclelland 2017/02/08 05:14:42 That's what I've done in the latest patch.
+ FeaturePolicy::CreateFromParentPolicy(parent_policy, current_origin()));
}
void FrameTreeNode::AddContentSecurityPolicy(

Powered by Google App Engine
This is Rietveld 408576698