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 1065 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1076 base::TimeDelta::FromMilliseconds(10), | 1076 base::TimeDelta::FromMilliseconds(10), |
1077 base::TimeDelta::FromMinutes(10), 100); | 1077 base::TimeDelta::FromMinutes(10), 100); |
1078 } | 1078 } |
1079 // This message is only sent for top-level frames. TODO(avi): when frame tree | 1079 // This message is only sent for top-level frames. TODO(avi): when frame tree |
1080 // mirroring works correctly, add a check here to enforce it. | 1080 // mirroring works correctly, add a check here to enforce it. |
1081 delegate_->DocumentOnLoadCompleted(this); | 1081 delegate_->DocumentOnLoadCompleted(this); |
1082 } | 1082 } |
1083 | 1083 |
1084 void RenderFrameHostImpl::OnDidStartProvisionalLoad( | 1084 void RenderFrameHostImpl::OnDidStartProvisionalLoad( |
1085 const GURL& url, | 1085 const GURL& url, |
1086 const base::TimeTicks& navigation_start, | 1086 const base::TimeTicks& navigation_start) { |
1087 NavigationGesture gesture) { | |
1088 // TODO(clamy): Check if other navigation methods (OpenURL, | 1087 // TODO(clamy): Check if other navigation methods (OpenURL, |
1089 // DidFailProvisionalLoad, ...) should also be ignored if the RFH is no longer | 1088 // DidFailProvisionalLoad, ...) should also be ignored if the RFH is no longer |
1090 // active. | 1089 // active. |
1091 if (!is_active()) | 1090 if (!is_active()) |
1092 return; | 1091 return; |
1093 frame_tree_node_->navigator()->DidStartProvisionalLoad( | 1092 frame_tree_node_->navigator()->DidStartProvisionalLoad(this, url, |
1094 this, url, navigation_start, gesture); | 1093 navigation_start); |
1095 } | 1094 } |
1096 | 1095 |
1097 void RenderFrameHostImpl::OnDidFailProvisionalLoadWithError( | 1096 void RenderFrameHostImpl::OnDidFailProvisionalLoadWithError( |
1098 const FrameHostMsg_DidFailProvisionalLoadWithError_Params& params) { | 1097 const FrameHostMsg_DidFailProvisionalLoadWithError_Params& params) { |
1099 // TODO(clamy): Kill the renderer with RFH_FAIL_PROVISIONAL_LOAD_NO_HANDLE and | 1098 // TODO(clamy): Kill the renderer with RFH_FAIL_PROVISIONAL_LOAD_NO_HANDLE and |
1100 // return early if navigation_handle_ is null, once we prevent that case from | 1099 // return early if navigation_handle_ is null, once we prevent that case from |
1101 // happening in practice. | 1100 // happening in practice. |
1102 | 1101 |
1103 // Update the error code in the NavigationHandle of the navigation. | 1102 // Update the error code in the NavigationHandle of the navigation. |
1104 if (navigation_handle_) { | 1103 if (navigation_handle_) { |
(...skipping 1293 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2398 // Blink doesn't send throb notifications for JavaScript URLs, so it is not | 2397 // Blink doesn't send throb notifications for JavaScript URLs, so it is not |
2399 // done here either. | 2398 // done here either. |
2400 if (!common_params.url.SchemeIs(url::kJavaScriptScheme)) | 2399 if (!common_params.url.SchemeIs(url::kJavaScriptScheme)) |
2401 OnDidStartLoading(true); | 2400 OnDidStartLoading(true); |
2402 } | 2401 } |
2403 | 2402 |
2404 void RenderFrameHostImpl::NavigateToInterstitialURL(const GURL& data_url) { | 2403 void RenderFrameHostImpl::NavigateToInterstitialURL(const GURL& data_url) { |
2405 DCHECK(data_url.SchemeIs(url::kDataScheme)); | 2404 DCHECK(data_url.SchemeIs(url::kDataScheme)); |
2406 CommonNavigationParams common_params( | 2405 CommonNavigationParams common_params( |
2407 data_url, Referrer(), ui::PAGE_TRANSITION_LINK, | 2406 data_url, Referrer(), ui::PAGE_TRANSITION_LINK, |
2408 FrameMsg_Navigate_Type::NORMAL, NavigationGestureAuto, false, false, | 2407 FrameMsg_Navigate_Type::NORMAL, false, false, base::TimeTicks::Now(), |
2409 base::TimeTicks::Now(), FrameMsg_UILoadMetricsReportType::NO_REPORT, | 2408 FrameMsg_UILoadMetricsReportType::NO_REPORT, GURL(), GURL(), LOFI_OFF, |
2410 GURL(), GURL(), LOFI_OFF, base::TimeTicks::Now(), "GET", nullptr); | 2409 base::TimeTicks::Now(), "GET", nullptr); |
2411 if (IsBrowserSideNavigationEnabled()) { | 2410 if (IsBrowserSideNavigationEnabled()) { |
2412 CommitNavigation(nullptr, nullptr, common_params, RequestNavigationParams(), | 2411 CommitNavigation(nullptr, nullptr, common_params, RequestNavigationParams(), |
2413 false); | 2412 false); |
2414 } else { | 2413 } else { |
2415 Navigate(common_params, StartNavigationParams(), RequestNavigationParams()); | 2414 Navigate(common_params, StartNavigationParams(), RequestNavigationParams()); |
2416 } | 2415 } |
2417 } | 2416 } |
2418 | 2417 |
2419 void RenderFrameHostImpl::Stop() { | 2418 void RenderFrameHostImpl::Stop() { |
2420 Send(new FrameMsg_Stop(routing_id_)); | 2419 Send(new FrameMsg_Stop(routing_id_)); |
(...skipping 851 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3272 NavigationEntryImpl::FromNavigationEntry( | 3271 NavigationEntryImpl::FromNavigationEntry( |
3273 frame_tree_node()->navigator()->GetController()->GetPendingEntry()); | 3272 frame_tree_node()->navigator()->GetController()->GetPendingEntry()); |
3274 if (pending_entry && pending_entry->GetUniqueID() == params.nav_entry_id) { | 3273 if (pending_entry && pending_entry->GetUniqueID() == params.nav_entry_id) { |
3275 pending_nav_entry_id = params.nav_entry_id; | 3274 pending_nav_entry_id = params.nav_entry_id; |
3276 is_renderer_initiated = pending_entry->is_renderer_initiated(); | 3275 is_renderer_initiated = pending_entry->is_renderer_initiated(); |
3277 } | 3276 } |
3278 | 3277 |
3279 return NavigationHandleImpl::Create( | 3278 return NavigationHandleImpl::Create( |
3280 params.url, frame_tree_node_, is_renderer_initiated, | 3279 params.url, frame_tree_node_, is_renderer_initiated, |
3281 params.was_within_same_page, base::TimeTicks::Now(), | 3280 params.was_within_same_page, base::TimeTicks::Now(), |
3282 pending_nav_entry_id, params.gesture, | 3281 pending_nav_entry_id, false); // started_from_context_menu |
3283 false); // started_from_context_menu | |
3284 } | 3282 } |
3285 | 3283 |
3286 // Determine if the current NavigationHandle can be used. | 3284 // Determine if the current NavigationHandle can be used. |
3287 if (navigation_handle_ && navigation_handle_->GetURL() == params.url) { | 3285 if (navigation_handle_ && navigation_handle_->GetURL() == params.url) { |
3288 return std::move(navigation_handle_); | 3286 return std::move(navigation_handle_); |
3289 } | 3287 } |
3290 | 3288 |
3291 // If the URL does not match what the NavigationHandle expects, treat the | 3289 // If the URL does not match what the NavigationHandle expects, treat the |
3292 // commit as a new navigation. This can happen when loading a Data | 3290 // commit as a new navigation. This can happen when loading a Data |
3293 // navigation with LoadDataWithBaseURL. | 3291 // navigation with LoadDataWithBaseURL. |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3325 // Reset any existing NavigationHandle. | 3323 // Reset any existing NavigationHandle. |
3326 navigation_handle_.reset(); | 3324 navigation_handle_.reset(); |
3327 } | 3325 } |
3328 | 3326 |
3329 // There is no pending NavigationEntry in these cases, so pass 0 as the | 3327 // There is no pending NavigationEntry in these cases, so pass 0 as the |
3330 // pending_nav_entry_id. If the previous handle was a prematurely aborted | 3328 // pending_nav_entry_id. If the previous handle was a prematurely aborted |
3331 // navigation loaded via LoadDataWithBaseURL, propagate the entry id. | 3329 // navigation loaded via LoadDataWithBaseURL, propagate the entry id. |
3332 return NavigationHandleImpl::Create( | 3330 return NavigationHandleImpl::Create( |
3333 params.url, frame_tree_node_, is_renderer_initiated, | 3331 params.url, frame_tree_node_, is_renderer_initiated, |
3334 params.was_within_same_page, base::TimeTicks::Now(), | 3332 params.was_within_same_page, base::TimeTicks::Now(), |
3335 entry_id_for_data_nav, params.gesture, | 3333 entry_id_for_data_nav, false); // started_from_context_menu |
3336 false); // started_from_context_menu | |
3337 } | 3334 } |
3338 | 3335 |
3339 } // namespace content | 3336 } // namespace content |
OLD | NEW |