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/navigator_impl.h" | 5 #include "content/browser/frame_host/navigator_impl.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/metrics/histogram.h" | 8 #include "base/metrics/histogram.h" |
9 #include "base/time/time.h" | 9 #include "base/time/time.h" |
10 #include "content/browser/frame_host/frame_tree.h" | 10 #include "content/browser/frame_host/frame_tree.h" |
11 #include "content/browser/frame_host/frame_tree_node.h" | 11 #include "content/browser/frame_host/frame_tree_node.h" |
12 #include "content/browser/frame_host/navigation_controller_impl.h" | 12 #include "content/browser/frame_host/navigation_controller_impl.h" |
13 #include "content/browser/frame_host/navigation_entry_impl.h" | 13 #include "content/browser/frame_host/navigation_entry_impl.h" |
14 #include "content/browser/frame_host/navigation_handle_impl.h" | 14 #include "content/browser/frame_host/navigation_handle_impl.h" |
15 #include "content/browser/frame_host/navigation_request.h" | 15 #include "content/browser/frame_host/navigation_request.h" |
16 #include "content/browser/frame_host/navigation_request_info.h" | 16 #include "content/browser/frame_host/navigation_request_info.h" |
17 #include "content/browser/frame_host/navigator_delegate.h" | 17 #include "content/browser/frame_host/navigator_delegate.h" |
18 #include "content/browser/frame_host/render_frame_host_impl.h" | 18 #include "content/browser/frame_host/render_frame_host_impl.h" |
19 #include "content/browser/renderer_host/render_view_host_impl.h" | 19 #include "content/browser/renderer_host/render_view_host_impl.h" |
20 #include "content/browser/site_instance_impl.h" | 20 #include "content/browser/site_instance_impl.h" |
21 #include "content/browser/webui/web_ui_controller_factory_registry.h" | 21 #include "content/browser/webui/web_ui_controller_factory_registry.h" |
22 #include "content/browser/webui/web_ui_impl.h" | 22 #include "content/browser/webui/web_ui_impl.h" |
23 #include "content/common/frame_messages.h" | 23 #include "content/common/frame_messages.h" |
24 #include "content/common/navigation_params.h" | 24 #include "content/common/navigation_params.h" |
| 25 #include "content/common/service_worker/service_worker_types.h" |
25 #include "content/common/site_isolation_policy.h" | 26 #include "content/common/site_isolation_policy.h" |
26 #include "content/common/view_messages.h" | 27 #include "content/common/view_messages.h" |
27 #include "content/public/browser/browser_context.h" | 28 #include "content/public/browser/browser_context.h" |
28 #include "content/public/browser/content_browser_client.h" | 29 #include "content/public/browser/content_browser_client.h" |
29 #include "content/public/browser/global_request_id.h" | 30 #include "content/public/browser/global_request_id.h" |
30 #include "content/public/browser/invalidate_type.h" | 31 #include "content/public/browser/invalidate_type.h" |
31 #include "content/public/browser/navigation_controller.h" | 32 #include "content/public/browser/navigation_controller.h" |
32 #include "content/public/browser/navigation_details.h" | 33 #include "content/public/browser/navigation_details.h" |
33 #include "content/public/browser/page_navigator.h" | 34 #include "content/public/browser/page_navigator.h" |
34 #include "content/public/browser/render_view_host.h" | 35 #include "content/public/browser/render_view_host.h" |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
152 return; | 153 return; |
153 } | 154 } |
154 | 155 |
155 // This ensures that notifications about the end of the previous | 156 // This ensures that notifications about the end of the previous |
156 // navigation are sent before notifications about the start of the | 157 // navigation are sent before notifications about the start of the |
157 // new navigation. | 158 // new navigation. |
158 render_frame_host->SetNavigationHandle(scoped_ptr<NavigationHandleImpl>()); | 159 render_frame_host->SetNavigationHandle(scoped_ptr<NavigationHandleImpl>()); |
159 } | 160 } |
160 | 161 |
161 render_frame_host->SetNavigationHandle( | 162 render_frame_host->SetNavigationHandle( |
162 NavigationHandleImpl::Create(validated_url, is_main_frame, delegate_)); | 163 NavigationHandleImpl::Create( |
| 164 validated_url, is_main_frame, delegate_, |
| 165 kInvalidServiceWorkerProviderId)); |
163 } | 166 } |
164 | 167 |
165 void NavigatorImpl::DidFailProvisionalLoadWithError( | 168 void NavigatorImpl::DidFailProvisionalLoadWithError( |
166 RenderFrameHostImpl* render_frame_host, | 169 RenderFrameHostImpl* render_frame_host, |
167 const FrameHostMsg_DidFailProvisionalLoadWithError_Params& params) { | 170 const FrameHostMsg_DidFailProvisionalLoadWithError_Params& params) { |
168 VLOG(1) << "Failed Provisional Load: " << params.url.possibly_invalid_spec() | 171 VLOG(1) << "Failed Provisional Load: " << params.url.possibly_invalid_spec() |
169 << ", error_code: " << params.error_code | 172 << ", error_code: " << params.error_code |
170 << ", error_description: " << params.error_description | 173 << ", error_description: " << params.error_description |
171 << ", showing_repost_interstitial: " << | 174 << ", showing_repost_interstitial: " << |
172 params.showing_repost_interstitial | 175 params.showing_repost_interstitial |
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
343 dest_render_frame_host->Navigate( | 346 dest_render_frame_host->Navigate( |
344 entry.ConstructCommonNavigationParams(dest_url, dest_referrer, | 347 entry.ConstructCommonNavigationParams(dest_url, dest_referrer, |
345 frame_entry, navigation_type), | 348 frame_entry, navigation_type), |
346 entry.ConstructStartNavigationParams(), | 349 entry.ConstructStartNavigationParams(), |
347 entry.ConstructRequestNavigationParams( | 350 entry.ConstructRequestNavigationParams( |
348 frame_entry, navigation_start, is_same_document_history_load, | 351 frame_entry, navigation_start, is_same_document_history_load, |
349 frame_tree_node->has_committed_real_load(), | 352 frame_tree_node->has_committed_real_load(), |
350 controller_->GetPendingEntryIndex() == -1, | 353 controller_->GetPendingEntryIndex() == -1, |
351 controller_->GetIndexOfEntry(&entry), | 354 controller_->GetIndexOfEntry(&entry), |
352 controller_->GetLastCommittedEntryIndex(), | 355 controller_->GetLastCommittedEntryIndex(), |
353 controller_->GetEntryCount())); | 356 controller_->GetEntryCount(), |
| 357 kInvalidServiceWorkerProviderId)); |
354 } else { | 358 } else { |
355 // No need to navigate again. Just resume the deferred request. | 359 // No need to navigate again. Just resume the deferred request. |
356 dest_render_frame_host->GetProcess()->ResumeDeferredNavigation( | 360 dest_render_frame_host->GetProcess()->ResumeDeferredNavigation( |
357 entry.transferred_global_request_id()); | 361 entry.transferred_global_request_id()); |
358 } | 362 } |
359 | 363 |
360 // Make sure no code called via RFH::Navigate clears the pending entry. | 364 // Make sure no code called via RFH::Navigate clears the pending entry. |
361 CHECK_EQ(controller_->GetPendingEntry(), &entry); | 365 CHECK_EQ(controller_->GetPendingEntry(), &entry); |
362 | 366 |
363 if (controller_->GetPendingEntryIndex() == -1 && | 367 if (controller_->GetPendingEntryIndex() == -1 && |
(...skipping 379 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
743 render_frame_host->render_view_host()->GetRoutingID())); | 747 render_frame_host->render_view_host()->GetRoutingID())); |
744 } | 748 } |
745 | 749 |
746 CheckWebUIRendererDoesNotDisplayNormalURL( | 750 CheckWebUIRendererDoesNotDisplayNormalURL( |
747 render_frame_host, navigation_request->common_params().url); | 751 render_frame_host, navigation_request->common_params().url); |
748 | 752 |
749 navigation_request->TransferNavigationHandleOwnership(render_frame_host); | 753 navigation_request->TransferNavigationHandleOwnership(render_frame_host); |
750 render_frame_host->CommitNavigation(response, body.Pass(), | 754 render_frame_host->CommitNavigation(response, body.Pass(), |
751 navigation_request->common_params(), | 755 navigation_request->common_params(), |
752 navigation_request->request_params()); | 756 navigation_request->request_params()); |
753 | |
754 } | 757 } |
755 | 758 |
756 // PlzNavigate | 759 // PlzNavigate |
757 void NavigatorImpl::FailedNavigation(FrameTreeNode* frame_tree_node, | 760 void NavigatorImpl::FailedNavigation(FrameTreeNode* frame_tree_node, |
758 bool has_stale_copy_in_cache, | 761 bool has_stale_copy_in_cache, |
759 int error_code) { | 762 int error_code) { |
760 CHECK(base::CommandLine::ForCurrentProcess()->HasSwitch( | 763 CHECK(base::CommandLine::ForCurrentProcess()->HasSwitch( |
761 switches::kEnableBrowserSideNavigation)); | 764 switches::kEnableBrowserSideNavigation)); |
762 | 765 |
763 NavigationRequest* navigation_request = frame_tree_node->navigation_request(); | 766 NavigationRequest* navigation_request = frame_tree_node->navigation_request(); |
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
952 entry->set_should_replace_entry(pending_entry->should_replace_entry()); | 955 entry->set_should_replace_entry(pending_entry->should_replace_entry()); |
953 entry->SetRedirectChain(pending_entry->GetRedirectChain()); | 956 entry->SetRedirectChain(pending_entry->GetRedirectChain()); |
954 } | 957 } |
955 controller_->SetPendingEntry(entry.Pass()); | 958 controller_->SetPendingEntry(entry.Pass()); |
956 if (delegate_) | 959 if (delegate_) |
957 delegate_->NotifyChangedNavigationState(content::INVALIDATE_TYPE_URL); | 960 delegate_->NotifyChangedNavigationState(content::INVALIDATE_TYPE_URL); |
958 } | 961 } |
959 } | 962 } |
960 | 963 |
961 } // namespace content | 964 } // namespace content |
OLD | NEW |