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

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

Issue 2655463006: PlzNavigate: Enforce 'frame-src' CSP on the browser. (Closed)
Patch Set: Fix tests. 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/render_frame_host_impl.h" 5 #include "content/browser/frame_host/render_frame_host_impl.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 2521 matching lines...) Expand 10 before | Expand all | Expand 10 after
2532 if (!common_params.url.SchemeIs(url::kJavaScriptScheme)) 2532 if (!common_params.url.SchemeIs(url::kJavaScriptScheme))
2533 OnDidStartLoading(true); 2533 OnDidStartLoading(true);
2534 } 2534 }
2535 2535
2536 void RenderFrameHostImpl::NavigateToInterstitialURL(const GURL& data_url) { 2536 void RenderFrameHostImpl::NavigateToInterstitialURL(const GURL& data_url) {
2537 DCHECK(data_url.SchemeIs(url::kDataScheme)); 2537 DCHECK(data_url.SchemeIs(url::kDataScheme));
2538 CommonNavigationParams common_params( 2538 CommonNavigationParams common_params(
2539 data_url, Referrer(), ui::PAGE_TRANSITION_LINK, 2539 data_url, Referrer(), ui::PAGE_TRANSITION_LINK,
2540 FrameMsg_Navigate_Type::DIFFERENT_DOCUMENT, false, false, 2540 FrameMsg_Navigate_Type::DIFFERENT_DOCUMENT, false, false,
2541 base::TimeTicks::Now(), FrameMsg_UILoadMetricsReportType::NO_REPORT, 2541 base::TimeTicks::Now(), FrameMsg_UILoadMetricsReportType::NO_REPORT,
2542 GURL(), GURL(), PREVIEWS_OFF, base::TimeTicks::Now(), "GET", nullptr); 2542 GURL(), GURL(), PREVIEWS_OFF, base::TimeTicks::Now(), "GET", nullptr,
2543 false /* should_bypass_main_world_CSP */);
2543 if (IsBrowserSideNavigationEnabled()) { 2544 if (IsBrowserSideNavigationEnabled()) {
2544 CommitNavigation(nullptr, nullptr, common_params, RequestNavigationParams(), 2545 CommitNavigation(nullptr, nullptr, common_params, RequestNavigationParams(),
2545 false); 2546 false);
2546 } else { 2547 } else {
2547 Navigate(common_params, StartNavigationParams(), RequestNavigationParams()); 2548 Navigate(common_params, StartNavigationParams(), RequestNavigationParams());
2548 } 2549 }
2549 } 2550 }
2550 2551
2551 void RenderFrameHostImpl::Stop() { 2552 void RenderFrameHostImpl::Stop() {
2552 Send(new FrameMsg_Stop(routing_id_)); 2553 Send(new FrameMsg_Stop(routing_id_));
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after
2768 ResetWaitingState(); 2769 ResetWaitingState();
2769 2770
2770 Send(new FrameMsg_FailedNavigation(routing_id_, common_params, request_params, 2771 Send(new FrameMsg_FailedNavigation(routing_id_, common_params, request_params,
2771 has_stale_copy_in_cache, error_code)); 2772 has_stale_copy_in_cache, error_code));
2772 2773
2773 // An error page is expected to commit, hence why is_loading_ is set to true. 2774 // An error page is expected to commit, hence why is_loading_ is set to true.
2774 is_loading_ = true; 2775 is_loading_ = true;
2775 frame_tree_node_->ResetNavigationRequest(true); 2776 frame_tree_node_->ResetNavigationRequest(true);
2776 } 2777 }
2777 2778
2779 void RenderFrameHostImpl::ContentSecurityPolicyViolation(
2780 const CSPViolationParams& violation_params) {
2781 Send(new FrameMsg_ContentSecurityPolicyViolation(routing_id_,
2782 violation_params));
2783 }
2784
2778 void RenderFrameHostImpl::SetUpMojoIfNeeded() { 2785 void RenderFrameHostImpl::SetUpMojoIfNeeded() {
2779 if (interface_registry_.get()) 2786 if (interface_registry_.get())
2780 return; 2787 return;
2781 2788
2782 interface_registry_ = base::MakeUnique<service_manager::InterfaceRegistry>( 2789 interface_registry_ = base::MakeUnique<service_manager::InterfaceRegistry>(
2783 mojom::kNavigation_FrameSpec); 2790 mojom::kNavigation_FrameSpec);
2784 2791
2785 ServiceManagerConnection* service_manager_connection = 2792 ServiceManagerConnection* service_manager_connection =
2786 BrowserContext::GetServiceManagerConnectionFor( 2793 BrowserContext::GetServiceManagerConnectionFor(
2787 GetProcess()->GetBrowserContext()); 2794 GetProcess()->GetBrowserContext());
(...skipping 720 matching lines...) Expand 10 before | Expand all | Expand 10 after
3508 // There is no pending NavigationEntry in these cases, so pass 0 as the 3515 // There is no pending NavigationEntry in these cases, so pass 0 as the
3509 // pending_nav_entry_id. If the previous handle was a prematurely aborted 3516 // pending_nav_entry_id. If the previous handle was a prematurely aborted
3510 // navigation loaded via LoadDataWithBaseURL, propagate the entry id. 3517 // navigation loaded via LoadDataWithBaseURL, propagate the entry id.
3511 return NavigationHandleImpl::Create( 3518 return NavigationHandleImpl::Create(
3512 params.url, params.redirects, frame_tree_node_, is_renderer_initiated, 3519 params.url, params.redirects, frame_tree_node_, is_renderer_initiated,
3513 params.was_within_same_page, base::TimeTicks::Now(), 3520 params.was_within_same_page, base::TimeTicks::Now(),
3514 entry_id_for_data_nav, false); // started_from_context_menu 3521 entry_id_for_data_nav, false); // started_from_context_menu
3515 } 3522 }
3516 3523
3517 } // namespace content 3524 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698