OLD | NEW |
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 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
252 } | 253 } |
253 | 254 |
254 RecordUniqueNameLength(unique_name.size()); | 255 RecordUniqueNameLength(unique_name.size()); |
255 render_manager_.OnDidUpdateName(name, unique_name); | 256 render_manager_.OnDidUpdateName(name, unique_name); |
256 replication_state_.name = name; | 257 replication_state_.name = name; |
257 replication_state_.unique_name = unique_name; | 258 replication_state_.unique_name = unique_name; |
258 } | 259 } |
259 | 260 |
260 void FrameTreeNode::SetFeaturePolicyHeader( | 261 void FrameTreeNode::SetFeaturePolicyHeader( |
261 const ParsedFeaturePolicyHeader& parsed_header) { | 262 const ParsedFeaturePolicyHeader& parsed_header) { |
| 263 ResetFeaturePolicy(); |
262 replication_state_.feature_policy_header = parsed_header; | 264 replication_state_.feature_policy_header = parsed_header; |
| 265 feature_policy_->SetHeaderPolicy(parsed_header); |
263 } | 266 } |
264 | 267 |
265 void FrameTreeNode::ResetFeaturePolicy() { | 268 void FrameTreeNode::ResetFeaturePolicy() { |
266 replication_state_.feature_policy_header.clear(); | 269 replication_state_.feature_policy_header.clear(); |
| 270 FeaturePolicy* parent_policy = |
| 271 parent() ? parent()->feature_policy_.get() : nullptr; |
| 272 feature_policy_ = |
| 273 FeaturePolicy::CreateFromParentPolicy(parent_policy, current_origin()); |
267 } | 274 } |
268 | 275 |
269 void FrameTreeNode::AddContentSecurityPolicy( | 276 void FrameTreeNode::AddContentSecurityPolicy( |
270 const ContentSecurityPolicyHeader& header) { | 277 const ContentSecurityPolicyHeader& header) { |
271 replication_state_.accumulated_csp_headers.push_back(header); | 278 replication_state_.accumulated_csp_headers.push_back(header); |
272 render_manager_.OnDidAddContentSecurityPolicy(header); | 279 render_manager_.OnDidAddContentSecurityPolicy(header); |
273 } | 280 } |
274 | 281 |
275 void FrameTreeNode::ResetContentSecurityPolicy() { | 282 void FrameTreeNode::ResetContentSecurityPolicy() { |
276 replication_state_.accumulated_csp_headers.clear(); | 283 replication_state_.accumulated_csp_headers.clear(); |
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
528 } | 535 } |
529 return parent_->child_at(i + relative_offset); | 536 return parent_->child_at(i + relative_offset); |
530 } | 537 } |
531 } | 538 } |
532 | 539 |
533 NOTREACHED() << "FrameTreeNode not found in its parent's children."; | 540 NOTREACHED() << "FrameTreeNode not found in its parent's children."; |
534 return nullptr; | 541 return nullptr; |
535 } | 542 } |
536 | 543 |
537 } // namespace content | 544 } // namespace content |
OLD | NEW |