| 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_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 Loading... |
| 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 Loading... |
| 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 664 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3452 NavigationEntryImpl::FromNavigationEntry( | 3459 NavigationEntryImpl::FromNavigationEntry( |
| 3453 frame_tree_node()->navigator()->GetController()->GetPendingEntry()); | 3460 frame_tree_node()->navigator()->GetController()->GetPendingEntry()); |
| 3454 if (pending_entry && pending_entry->GetUniqueID() == params.nav_entry_id) { | 3461 if (pending_entry && pending_entry->GetUniqueID() == params.nav_entry_id) { |
| 3455 pending_nav_entry_id = params.nav_entry_id; | 3462 pending_nav_entry_id = params.nav_entry_id; |
| 3456 is_renderer_initiated = pending_entry->is_renderer_initiated(); | 3463 is_renderer_initiated = pending_entry->is_renderer_initiated(); |
| 3457 } | 3464 } |
| 3458 | 3465 |
| 3459 return NavigationHandleImpl::Create( | 3466 return NavigationHandleImpl::Create( |
| 3460 params.url, params.redirects, frame_tree_node_, is_renderer_initiated, | 3467 params.url, params.redirects, frame_tree_node_, is_renderer_initiated, |
| 3461 params.was_within_same_page, base::TimeTicks::Now(), | 3468 params.was_within_same_page, base::TimeTicks::Now(), |
| 3462 pending_nav_entry_id, false); // started_from_context_menu | 3469 pending_nav_entry_id, |
| 3470 false, // started_from_context_menu |
| 3471 false); // should_bypass_main_world_csp |
| 3463 } | 3472 } |
| 3464 | 3473 |
| 3465 // Determine if the current NavigationHandle can be used. | 3474 // Determine if the current NavigationHandle can be used. |
| 3466 if (navigation_handle_ && navigation_handle_->GetURL() == params.url) { | 3475 if (navigation_handle_ && navigation_handle_->GetURL() == params.url) { |
| 3467 return std::move(navigation_handle_); | 3476 return std::move(navigation_handle_); |
| 3468 } | 3477 } |
| 3469 | 3478 |
| 3470 // If the URL does not match what the NavigationHandle expects, treat the | 3479 // If the URL does not match what the NavigationHandle expects, treat the |
| 3471 // commit as a new navigation. This can happen when loading a Data | 3480 // commit as a new navigation. This can happen when loading a Data |
| 3472 // navigation with LoadDataWithBaseURL. | 3481 // navigation with LoadDataWithBaseURL. |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3504 // Reset any existing NavigationHandle. | 3513 // Reset any existing NavigationHandle. |
| 3505 navigation_handle_.reset(); | 3514 navigation_handle_.reset(); |
| 3506 } | 3515 } |
| 3507 | 3516 |
| 3508 // There is no pending NavigationEntry in these cases, so pass 0 as the | 3517 // 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 | 3518 // pending_nav_entry_id. If the previous handle was a prematurely aborted |
| 3510 // navigation loaded via LoadDataWithBaseURL, propagate the entry id. | 3519 // navigation loaded via LoadDataWithBaseURL, propagate the entry id. |
| 3511 return NavigationHandleImpl::Create( | 3520 return NavigationHandleImpl::Create( |
| 3512 params.url, params.redirects, frame_tree_node_, is_renderer_initiated, | 3521 params.url, params.redirects, frame_tree_node_, is_renderer_initiated, |
| 3513 params.was_within_same_page, base::TimeTicks::Now(), | 3522 params.was_within_same_page, base::TimeTicks::Now(), |
| 3514 entry_id_for_data_nav, false); // started_from_context_menu | 3523 entry_id_for_data_nav, |
| 3524 false, // started_from_context_menu |
| 3525 false); // should_bypass_main_world_csp |
| 3515 } | 3526 } |
| 3516 | 3527 |
| 3517 } // namespace content | 3528 } // namespace content |
| OLD | NEW |