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