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 <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 1092 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1103 base::TimeDelta::FromMilliseconds(10), | 1103 base::TimeDelta::FromMilliseconds(10), |
1104 base::TimeDelta::FromMinutes(10), 100); | 1104 base::TimeDelta::FromMinutes(10), 100); |
1105 } | 1105 } |
1106 // This message is only sent for top-level frames. TODO(avi): when frame tree | 1106 // This message is only sent for top-level frames. TODO(avi): when frame tree |
1107 // mirroring works correctly, add a check here to enforce it. | 1107 // mirroring works correctly, add a check here to enforce it. |
1108 delegate_->DocumentOnLoadCompleted(this); | 1108 delegate_->DocumentOnLoadCompleted(this); |
1109 } | 1109 } |
1110 | 1110 |
1111 void RenderFrameHostImpl::OnDidStartProvisionalLoad( | 1111 void RenderFrameHostImpl::OnDidStartProvisionalLoad( |
1112 const GURL& url, | 1112 const GURL& url, |
1113 const base::TimeTicks& navigation_start) { | 1113 const base::TimeTicks& navigation_start, |
| 1114 NavigationGesture gesture) { |
1114 // TODO(clamy): Check if other navigation methods (OpenURL, | 1115 // TODO(clamy): Check if other navigation methods (OpenURL, |
1115 // DidFailProvisionalLoad, ...) should also be ignored if the RFH is no longer | 1116 // DidFailProvisionalLoad, ...) should also be ignored if the RFH is no longer |
1116 // active. | 1117 // active. |
1117 if (!is_active()) | 1118 if (!is_active()) |
1118 return; | 1119 return; |
1119 frame_tree_node_->navigator()->DidStartProvisionalLoad(this, url, | 1120 frame_tree_node_->navigator()->DidStartProvisionalLoad( |
1120 navigation_start); | 1121 this, url, navigation_start, gesture); |
1121 } | 1122 } |
1122 | 1123 |
1123 void RenderFrameHostImpl::OnDidFailProvisionalLoadWithError( | 1124 void RenderFrameHostImpl::OnDidFailProvisionalLoadWithError( |
1124 const FrameHostMsg_DidFailProvisionalLoadWithError_Params& params) { | 1125 const FrameHostMsg_DidFailProvisionalLoadWithError_Params& params) { |
1125 // TODO(clamy): Kill the renderer with RFH_FAIL_PROVISIONAL_LOAD_NO_HANDLE and | 1126 // TODO(clamy): Kill the renderer with RFH_FAIL_PROVISIONAL_LOAD_NO_HANDLE and |
1126 // return early if navigation_handle_ is null, once we prevent that case from | 1127 // return early if navigation_handle_ is null, once we prevent that case from |
1127 // happening in practice. | 1128 // happening in practice. |
1128 | 1129 |
1129 // Update the error code in the NavigationHandle of the navigation. | 1130 // Update the error code in the NavigationHandle of the navigation. |
1130 if (navigation_handle_) { | 1131 if (navigation_handle_) { |
(...skipping 1293 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2424 // Blink doesn't send throb notifications for JavaScript URLs, so it is not | 2425 // Blink doesn't send throb notifications for JavaScript URLs, so it is not |
2425 // done here either. | 2426 // done here either. |
2426 if (!common_params.url.SchemeIs(url::kJavaScriptScheme)) | 2427 if (!common_params.url.SchemeIs(url::kJavaScriptScheme)) |
2427 OnDidStartLoading(true); | 2428 OnDidStartLoading(true); |
2428 } | 2429 } |
2429 | 2430 |
2430 void RenderFrameHostImpl::NavigateToInterstitialURL(const GURL& data_url) { | 2431 void RenderFrameHostImpl::NavigateToInterstitialURL(const GURL& data_url) { |
2431 DCHECK(data_url.SchemeIs(url::kDataScheme)); | 2432 DCHECK(data_url.SchemeIs(url::kDataScheme)); |
2432 CommonNavigationParams common_params( | 2433 CommonNavigationParams common_params( |
2433 data_url, Referrer(), ui::PAGE_TRANSITION_LINK, | 2434 data_url, Referrer(), ui::PAGE_TRANSITION_LINK, |
2434 FrameMsg_Navigate_Type::NORMAL, false, false, base::TimeTicks::Now(), | 2435 FrameMsg_Navigate_Type::NORMAL, NavigationGestureAuto, false, false, |
2435 FrameMsg_UILoadMetricsReportType::NO_REPORT, GURL(), GURL(), LOFI_OFF, | 2436 base::TimeTicks::Now(), FrameMsg_UILoadMetricsReportType::NO_REPORT, |
2436 base::TimeTicks::Now(), "GET", nullptr); | 2437 GURL(), GURL(), LOFI_OFF, base::TimeTicks::Now(), "GET", nullptr); |
2437 if (IsBrowserSideNavigationEnabled()) { | 2438 if (IsBrowserSideNavigationEnabled()) { |
2438 CommitNavigation(nullptr, nullptr, common_params, RequestNavigationParams(), | 2439 CommitNavigation(nullptr, nullptr, common_params, RequestNavigationParams(), |
2439 false); | 2440 false); |
2440 } else { | 2441 } else { |
2441 Navigate(common_params, StartNavigationParams(), RequestNavigationParams()); | 2442 Navigate(common_params, StartNavigationParams(), RequestNavigationParams()); |
2442 } | 2443 } |
2443 } | 2444 } |
2444 | 2445 |
2445 void RenderFrameHostImpl::Stop() { | 2446 void RenderFrameHostImpl::Stop() { |
2446 Send(new FrameMsg_Stop(routing_id_)); | 2447 Send(new FrameMsg_Stop(routing_id_)); |
(...skipping 835 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3282 NavigationEntryImpl::FromNavigationEntry( | 3283 NavigationEntryImpl::FromNavigationEntry( |
3283 frame_tree_node()->navigator()->GetController()->GetPendingEntry()); | 3284 frame_tree_node()->navigator()->GetController()->GetPendingEntry()); |
3284 if (pending_entry && pending_entry->GetUniqueID() == params.nav_entry_id) { | 3285 if (pending_entry && pending_entry->GetUniqueID() == params.nav_entry_id) { |
3285 pending_nav_entry_id = params.nav_entry_id; | 3286 pending_nav_entry_id = params.nav_entry_id; |
3286 is_renderer_initiated = pending_entry->is_renderer_initiated(); | 3287 is_renderer_initiated = pending_entry->is_renderer_initiated(); |
3287 } | 3288 } |
3288 | 3289 |
3289 return NavigationHandleImpl::Create( | 3290 return NavigationHandleImpl::Create( |
3290 params.url, frame_tree_node_, is_renderer_initiated, | 3291 params.url, frame_tree_node_, is_renderer_initiated, |
3291 params.was_within_same_page, params.is_srcdoc, base::TimeTicks::Now(), | 3292 params.was_within_same_page, params.is_srcdoc, base::TimeTicks::Now(), |
3292 pending_nav_entry_id, false); // started_from_context_menu | 3293 pending_nav_entry_id, params.gesture, |
| 3294 false); // started_from_context_menu |
3293 } | 3295 } |
3294 | 3296 |
3295 // Determine if the current NavigationHandle can be used. | 3297 // Determine if the current NavigationHandle can be used. |
3296 if (navigation_handle_ && navigation_handle_->GetURL() == params.url) { | 3298 if (navigation_handle_ && navigation_handle_->GetURL() == params.url) { |
3297 return std::move(navigation_handle_); | 3299 return std::move(navigation_handle_); |
3298 } | 3300 } |
3299 | 3301 |
3300 // If the URL does not match what the NavigationHandle expects, treat the | 3302 // If the URL does not match what the NavigationHandle expects, treat the |
3301 // commit as a new navigation. This can happen when loading a Data | 3303 // commit as a new navigation. This can happen when loading a Data |
3302 // navigation with LoadDataWithBaseURL. | 3304 // navigation with LoadDataWithBaseURL. |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3334 // Reset any existing NavigationHandle. | 3336 // Reset any existing NavigationHandle. |
3335 navigation_handle_.reset(); | 3337 navigation_handle_.reset(); |
3336 } | 3338 } |
3337 | 3339 |
3338 // There is no pending NavigationEntry in these cases, so pass 0 as the | 3340 // There is no pending NavigationEntry in these cases, so pass 0 as the |
3339 // pending_nav_entry_id. If the previous handle was a prematurely aborted | 3341 // pending_nav_entry_id. If the previous handle was a prematurely aborted |
3340 // navigation loaded via LoadDataWithBaseURL, propagate the entry id. | 3342 // navigation loaded via LoadDataWithBaseURL, propagate the entry id. |
3341 return NavigationHandleImpl::Create( | 3343 return NavigationHandleImpl::Create( |
3342 params.url, frame_tree_node_, is_renderer_initiated, | 3344 params.url, frame_tree_node_, is_renderer_initiated, |
3343 params.was_within_same_page, params.is_srcdoc, base::TimeTicks::Now(), | 3345 params.was_within_same_page, params.is_srcdoc, base::TimeTicks::Now(), |
3344 entry_id_for_data_nav, false); // started_from_context_menu | 3346 entry_id_for_data_nav, params.gesture, |
| 3347 false); // started_from_context_menu |
3345 } | 3348 } |
3346 | 3349 |
3347 } // namespace content | 3350 } // namespace content |
OLD | NEW |