Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(9)

Side by Side Diff: content/browser/frame_host/render_frame_host_manager.cc

Issue 2797813002: Replicate feature policy container policies. (Closed)
Patch Set: Addressing review comments Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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
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 updates to sandbox flags or container
542 if (!frame_tree_node_->CommitPendingSandboxFlags()) 542 // policy.
543 if (!frame_tree_node_->CommitPendingFramePolicy())
543 return; 544 return;
544 545
545 // Sandbox flags updates can only happen when the frame has a parent. 546 // Policy updates can only happen when the frame has a parent.
546 CHECK(frame_tree_node_->parent()); 547 CHECK(frame_tree_node_->parent());
547 548
548 // Notify all of the frame's proxies about updated sandbox flags, excluding 549 // Notify all of the frame's proxies about updated policies, excluding
549 // the parent process since it already knows the latest flags. 550 // the parent process since it already knows the latest state.
550 SiteInstance* parent_site_instance = 551 SiteInstance* parent_site_instance =
551 frame_tree_node_->parent()->current_frame_host()->GetSiteInstance(); 552 frame_tree_node_->parent()->current_frame_host()->GetSiteInstance();
552 for (const auto& pair : proxy_hosts_) { 553 for (const auto& pair : proxy_hosts_) {
553 if (pair.second->GetSiteInstance() != parent_site_instance) { 554 if (pair.second->GetSiteInstance() != parent_site_instance) {
554 pair.second->Send(new FrameMsg_DidUpdateSandboxFlags( 555 pair.second->Send(new FrameMsg_DidUpdateFramePolicy(
555 pair.second->GetRoutingID(), 556 pair.second->GetRoutingID(),
556 frame_tree_node_->current_replication_state().sandbox_flags)); 557 frame_tree_node_->current_replication_state().sandbox_flags,
558 frame_tree_node_->current_replication_state().container_policy));
557 } 559 }
558 } 560 }
559 } 561 }
560 562
561 void RenderFrameHostManager::SwapOutOldFrame( 563 void RenderFrameHostManager::SwapOutOldFrame(
562 std::unique_ptr<RenderFrameHostImpl> old_render_frame_host) { 564 std::unique_ptr<RenderFrameHostImpl> old_render_frame_host) {
563 TRACE_EVENT1("navigation", "RenderFrameHostManager::SwapOutOldFrame", 565 TRACE_EVENT1("navigation", "RenderFrameHostManager::SwapOutOldFrame",
564 "FrameTreeNode id", frame_tree_node_->frame_tree_node_id()); 566 "FrameTreeNode id", frame_tree_node_->frame_tree_node_id());
565 567
566 // Tell the renderer to suppress any further modal dialogs so that we can swap 568 // Tell the renderer to suppress any further modal dialogs so that we can swap
(...skipping 2268 matching lines...) Expand 10 before | Expand all | Expand 10 after
2835 delegate_->IsHidden()) { 2837 delegate_->IsHidden()) {
2836 if (delegate_->IsHidden()) { 2838 if (delegate_->IsHidden()) {
2837 render_frame_host_->GetView()->Hide(); 2839 render_frame_host_->GetView()->Hide();
2838 } else { 2840 } else {
2839 render_frame_host_->GetView()->Show(); 2841 render_frame_host_->GetView()->Show();
2840 } 2842 }
2841 } 2843 }
2842 } 2844 }
2843 2845
2844 } // namespace content 2846 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698