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

Side by Side 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 unified diff | Download patch
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 #include "content/browser/frame_host/frame_tree_node.h" 5 #include "content/browser/frame_host/frame_tree_node.h"
6 6
7 #include <queue> 7 #include <queue>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/lazy_instance.h" 10 #include "base/lazy_instance.h"
11 #include "base/macros.h" 11 #include "base/macros.h"
12 #include "base/memory/ptr_util.h" 12 #include "base/memory/ptr_util.h"
13 #include "base/metrics/histogram_macros.h" 13 #include "base/metrics/histogram_macros.h"
14 #include "base/profiler/scoped_tracker.h" 14 #include "base/profiler/scoped_tracker.h"
15 #include "base/stl_util.h" 15 #include "base/stl_util.h"
16 #include "content/browser/frame_host/frame_tree.h" 16 #include "content/browser/frame_host/frame_tree.h"
17 #include "content/browser/frame_host/navigation_request.h" 17 #include "content/browser/frame_host/navigation_request.h"
18 #include "content/browser/frame_host/navigator.h" 18 #include "content/browser/frame_host/navigator.h"
19 #include "content/browser/frame_host/render_frame_host_impl.h" 19 #include "content/browser/frame_host/render_frame_host_impl.h"
20 #include "content/browser/renderer_host/render_view_host_impl.h" 20 #include "content/browser/renderer_host/render_view_host_impl.h"
21 #include "content/common/feature_policy/feature_policy.h"
21 #include "content/common/frame_messages.h" 22 #include "content/common/frame_messages.h"
22 #include "content/common/site_isolation_policy.h" 23 #include "content/common/site_isolation_policy.h"
23 #include "content/public/browser/browser_thread.h" 24 #include "content/public/browser/browser_thread.h"
24 #include "content/public/common/browser_side_navigation_policy.h" 25 #include "content/public/common/browser_side_navigation_policy.h"
25 #include "third_party/WebKit/public/web/WebSandboxFlags.h" 26 #include "third_party/WebKit/public/web/WebSandboxFlags.h"
26 27
27 namespace content { 28 namespace content {
28 29
29 namespace { 30 namespace {
30 31
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after
276 } 277 }
277 278
278 RecordUniqueNameLength(unique_name.size()); 279 RecordUniqueNameLength(unique_name.size());
279 render_manager_.OnDidUpdateName(name, unique_name); 280 render_manager_.OnDidUpdateName(name, unique_name);
280 replication_state_.name = name; 281 replication_state_.name = name;
281 replication_state_.unique_name = unique_name; 282 replication_state_.unique_name = unique_name;
282 } 283 }
283 284
284 void FrameTreeNode::SetFeaturePolicyHeader( 285 void FrameTreeNode::SetFeaturePolicyHeader(
285 const ParsedFeaturePolicyHeader& parsed_header) { 286 const ParsedFeaturePolicyHeader& parsed_header) {
287 ResetFeaturePolicy();
286 replication_state_.feature_policy_header = parsed_header; 288 replication_state_.feature_policy_header = parsed_header;
289 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
287 } 290 }
288 291
289 void FrameTreeNode::ResetFeaturePolicy() { 292 void FrameTreeNode::ResetFeaturePolicy() {
290 replication_state_.feature_policy_header.clear(); 293 replication_state_.feature_policy_header.clear();
294 FeaturePolicy* parent_policy =
295 parent() ? parent()->current_frame_host()->GetFeaturePolicy() : nullptr;
296 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.
297 FeaturePolicy::CreateFromParentPolicy(parent_policy, current_origin()));
291 } 298 }
292 299
293 void FrameTreeNode::AddContentSecurityPolicy( 300 void FrameTreeNode::AddContentSecurityPolicy(
294 const ContentSecurityPolicyHeader& header) { 301 const ContentSecurityPolicyHeader& header) {
295 replication_state_.accumulated_csp_headers.push_back(header); 302 replication_state_.accumulated_csp_headers.push_back(header);
296 render_manager_.OnDidAddContentSecurityPolicy(header); 303 render_manager_.OnDidAddContentSecurityPolicy(header);
297 } 304 }
298 305
299 void FrameTreeNode::ResetContentSecurityPolicy() { 306 void FrameTreeNode::ResetContentSecurityPolicy() {
300 replication_state_.accumulated_csp_headers.clear(); 307 replication_state_.accumulated_csp_headers.clear();
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after
552 } 559 }
553 return parent_->child_at(i + relative_offset); 560 return parent_->child_at(i + relative_offset);
554 } 561 }
555 } 562 }
556 563
557 NOTREACHED() << "FrameTreeNode not found in its parent's children."; 564 NOTREACHED() << "FrameTreeNode not found in its parent's children.";
558 return nullptr; 565 return nullptr;
559 } 566 }
560 567
561 } // namespace content 568 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698