Chromium Code Reviews| 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" |
| (...skipping 303 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 314 | 314 |
| 315 void FrameTreeNode::SetPendingSandboxFlags( | 315 void FrameTreeNode::SetPendingSandboxFlags( |
| 316 blink::WebSandboxFlags sandbox_flags) { | 316 blink::WebSandboxFlags sandbox_flags) { |
| 317 pending_sandbox_flags_ = sandbox_flags; | 317 pending_sandbox_flags_ = sandbox_flags; |
| 318 | 318 |
| 319 // Subframes should always inherit their parent's sandbox flags. | 319 // Subframes should always inherit their parent's sandbox flags. |
| 320 if (parent()) | 320 if (parent()) |
| 321 pending_sandbox_flags_ |= parent()->effective_sandbox_flags(); | 321 pending_sandbox_flags_ |= parent()->effective_sandbox_flags(); |
| 322 } | 322 } |
| 323 | 323 |
| 324 void FrameTreeNode::SetPendingContainerPolicy( | |
| 325 const ParsedFeaturePolicyHeader& container_policy) { | |
| 326 pending_container_policy_ = container_policy; | |
| 327 | |
| 328 // Validate that inherited policy matches? | |
|
iclelland
2017/04/05 02:19:07
This isn't necessary; the container policy can be
| |
| 329 } | |
| 330 | |
| 324 bool FrameTreeNode::IsDescendantOf(FrameTreeNode* other) const { | 331 bool FrameTreeNode::IsDescendantOf(FrameTreeNode* other) const { |
| 325 if (!other || !other->child_count()) | 332 if (!other || !other->child_count()) |
| 326 return false; | 333 return false; |
| 327 | 334 |
| 328 for (FrameTreeNode* node = parent(); node; node = node->parent()) { | 335 for (FrameTreeNode* node = parent(); node; node = node->parent()) { |
| 329 if (node == other) | 336 if (node == other) |
| 330 return true; | 337 return true; |
| 331 } | 338 } |
| 332 | 339 |
| 333 return false; | 340 return false; |
| (...skipping 23 matching lines...) Expand all Loading... | |
| 357 render_manager_.speculative_frame_host(); | 364 render_manager_.speculative_frame_host(); |
| 358 if (speculative_frame_host && speculative_frame_host->is_loading()) | 365 if (speculative_frame_host && speculative_frame_host->is_loading()) |
| 359 return true; | 366 return true; |
| 360 } else { | 367 } else { |
| 361 if (pending_frame_host && pending_frame_host->is_loading()) | 368 if (pending_frame_host && pending_frame_host->is_loading()) |
| 362 return true; | 369 return true; |
| 363 } | 370 } |
| 364 return current_frame_host->is_loading(); | 371 return current_frame_host->is_loading(); |
| 365 } | 372 } |
| 366 | 373 |
| 367 bool FrameTreeNode::CommitPendingSandboxFlags() { | 374 bool FrameTreeNode::CommitPendingFramePolicy() { |
| 368 bool did_change_flags = | 375 bool did_change_flags = |
| 369 pending_sandbox_flags_ != replication_state_.sandbox_flags; | 376 pending_sandbox_flags_ != replication_state_.sandbox_flags || |
| 377 pending_container_policy_ != replication_state_.container_policy; | |
| 370 replication_state_.sandbox_flags = pending_sandbox_flags_; | 378 replication_state_.sandbox_flags = pending_sandbox_flags_; |
| 379 replication_state_.container_policy = pending_container_policy_; | |
| 371 return did_change_flags; | 380 return did_change_flags; |
| 372 } | 381 } |
| 373 | 382 |
| 374 void FrameTreeNode::CreatedNavigationRequest( | 383 void FrameTreeNode::CreatedNavigationRequest( |
| 375 std::unique_ptr<NavigationRequest> navigation_request) { | 384 std::unique_ptr<NavigationRequest> navigation_request) { |
| 376 CHECK(IsBrowserSideNavigationEnabled()); | 385 CHECK(IsBrowserSideNavigationEnabled()); |
| 377 | 386 |
| 378 // This is never called when navigating to a Javascript URL. For the loading | 387 // This is never called when navigating to a Javascript URL. For the loading |
| 379 // state, this matches what Blink is doing: Blink doesn't send throbber | 388 // state, this matches what Blink is doing: Blink doesn't send throbber |
| 380 // notifications for Javascript URLS. | 389 // notifications for Javascript URLS. |
| (...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 573 } | 582 } |
| 574 return parent_->child_at(i + relative_offset); | 583 return parent_->child_at(i + relative_offset); |
| 575 } | 584 } |
| 576 } | 585 } |
| 577 | 586 |
| 578 NOTREACHED() << "FrameTreeNode not found in its parent's children."; | 587 NOTREACHED() << "FrameTreeNode not found in its parent's children."; |
| 579 return nullptr; | 588 return nullptr; |
| 580 } | 589 } |
| 581 | 590 |
| 582 } // namespace content | 591 } // namespace content |
| OLD | NEW |