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 <algorithm> |
7 #include <queue> | 8 #include <queue> |
8 #include <utility> | 9 #include <utility> |
9 | 10 |
10 #include "base/macros.h" | 11 #include "base/macros.h" |
11 #include "base/memory/ptr_util.h" | 12 #include "base/memory/ptr_util.h" |
12 #include "base/metrics/histogram_macros.h" | 13 #include "base/metrics/histogram_macros.h" |
13 #include "base/profiler/scoped_tracker.h" | 14 #include "base/profiler/scoped_tracker.h" |
14 #include "base/stl_util.h" | 15 #include "base/stl_util.h" |
15 #include "content/browser/frame_host/frame_tree.h" | 16 #include "content/browser/frame_host/frame_tree.h" |
16 #include "content/browser/frame_host/navigation_request.h" | 17 #include "content/browser/frame_host/navigation_request.h" |
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
242 const ContentSecurityPolicyHeader& header) { | 243 const ContentSecurityPolicyHeader& header) { |
243 replication_state_.accumulated_csp_headers.push_back(header); | 244 replication_state_.accumulated_csp_headers.push_back(header); |
244 render_manager_.OnDidAddContentSecurityPolicy(header); | 245 render_manager_.OnDidAddContentSecurityPolicy(header); |
245 } | 246 } |
246 | 247 |
247 void FrameTreeNode::ResetContentSecurityPolicy() { | 248 void FrameTreeNode::ResetContentSecurityPolicy() { |
248 replication_state_.accumulated_csp_headers.clear(); | 249 replication_state_.accumulated_csp_headers.clear(); |
249 render_manager_.OnDidResetContentSecurityPolicy(); | 250 render_manager_.OnDidResetContentSecurityPolicy(); |
250 } | 251 } |
251 | 252 |
| 253 bool FrameTreeNode::ContainsContentSecurityPolicyHeader( |
| 254 const std::string& header_value_to_find) { |
| 255 return std::any_of( |
| 256 replication_state_.accumulated_csp_headers.begin(), |
| 257 replication_state_.accumulated_csp_headers.end(), |
| 258 [&header_value_to_find]( |
| 259 const ContentSecurityPolicyHeader& accumulated_header) { |
| 260 return accumulated_header.header_value == header_value_to_find; |
| 261 }); |
| 262 } |
| 263 |
252 void FrameTreeNode::SetInsecureRequestPolicy( | 264 void FrameTreeNode::SetInsecureRequestPolicy( |
253 blink::WebInsecureRequestPolicy policy) { | 265 blink::WebInsecureRequestPolicy policy) { |
254 if (policy == replication_state_.insecure_request_policy) | 266 if (policy == replication_state_.insecure_request_policy) |
255 return; | 267 return; |
256 render_manager_.OnEnforceInsecureRequestPolicy(policy); | 268 render_manager_.OnEnforceInsecureRequestPolicy(policy); |
257 replication_state_.insecure_request_policy = policy; | 269 replication_state_.insecure_request_policy = policy; |
258 } | 270 } |
259 | 271 |
260 void FrameTreeNode::SetPendingSandboxFlags( | 272 void FrameTreeNode::SetPendingSandboxFlags( |
261 blink::WebSandboxFlags sandbox_flags) { | 273 blink::WebSandboxFlags sandbox_flags) { |
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
494 } | 506 } |
495 return parent_->child_at(i + relative_offset); | 507 return parent_->child_at(i + relative_offset); |
496 } | 508 } |
497 } | 509 } |
498 | 510 |
499 NOTREACHED() << "FrameTreeNode not found in its parent's children."; | 511 NOTREACHED() << "FrameTreeNode not found in its parent's children."; |
500 return nullptr; | 512 return nullptr; |
501 } | 513 } |
502 | 514 |
503 } // namespace content | 515 } // namespace content |
OLD | NEW |