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 // This should only be called on subframes; container policy is not mutable on |
| 327 // main frame. |
| 328 DCHECK(!IsMainFrame()); |
| 329 pending_container_policy_ = container_policy; |
| 330 } |
| 331 |
324 bool FrameTreeNode::IsDescendantOf(FrameTreeNode* other) const { | 332 bool FrameTreeNode::IsDescendantOf(FrameTreeNode* other) const { |
325 if (!other || !other->child_count()) | 333 if (!other || !other->child_count()) |
326 return false; | 334 return false; |
327 | 335 |
328 for (FrameTreeNode* node = parent(); node; node = node->parent()) { | 336 for (FrameTreeNode* node = parent(); node; node = node->parent()) { |
329 if (node == other) | 337 if (node == other) |
330 return true; | 338 return true; |
331 } | 339 } |
332 | 340 |
333 return false; | 341 return false; |
(...skipping 23 matching lines...) Expand all Loading... |
357 render_manager_.speculative_frame_host(); | 365 render_manager_.speculative_frame_host(); |
358 if (speculative_frame_host && speculative_frame_host->is_loading()) | 366 if (speculative_frame_host && speculative_frame_host->is_loading()) |
359 return true; | 367 return true; |
360 } else { | 368 } else { |
361 if (pending_frame_host && pending_frame_host->is_loading()) | 369 if (pending_frame_host && pending_frame_host->is_loading()) |
362 return true; | 370 return true; |
363 } | 371 } |
364 return current_frame_host->is_loading(); | 372 return current_frame_host->is_loading(); |
365 } | 373 } |
366 | 374 |
367 bool FrameTreeNode::CommitPendingSandboxFlags() { | 375 bool FrameTreeNode::CommitPendingFramePolicy() { |
368 bool did_change_flags = | 376 bool did_change_flags = |
369 pending_sandbox_flags_ != replication_state_.sandbox_flags; | 377 pending_sandbox_flags_ != replication_state_.sandbox_flags; |
370 replication_state_.sandbox_flags = pending_sandbox_flags_; | 378 bool did_change_container_policy = |
371 return did_change_flags; | 379 pending_container_policy_ != replication_state_.container_policy; |
| 380 if (did_change_flags) |
| 381 replication_state_.sandbox_flags = pending_sandbox_flags_; |
| 382 if (did_change_container_policy) |
| 383 replication_state_.container_policy = pending_container_policy_; |
| 384 return did_change_flags || did_change_container_policy; |
372 } | 385 } |
373 | 386 |
374 void FrameTreeNode::CreatedNavigationRequest( | 387 void FrameTreeNode::CreatedNavigationRequest( |
375 std::unique_ptr<NavigationRequest> navigation_request) { | 388 std::unique_ptr<NavigationRequest> navigation_request) { |
376 CHECK(IsBrowserSideNavigationEnabled()); | 389 CHECK(IsBrowserSideNavigationEnabled()); |
377 | 390 |
378 // This is never called when navigating to a Javascript URL. For the loading | 391 // 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 | 392 // state, this matches what Blink is doing: Blink doesn't send throbber |
380 // notifications for Javascript URLS. | 393 // notifications for Javascript URLS. |
381 DCHECK(!navigation_request->common_params().url.SchemeIs( | 394 DCHECK(!navigation_request->common_params().url.SchemeIs( |
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
553 } | 566 } |
554 return parent_->child_at(i + relative_offset); | 567 return parent_->child_at(i + relative_offset); |
555 } | 568 } |
556 } | 569 } |
557 | 570 |
558 NOTREACHED() << "FrameTreeNode not found in its parent's children."; | 571 NOTREACHED() << "FrameTreeNode not found in its parent's children."; |
559 return nullptr; | 572 return nullptr; |
560 } | 573 } |
561 | 574 |
562 } // namespace content | 575 } // namespace content |
OLD | NEW |