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

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: Rebase 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/macros.h" 10 #include "base/macros.h"
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after
251 } 251 }
252 252
253 RecordUniqueNameLength(unique_name.size()); 253 RecordUniqueNameLength(unique_name.size());
254 render_manager_.OnDidUpdateName(name, unique_name); 254 render_manager_.OnDidUpdateName(name, unique_name);
255 replication_state_.name = name; 255 replication_state_.name = name;
256 replication_state_.unique_name = unique_name; 256 replication_state_.unique_name = unique_name;
257 } 257 }
258 258
259 void FrameTreeNode::SetFeaturePolicyHeader( 259 void FrameTreeNode::SetFeaturePolicyHeader(
260 const ParsedFeaturePolicyHeader& parsed_header) { 260 const ParsedFeaturePolicyHeader& parsed_header) {
261 ResetFeaturePolicy();
261 replication_state_.feature_policy_header = parsed_header; 262 replication_state_.feature_policy_header = parsed_header;
263 feature_policy_->SetHeaderPolicy(parsed_header);
262 } 264 }
263 265
264 void FrameTreeNode::ResetFeaturePolicy() { 266 void FrameTreeNode::ResetFeaturePolicy() {
265 replication_state_.feature_policy_header.clear(); 267 replication_state_.feature_policy_header.clear();
268 if (parent()) {
269 feature_policy_ = FeaturePolicy::CreateFromParentPolicy(
270 parent()->feature_policy_.get(), current_origin());
271 } else {
272 feature_policy_ =
273 FeaturePolicy::CreateFromParentPolicy(nullptr, current_origin());
274 }
raymes 2017/02/01 22:42:20 optional: alternatively: FeaturePolicy* parent_pol
iclelland 2017/02/03 16:38:29 Done.
266 } 275 }
267 276
268 void FrameTreeNode::AddContentSecurityPolicy( 277 void FrameTreeNode::AddContentSecurityPolicy(
269 const ContentSecurityPolicyHeader& header) { 278 const ContentSecurityPolicyHeader& header) {
270 replication_state_.accumulated_csp_headers.push_back(header); 279 replication_state_.accumulated_csp_headers.push_back(header);
271 render_manager_.OnDidAddContentSecurityPolicy(header); 280 render_manager_.OnDidAddContentSecurityPolicy(header);
272 } 281 }
273 282
274 void FrameTreeNode::ResetContentSecurityPolicy() { 283 void FrameTreeNode::ResetContentSecurityPolicy() {
275 replication_state_.accumulated_csp_headers.clear(); 284 replication_state_.accumulated_csp_headers.clear();
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after
527 } 536 }
528 return parent_->child_at(i + relative_offset); 537 return parent_->child_at(i + relative_offset);
529 } 538 }
530 } 539 }
531 540
532 NOTREACHED() << "FrameTreeNode not found in its parent's children."; 541 NOTREACHED() << "FrameTreeNode not found in its parent's children.";
533 return nullptr; 542 return nullptr;
534 } 543 }
535 544
536 } // namespace content 545 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698