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

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

Issue 2655663004: Introduce content-side Feature Policy object and maintain in parallel with renderer policy. (Closed)
Patch Set: Simplify FP mirroring logic; move most of it to RFHI Created 3 years, 10 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/navigator_impl.h" 5 #include "content/browser/frame_host/navigator_impl.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/metrics/histogram_macros.h" 10 #include "base/metrics/histogram_macros.h"
(...skipping 564 matching lines...) Expand 10 before | Expand all | Expand 10 after
575 render_frame_host->frame_tree_node()->SetCurrentOrigin( 575 render_frame_host->frame_tree_node()->SetCurrentOrigin(
576 params.origin, params.has_potentially_trustworthy_unique_origin); 576 params.origin, params.has_potentially_trustworthy_unique_origin);
577 577
578 render_frame_host->frame_tree_node()->SetInsecureRequestPolicy( 578 render_frame_host->frame_tree_node()->SetInsecureRequestPolicy(
579 params.insecure_request_policy); 579 params.insecure_request_policy);
580 580
581 // Navigating to a new location means a new, fresh set of http headers and/or 581 // Navigating to a new location means a new, fresh set of http headers and/or
582 // <meta> elements - we need to reset CSP and Feature Policy. 582 // <meta> elements - we need to reset CSP and Feature Policy.
583 if (!is_navigation_within_page) { 583 if (!is_navigation_within_page) {
584 render_frame_host->frame_tree_node()->ResetContentSecurityPolicy(); 584 render_frame_host->frame_tree_node()->ResetContentSecurityPolicy();
585 render_frame_host->frame_tree_node()->ResetFeaturePolicy(); 585 render_frame_host->frame_tree_node()->ResetFeaturePolicyHeader();
586 } 586 }
587 587
588 // When using --site-per-process, we notify the RFHM for all navigations, 588 // When using --site-per-process, we notify the RFHM for all navigations,
589 // not just main frame navigations. 589 // not just main frame navigations.
590 if (oopifs_possible) { 590 if (oopifs_possible) {
591 FrameTreeNode* frame = render_frame_host->frame_tree_node(); 591 FrameTreeNode* frame = render_frame_host->frame_tree_node();
592 frame->render_manager()->DidNavigateFrame( 592 frame->render_manager()->DidNavigateFrame(
593 render_frame_host, params.gesture == NavigationGestureUser); 593 render_frame_host, params.gesture == NavigationGestureUser);
594 } 594 }
595 595
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
645 // Separately, update the frame's last successful URL except for net error 645 // Separately, update the frame's last successful URL except for net error
646 // pages, since those do not end up in the correct process after transfers 646 // pages, since those do not end up in the correct process after transfers
647 // (see https://crbug.com/560511). Instead, the next cross-process navigation 647 // (see https://crbug.com/560511). Instead, the next cross-process navigation
648 // or transfer should decide whether to swap as if the net error had not 648 // or transfer should decide whether to swap as if the net error had not
649 // occurred. 649 // occurred.
650 // TODO(creis): Remove this block and always set the URL once transfers handle 650 // TODO(creis): Remove this block and always set the URL once transfers handle
651 // network errors or PlzNavigate is enabled. See https://crbug.com/588314. 651 // network errors or PlzNavigate is enabled. See https://crbug.com/588314.
652 if (!params.url_is_unreachable) 652 if (!params.url_is_unreachable)
653 render_frame_host->set_last_successful_url(params.url); 653 render_frame_host->set_last_successful_url(params.url);
654 654
655 // After setting the last committed origin, reset the feature policy in the
656 // RenderFrameHost to a blank policy based on the parent frame.
657 render_frame_host->ResetFeaturePolicy();
658
655 // Send notification about committed provisional loads. This notification is 659 // Send notification about committed provisional loads. This notification is
656 // different from the NAV_ENTRY_COMMITTED notification which doesn't include 660 // different from the NAV_ENTRY_COMMITTED notification which doesn't include
657 // the actual URL navigated to and isn't sent for AUTO_SUBFRAME navigations. 661 // the actual URL navigated to and isn't sent for AUTO_SUBFRAME navigations.
658 if (details.type != NAVIGATION_TYPE_NAV_IGNORE && delegate_) { 662 if (details.type != NAVIGATION_TYPE_NAV_IGNORE && delegate_) {
659 DCHECK_EQ(!render_frame_host->GetParent(), 663 DCHECK_EQ(!render_frame_host->GetParent(),
660 did_navigate ? details.is_main_frame : false); 664 did_navigate ? details.is_main_frame : false);
661 ui::PageTransition transition_type = params.transition; 665 ui::PageTransition transition_type = params.transition;
662 // Whether or not a page transition was triggered by going backward or 666 // Whether or not a page transition was triggered by going backward or
663 // forward in the history is only stored in the navigation controller's 667 // forward in the history is only stored in the navigation controller's
664 // entry list. 668 // entry list.
(...skipping 615 matching lines...) Expand 10 before | Expand all | Expand 10 after
1280 if (navigation_handle) 1284 if (navigation_handle)
1281 navigation_handle->update_entry_id_for_transfer(entry->GetUniqueID()); 1285 navigation_handle->update_entry_id_for_transfer(entry->GetUniqueID());
1282 1286
1283 controller_->SetPendingEntry(std::move(entry)); 1287 controller_->SetPendingEntry(std::move(entry));
1284 if (delegate_) 1288 if (delegate_)
1285 delegate_->NotifyChangedNavigationState(content::INVALIDATE_TYPE_URL); 1289 delegate_->NotifyChangedNavigationState(content::INVALIDATE_TYPE_URL);
1286 } 1290 }
1287 } 1291 }
1288 1292
1289 } // namespace content 1293 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698