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