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/render_frame_host_manager.h" | 5 #include "content/browser/frame_host/render_frame_host_manager.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 417 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 428 // FrameTreeNode that it stopped loading. | 428 // FrameTreeNode that it stopped loading. |
| 429 if (!frame_tree_node_->IsLoading() && frame_tree_node_was_loading) | 429 if (!frame_tree_node_->IsLoading() && frame_tree_node_was_loading) |
| 430 frame_tree_node_->DidStopLoading(); | 430 frame_tree_node_->DidStopLoading(); |
| 431 } | 431 } |
| 432 | 432 |
| 433 void RenderFrameHostManager::DidNavigateFrame( | 433 void RenderFrameHostManager::DidNavigateFrame( |
| 434 RenderFrameHostImpl* render_frame_host, | 434 RenderFrameHostImpl* render_frame_host, |
| 435 bool was_caused_by_user_gesture) { | 435 bool was_caused_by_user_gesture) { |
| 436 CommitPendingIfNecessary(render_frame_host, was_caused_by_user_gesture); | 436 CommitPendingIfNecessary(render_frame_host, was_caused_by_user_gesture); |
| 437 | 437 |
| 438 // Make sure any dynamic changes to this frame's sandbox flags that were made | 438 // Make sure any dynamic changes to this frame's sandbox flags and feature |
| 439 // prior to navigation take effect. | 439 // policy that were made prior to navigation take effect. |
| 440 CommitPendingSandboxFlags(); | 440 CommitPendingFramePolicy(); |
| 441 } | 441 } |
| 442 | 442 |
| 443 void RenderFrameHostManager::CommitPendingIfNecessary( | 443 void RenderFrameHostManager::CommitPendingIfNecessary( |
| 444 RenderFrameHostImpl* render_frame_host, | 444 RenderFrameHostImpl* render_frame_host, |
| 445 bool was_caused_by_user_gesture) { | 445 bool was_caused_by_user_gesture) { |
| 446 if (!pending_render_frame_host_ && !speculative_render_frame_host_) { | 446 if (!pending_render_frame_host_ && !speculative_render_frame_host_) { |
| 447 // There's no pending/speculative RenderFrameHost so it must be that the | 447 // There's no pending/speculative RenderFrameHost so it must be that the |
| 448 // current renderer process completed a navigation. | 448 // current renderer process completed a navigation. |
| 449 | 449 |
| 450 // We should only hear this from our current renderer. | 450 // We should only hear this from our current renderer. |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 530 pending_render_frame_host_->UpdateOpener(); | 530 pending_render_frame_host_->UpdateOpener(); |
| 531 } | 531 } |
| 532 | 532 |
| 533 if (speculative_render_frame_host_ && | 533 if (speculative_render_frame_host_ && |
| 534 speculative_render_frame_host_->GetSiteInstance() != | 534 speculative_render_frame_host_->GetSiteInstance() != |
| 535 source_site_instance) { | 535 source_site_instance) { |
| 536 speculative_render_frame_host_->UpdateOpener(); | 536 speculative_render_frame_host_->UpdateOpener(); |
| 537 } | 537 } |
| 538 } | 538 } |
| 539 | 539 |
| 540 void RenderFrameHostManager::CommitPendingSandboxFlags() { | 540 void RenderFrameHostManager::CommitPendingFramePolicy() { |
| 541 // Return early if there were no pending sandbox flags updates. | 541 // Return early if there were no pending sandbox flags updates. |
|
lunalu1
2017/04/05 22:30:03
nit: update the comment
iclelland
2017/04/09 03:25:54
Done.
| |
| 542 if (!frame_tree_node_->CommitPendingSandboxFlags()) | 542 if (!frame_tree_node_->CommitPendingFramePolicy()) |
| 543 return; | 543 return; |
| 544 | 544 |
| 545 // Sandbox flags updates can only happen when the frame has a parent. | 545 // Policy updates can only happen when the frame has a parent. |
| 546 CHECK(frame_tree_node_->parent()); | 546 CHECK(frame_tree_node_->parent()); |
| 547 | 547 |
| 548 // Notify all of the frame's proxies about updated sandbox flags, excluding | 548 // Notify all of the frame's proxies about updated policies, excluding |
| 549 // the parent process since it already knows the latest flags. | 549 // the parent process since it already knows the latest state. |
| 550 SiteInstance* parent_site_instance = | 550 SiteInstance* parent_site_instance = |
| 551 frame_tree_node_->parent()->current_frame_host()->GetSiteInstance(); | 551 frame_tree_node_->parent()->current_frame_host()->GetSiteInstance(); |
| 552 for (const auto& pair : proxy_hosts_) { | 552 for (const auto& pair : proxy_hosts_) { |
| 553 if (pair.second->GetSiteInstance() != parent_site_instance) { | 553 if (pair.second->GetSiteInstance() != parent_site_instance) { |
| 554 pair.second->Send(new FrameMsg_DidUpdateSandboxFlags( | 554 pair.second->Send(new FrameMsg_DidUpdateFramePolicy( |
| 555 pair.second->GetRoutingID(), | 555 pair.second->GetRoutingID(), |
| 556 frame_tree_node_->current_replication_state().sandbox_flags)); | 556 frame_tree_node_->current_replication_state().sandbox_flags, |
| 557 frame_tree_node_->current_replication_state().container_policy)); | |
| 557 } | 558 } |
| 558 } | 559 } |
| 559 } | 560 } |
| 560 | 561 |
| 561 void RenderFrameHostManager::SwapOutOldFrame( | 562 void RenderFrameHostManager::SwapOutOldFrame( |
| 562 std::unique_ptr<RenderFrameHostImpl> old_render_frame_host) { | 563 std::unique_ptr<RenderFrameHostImpl> old_render_frame_host) { |
| 563 TRACE_EVENT1("navigation", "RenderFrameHostManager::SwapOutOldFrame", | 564 TRACE_EVENT1("navigation", "RenderFrameHostManager::SwapOutOldFrame", |
| 564 "FrameTreeNode id", frame_tree_node_->frame_tree_node_id()); | 565 "FrameTreeNode id", frame_tree_node_->frame_tree_node_id()); |
| 565 | 566 |
| 566 // Tell the renderer to suppress any further modal dialogs so that we can swap | 567 // Tell the renderer to suppress any further modal dialogs so that we can swap |
| (...skipping 2241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2808 delegate_->IsHidden()) { | 2809 delegate_->IsHidden()) { |
| 2809 if (delegate_->IsHidden()) { | 2810 if (delegate_->IsHidden()) { |
| 2810 render_frame_host_->GetView()->Hide(); | 2811 render_frame_host_->GetView()->Hide(); |
| 2811 } else { | 2812 } else { |
| 2812 render_frame_host_->GetView()->Show(); | 2813 render_frame_host_->GetView()->Show(); |
| 2813 } | 2814 } |
| 2814 } | 2815 } |
| 2815 } | 2816 } |
| 2816 | 2817 |
| 2817 } // namespace content | 2818 } // namespace content |
| OLD | NEW |