| 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 4672 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4683 // provide it with the response to the request. | 4683 // provide it with the response to the request. |
| 4684 scoped_ptr<StreamOverrideParameters> stream_override( | 4684 scoped_ptr<StreamOverrideParameters> stream_override( |
| 4685 new StreamOverrideParameters()); | 4685 new StreamOverrideParameters()); |
| 4686 stream_override->stream_url = stream_url; | 4686 stream_override->stream_url = stream_url; |
| 4687 stream_override->response = response; | 4687 stream_override->response = response; |
| 4688 | 4688 |
| 4689 NavigateInternal(common_params, StartNavigationParams(), request_params, | 4689 NavigateInternal(common_params, StartNavigationParams(), request_params, |
| 4690 std::move(stream_override)); | 4690 std::move(stream_override)); |
| 4691 } | 4691 } |
| 4692 | 4692 |
| 4693 // PlzNavigate |
| 4693 void RenderFrameImpl::OnFailedNavigation( | 4694 void RenderFrameImpl::OnFailedNavigation( |
| 4694 const CommonNavigationParams& common_params, | 4695 const CommonNavigationParams& common_params, |
| 4695 const RequestNavigationParams& request_params, | 4696 const RequestNavigationParams& request_params, |
| 4696 bool has_stale_copy_in_cache, | 4697 bool has_stale_copy_in_cache, |
| 4697 int error_code) { | 4698 int error_code) { |
| 4699 DCHECK(IsBrowserSideNavigationEnabled()); |
| 4698 bool is_reload = IsReload(common_params.navigation_type); | 4700 bool is_reload = IsReload(common_params.navigation_type); |
| 4699 bool is_history_navigation = request_params.page_state.IsValid(); | 4701 bool is_history_navigation = request_params.page_state.IsValid(); |
| 4700 WebURLRequest::CachePolicy cache_policy = | 4702 WebURLRequest::CachePolicy cache_policy = |
| 4701 WebURLRequest::UseProtocolCachePolicy; | 4703 WebURLRequest::UseProtocolCachePolicy; |
| 4702 RenderFrameImpl::PrepareRenderViewForNavigation( | 4704 RenderFrameImpl::PrepareRenderViewForNavigation( |
| 4703 common_params.url, request_params, &is_reload, &cache_policy); | 4705 common_params.url, request_params, &is_reload, &cache_policy); |
| 4704 | 4706 |
| 4705 GetContentClient()->SetActiveURL(common_params.url); | 4707 GetContentClient()->SetActiveURL(common_params.url); |
| 4706 | 4708 |
| 4707 pending_navigation_params_.reset(new NavigationParams( | 4709 pending_navigation_params_.reset(new NavigationParams( |
| 4708 common_params, StartNavigationParams(), request_params)); | 4710 common_params, StartNavigationParams(), request_params)); |
| 4709 | 4711 |
| 4710 // Inform the browser of the start of the provisional load. This is needed so | 4712 // Inform the browser of the start of the provisional load. This is needed so |
| 4711 // that the load is properly tracked by the WebNavigation API. | 4713 // that the load is properly tracked by the WebNavigation API. |
| 4712 Send(new FrameHostMsg_DidStartProvisionalLoad( | 4714 Send(new FrameHostMsg_DidStartProvisionalLoad( |
| 4713 routing_id_, common_params.url, common_params.navigation_start)); | 4715 routing_id_, common_params.url, common_params.navigation_start)); |
| 4714 | 4716 |
| 4715 // Send the provisional load failure. | 4717 // Send the provisional load failure. |
| 4716 blink::WebURLError error = | 4718 blink::WebURLError error = |
| 4717 CreateWebURLError(common_params.url, has_stale_copy_in_cache, error_code); | 4719 CreateWebURLError(common_params.url, has_stale_copy_in_cache, error_code); |
| 4718 WebURLRequest failed_request = CreateURLRequestForNavigation( | 4720 WebURLRequest failed_request = CreateURLRequestForNavigation( |
| 4719 common_params, scoped_ptr<StreamOverrideParameters>(), | 4721 common_params, scoped_ptr<StreamOverrideParameters>(), |
| 4720 frame_->isViewSourceModeEnabled()); | 4722 frame_->isViewSourceModeEnabled()); |
| 4721 SendFailedProvisionalLoad(failed_request, error, frame_); | 4723 SendFailedProvisionalLoad(failed_request, error, frame_); |
| 4722 | 4724 |
| 4725 // This check should have been done on the browser side already. |
| 4723 if (!ShouldDisplayErrorPageForFailedLoad(error_code, common_params.url)) { | 4726 if (!ShouldDisplayErrorPageForFailedLoad(error_code, common_params.url)) { |
| 4724 // TODO(avi): Remove this; we shouldn't ever be dropping navigations. | 4727 NOTREACHED(); |
| 4725 // http://crbug.com/501960 | |
| 4726 Send(new FrameHostMsg_DidDropNavigation(routing_id_)); | |
| 4727 return; | 4728 return; |
| 4728 } | 4729 } |
| 4729 | 4730 |
| 4730 // Make sure errors are not shown in view source mode. | 4731 // Make sure errors are not shown in view source mode. |
| 4731 frame_->enableViewSourceMode(false); | 4732 frame_->enableViewSourceMode(false); |
| 4732 | 4733 |
| 4733 // Replace the current history entry in reloads, history navigations and loads | 4734 // Replace the current history entry in reloads, history navigations and loads |
| 4734 // of the same url. This corresponds to Blink's notion of a standard | 4735 // of the same url. This corresponds to Blink's notion of a standard |
| 4735 // commit. | 4736 // commit. |
| 4736 // TODO(clamy): see if initial commits in subframes should be handled | 4737 // TODO(clamy): see if initial commits in subframes should be handled |
| (...skipping 757 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5494 bool is_client_redirect = browser_side_navigation | 5495 bool is_client_redirect = browser_side_navigation |
| 5495 ? !!(common_params.transition & | 5496 ? !!(common_params.transition & |
| 5496 ui::PAGE_TRANSITION_CLIENT_REDIRECT) | 5497 ui::PAGE_TRANSITION_CLIENT_REDIRECT) |
| 5497 : false; | 5498 : false; |
| 5498 | 5499 |
| 5499 // Load the request. | 5500 // Load the request. |
| 5500 frame_->toWebLocalFrame()->load(request, load_type, | 5501 frame_->toWebLocalFrame()->load(request, load_type, |
| 5501 item_for_history_navigation, | 5502 item_for_history_navigation, |
| 5502 history_load_type, is_client_redirect); | 5503 history_load_type, is_client_redirect); |
| 5503 } | 5504 } |
| 5505 } else { |
| 5506 // The browser expects the frame to be loading this navigation. Inform it |
| 5507 // that the load stopped if needed. |
| 5508 if (!frame_->isLoading()) |
| 5509 Send(new FrameHostMsg_DidStopLoading(routing_id_)); |
| 5504 } | 5510 } |
| 5505 | 5511 |
| 5506 // In case LoadRequest failed before didCreateDataSource was called. | 5512 // In case LoadRequest failed before didCreateDataSource was called. |
| 5507 pending_navigation_params_.reset(); | 5513 pending_navigation_params_.reset(); |
| 5508 } | 5514 } |
| 5509 | 5515 |
| 5510 void RenderFrameImpl::UpdateEncoding(WebFrame* frame, | 5516 void RenderFrameImpl::UpdateEncoding(WebFrame* frame, |
| 5511 const std::string& encoding_name) { | 5517 const std::string& encoding_name) { |
| 5512 // Only update main frame's encoding_name. | 5518 // Only update main frame's encoding_name. |
| 5513 if (!frame->parent()) | 5519 if (!frame->parent()) |
| (...skipping 594 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6108 int match_count, | 6114 int match_count, |
| 6109 int ordinal, | 6115 int ordinal, |
| 6110 const WebRect& selection_rect, | 6116 const WebRect& selection_rect, |
| 6111 bool final_status_update) { | 6117 bool final_status_update) { |
| 6112 Send(new FrameHostMsg_Find_Reply(routing_id_, request_id, match_count, | 6118 Send(new FrameHostMsg_Find_Reply(routing_id_, request_id, match_count, |
| 6113 selection_rect, ordinal, | 6119 selection_rect, ordinal, |
| 6114 final_status_update)); | 6120 final_status_update)); |
| 6115 } | 6121 } |
| 6116 | 6122 |
| 6117 } // namespace content | 6123 } // namespace content |
| OLD | NEW |