 Chromium Code Reviews
 Chromium Code Reviews Issue 2797813002:
  Replicate feature policy container policies.  (Closed)
    
  
    Issue 2797813002:
  Replicate feature policy container policies.  (Closed) 
  | 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; | |
| 
alexmos
2017/04/11 01:17:49
This is expected to only done for subframe nodes,
 
iclelland
2017/04/11 17:41:43
That's correct; there is no situation where the co
 | |
| 327 } | |
| 328 | |
| 324 bool FrameTreeNode::IsDescendantOf(FrameTreeNode* other) const { | 329 bool FrameTreeNode::IsDescendantOf(FrameTreeNode* other) const { | 
| 325 if (!other || !other->child_count()) | 330 if (!other || !other->child_count()) | 
| 326 return false; | 331 return false; | 
| 327 | 332 | 
| 328 for (FrameTreeNode* node = parent(); node; node = node->parent()) { | 333 for (FrameTreeNode* node = parent(); node; node = node->parent()) { | 
| 329 if (node == other) | 334 if (node == other) | 
| 330 return true; | 335 return true; | 
| 331 } | 336 } | 
| 332 | 337 | 
| 333 return false; | 338 return false; | 
| (...skipping 23 matching lines...) Expand all Loading... | |
| 357 render_manager_.speculative_frame_host(); | 362 render_manager_.speculative_frame_host(); | 
| 358 if (speculative_frame_host && speculative_frame_host->is_loading()) | 363 if (speculative_frame_host && speculative_frame_host->is_loading()) | 
| 359 return true; | 364 return true; | 
| 360 } else { | 365 } else { | 
| 361 if (pending_frame_host && pending_frame_host->is_loading()) | 366 if (pending_frame_host && pending_frame_host->is_loading()) | 
| 362 return true; | 367 return true; | 
| 363 } | 368 } | 
| 364 return current_frame_host->is_loading(); | 369 return current_frame_host->is_loading(); | 
| 365 } | 370 } | 
| 366 | 371 | 
| 367 bool FrameTreeNode::CommitPendingSandboxFlags() { | 372 bool FrameTreeNode::CommitPendingFramePolicy() { | 
| 368 bool did_change_flags = | 373 bool did_change_flags = | 
| 369 pending_sandbox_flags_ != replication_state_.sandbox_flags; | 374 pending_sandbox_flags_ != replication_state_.sandbox_flags; | 
| 370 replication_state_.sandbox_flags = pending_sandbox_flags_; | 375 bool did_change_container_policy = | 
| 371 return did_change_flags; | 376 pending_container_policy_ != replication_state_.container_policy; | 
| 377 if (did_change_flags) | |
| 378 replication_state_.sandbox_flags = pending_sandbox_flags_; | |
| 379 if (did_change_container_policy) | |
| 380 replication_state_.container_policy = pending_container_policy_; | |
| 381 return did_change_flags || did_change_container_policy; | |
| 372 } | 382 } | 
| 373 | 383 | 
| 374 void FrameTreeNode::CreatedNavigationRequest( | 384 void FrameTreeNode::CreatedNavigationRequest( | 
| 375 std::unique_ptr<NavigationRequest> navigation_request) { | 385 std::unique_ptr<NavigationRequest> navigation_request) { | 
| 376 CHECK(IsBrowserSideNavigationEnabled()); | 386 CHECK(IsBrowserSideNavigationEnabled()); | 
| 377 | 387 | 
| 378 // This is never called when navigating to a Javascript URL. For the loading | 388 // 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 | 389 // state, this matches what Blink is doing: Blink doesn't send throbber | 
| 380 // notifications for Javascript URLS. | 390 // notifications for Javascript URLS. | 
| 381 DCHECK(!navigation_request->common_params().url.SchemeIs( | 391 DCHECK(!navigation_request->common_params().url.SchemeIs( | 
| (...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 553 } | 563 } | 
| 554 return parent_->child_at(i + relative_offset); | 564 return parent_->child_at(i + relative_offset); | 
| 555 } | 565 } | 
| 556 } | 566 } | 
| 557 | 567 | 
| 558 NOTREACHED() << "FrameTreeNode not found in its parent's children."; | 568 NOTREACHED() << "FrameTreeNode not found in its parent's children."; | 
| 559 return nullptr; | 569 return nullptr; | 
| 560 } | 570 } | 
| 561 | 571 | 
| 562 } // namespace content | 572 } // namespace content | 
| OLD | NEW |