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/renderer/render_frame_impl.h" | 5 #include "content/renderer/render_frame_impl.h" |
6 | 6 |
7 #include <map> | 7 #include <map> |
8 #include <string> | 8 #include <string> |
9 #include <utility> | 9 #include <utility> |
10 #include <vector> | 10 #include <vector> |
(...skipping 4697 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4708 // provide it with the response to the request. | 4708 // provide it with the response to the request. |
4709 scoped_ptr<StreamOverrideParameters> stream_override( | 4709 scoped_ptr<StreamOverrideParameters> stream_override( |
4710 new StreamOverrideParameters()); | 4710 new StreamOverrideParameters()); |
4711 stream_override->stream_url = stream_url; | 4711 stream_override->stream_url = stream_url; |
4712 stream_override->response = response; | 4712 stream_override->response = response; |
4713 | 4713 |
4714 NavigateInternal(common_params, StartNavigationParams(), request_params, | 4714 NavigateInternal(common_params, StartNavigationParams(), request_params, |
4715 std::move(stream_override)); | 4715 std::move(stream_override)); |
4716 } | 4716 } |
4717 | 4717 |
| 4718 // PlzNavigate |
4718 void RenderFrameImpl::OnFailedNavigation( | 4719 void RenderFrameImpl::OnFailedNavigation( |
4719 const CommonNavigationParams& common_params, | 4720 const CommonNavigationParams& common_params, |
4720 const RequestNavigationParams& request_params, | 4721 const RequestNavigationParams& request_params, |
4721 bool has_stale_copy_in_cache, | 4722 bool has_stale_copy_in_cache, |
4722 int error_code) { | 4723 int error_code) { |
| 4724 DCHECK(IsBrowserSideNavigationEnabled()); |
4723 bool is_reload = IsReload(common_params.navigation_type); | 4725 bool is_reload = IsReload(common_params.navigation_type); |
4724 bool is_history_navigation = request_params.page_state.IsValid(); | 4726 bool is_history_navigation = request_params.page_state.IsValid(); |
4725 WebURLRequest::CachePolicy cache_policy = | 4727 WebURLRequest::CachePolicy cache_policy = |
4726 WebURLRequest::UseProtocolCachePolicy; | 4728 WebURLRequest::UseProtocolCachePolicy; |
4727 RenderFrameImpl::PrepareRenderViewForNavigation( | 4729 RenderFrameImpl::PrepareRenderViewForNavigation( |
4728 common_params.url, request_params, &is_reload, &cache_policy); | 4730 common_params.url, request_params, &is_reload, &cache_policy); |
4729 | 4731 |
4730 GetContentClient()->SetActiveURL(common_params.url); | 4732 GetContentClient()->SetActiveURL(common_params.url); |
4731 | 4733 |
4732 pending_navigation_params_.reset(new NavigationParams( | 4734 pending_navigation_params_.reset(new NavigationParams( |
4733 common_params, StartNavigationParams(), request_params)); | 4735 common_params, StartNavigationParams(), request_params)); |
4734 | 4736 |
4735 // Inform the browser of the start of the provisional load. This is needed so | 4737 // Inform the browser of the start of the provisional load. This is needed so |
4736 // that the load is properly tracked by the WebNavigation API. | 4738 // that the load is properly tracked by the WebNavigation API. |
4737 Send(new FrameHostMsg_DidStartProvisionalLoad( | 4739 Send(new FrameHostMsg_DidStartProvisionalLoad( |
4738 routing_id_, common_params.url, common_params.navigation_start)); | 4740 routing_id_, common_params.url, common_params.navigation_start)); |
4739 | 4741 |
4740 // Send the provisional load failure. | 4742 // Send the provisional load failure. |
4741 blink::WebURLError error = | 4743 blink::WebURLError error = |
4742 CreateWebURLError(common_params.url, has_stale_copy_in_cache, error_code); | 4744 CreateWebURLError(common_params.url, has_stale_copy_in_cache, error_code); |
4743 WebURLRequest failed_request = CreateURLRequestForNavigation( | 4745 WebURLRequest failed_request = CreateURLRequestForNavigation( |
4744 common_params, scoped_ptr<StreamOverrideParameters>(), | 4746 common_params, scoped_ptr<StreamOverrideParameters>(), |
4745 frame_->isViewSourceModeEnabled()); | 4747 frame_->isViewSourceModeEnabled()); |
4746 SendFailedProvisionalLoad(failed_request, error, frame_); | 4748 SendFailedProvisionalLoad(failed_request, error, frame_); |
4747 | 4749 |
| 4750 // This check should have been done on the browser side already. |
4748 if (!ShouldDisplayErrorPageForFailedLoad(error_code, common_params.url)) { | 4751 if (!ShouldDisplayErrorPageForFailedLoad(error_code, common_params.url)) { |
4749 // TODO(avi): Remove this; we shouldn't ever be dropping navigations. | 4752 NOTREACHED(); |
4750 // http://crbug.com/501960 | |
4751 Send(new FrameHostMsg_DidDropNavigation(routing_id_)); | |
4752 return; | 4753 return; |
4753 } | 4754 } |
4754 | 4755 |
4755 // Make sure errors are not shown in view source mode. | 4756 // Make sure errors are not shown in view source mode. |
4756 frame_->enableViewSourceMode(false); | 4757 frame_->enableViewSourceMode(false); |
4757 | 4758 |
4758 // Replace the current history entry in reloads, history navigations and loads | 4759 // Replace the current history entry in reloads, history navigations and loads |
4759 // of the same url. This corresponds to Blink's notion of a standard | 4760 // of the same url. This corresponds to Blink's notion of a standard |
4760 // commit. | 4761 // commit. |
4761 // TODO(clamy): see if initial commits in subframes should be handled | 4762 // TODO(clamy): see if initial commits in subframes should be handled |
(...skipping 757 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5519 bool is_client_redirect = browser_side_navigation | 5520 bool is_client_redirect = browser_side_navigation |
5520 ? !!(common_params.transition & | 5521 ? !!(common_params.transition & |
5521 ui::PAGE_TRANSITION_CLIENT_REDIRECT) | 5522 ui::PAGE_TRANSITION_CLIENT_REDIRECT) |
5522 : false; | 5523 : false; |
5523 | 5524 |
5524 // Load the request. | 5525 // Load the request. |
5525 frame_->toWebLocalFrame()->load(request, load_type, | 5526 frame_->toWebLocalFrame()->load(request, load_type, |
5526 item_for_history_navigation, | 5527 item_for_history_navigation, |
5527 history_load_type, is_client_redirect); | 5528 history_load_type, is_client_redirect); |
5528 } | 5529 } |
| 5530 } else { |
| 5531 // The browser expects the frame to be loading this navigation. Inform it |
| 5532 // that the load stopped if needed. |
| 5533 if (!frame_->isLoading()) |
| 5534 Send(new FrameHostMsg_DidStopLoading(routing_id_)); |
5529 } | 5535 } |
5530 | 5536 |
5531 // In case LoadRequest failed before didCreateDataSource was called. | 5537 // In case LoadRequest failed before didCreateDataSource was called. |
5532 pending_navigation_params_.reset(); | 5538 pending_navigation_params_.reset(); |
5533 } | 5539 } |
5534 | 5540 |
5535 void RenderFrameImpl::UpdateEncoding(WebFrame* frame, | 5541 void RenderFrameImpl::UpdateEncoding(WebFrame* frame, |
5536 const std::string& encoding_name) { | 5542 const std::string& encoding_name) { |
5537 // Only update main frame's encoding_name. | 5543 // Only update main frame's encoding_name. |
5538 if (!frame->parent()) | 5544 if (!frame->parent()) |
(...skipping 594 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6133 int match_count, | 6139 int match_count, |
6134 int ordinal, | 6140 int ordinal, |
6135 const WebRect& selection_rect, | 6141 const WebRect& selection_rect, |
6136 bool final_status_update) { | 6142 bool final_status_update) { |
6137 Send(new FrameHostMsg_Find_Reply(routing_id_, request_id, match_count, | 6143 Send(new FrameHostMsg_Find_Reply(routing_id_, request_id, match_count, |
6138 selection_rect, ordinal, | 6144 selection_rect, ordinal, |
6139 final_status_update)); | 6145 final_status_update)); |
6140 } | 6146 } |
6141 | 6147 |
6142 } // namespace content | 6148 } // namespace content |
OLD | NEW |