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