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 4603 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4614 // provide it with the response to the request. | 4614 // provide it with the response to the request. |
4615 scoped_ptr<StreamOverrideParameters> stream_override( | 4615 scoped_ptr<StreamOverrideParameters> stream_override( |
4616 new StreamOverrideParameters()); | 4616 new StreamOverrideParameters()); |
4617 stream_override->stream_url = stream_url; | 4617 stream_override->stream_url = stream_url; |
4618 stream_override->response = response; | 4618 stream_override->response = response; |
4619 | 4619 |
4620 NavigateInternal(common_params, StartNavigationParams(), request_params, | 4620 NavigateInternal(common_params, StartNavigationParams(), request_params, |
4621 std::move(stream_override)); | 4621 std::move(stream_override)); |
4622 } | 4622 } |
4623 | 4623 |
| 4624 // PlzNavigate |
4624 void RenderFrameImpl::OnFailedNavigation( | 4625 void RenderFrameImpl::OnFailedNavigation( |
4625 const CommonNavigationParams& common_params, | 4626 const CommonNavigationParams& common_params, |
4626 const RequestNavigationParams& request_params, | 4627 const RequestNavigationParams& request_params, |
4627 bool has_stale_copy_in_cache, | 4628 bool has_stale_copy_in_cache, |
4628 int error_code) { | 4629 int error_code) { |
| 4630 DCHECK(IsBrowserSideNavigationEnabled()); |
4629 bool is_reload = IsReload(common_params.navigation_type); | 4631 bool is_reload = IsReload(common_params.navigation_type); |
4630 bool is_history_navigation = request_params.page_state.IsValid(); | 4632 bool is_history_navigation = request_params.page_state.IsValid(); |
4631 WebURLRequest::CachePolicy cache_policy = | 4633 WebURLRequest::CachePolicy cache_policy = |
4632 WebURLRequest::UseProtocolCachePolicy; | 4634 WebURLRequest::UseProtocolCachePolicy; |
4633 RenderFrameImpl::PrepareRenderViewForNavigation( | 4635 RenderFrameImpl::PrepareRenderViewForNavigation( |
4634 common_params.url, request_params, &is_reload, &cache_policy); | 4636 common_params.url, request_params, &is_reload, &cache_policy); |
4635 | 4637 |
4636 GetContentClient()->SetActiveURL(common_params.url); | 4638 GetContentClient()->SetActiveURL(common_params.url); |
4637 | 4639 |
4638 pending_navigation_params_.reset(new NavigationParams( | 4640 pending_navigation_params_.reset(new NavigationParams( |
4639 common_params, StartNavigationParams(), request_params)); | 4641 common_params, StartNavigationParams(), request_params)); |
4640 | 4642 |
4641 // Inform the browser of the start of the provisional load. This is needed so | 4643 // Inform the browser of the start of the provisional load. This is needed so |
4642 // that the load is properly tracked by the WebNavigation API. | 4644 // that the load is properly tracked by the WebNavigation API. |
4643 Send(new FrameHostMsg_DidStartProvisionalLoad( | 4645 Send(new FrameHostMsg_DidStartProvisionalLoad( |
4644 routing_id_, common_params.url, common_params.navigation_start)); | 4646 routing_id_, common_params.url, common_params.navigation_start)); |
4645 | 4647 |
4646 // Send the provisional load failure. | 4648 // Send the provisional load failure. |
4647 blink::WebURLError error = | 4649 blink::WebURLError error = |
4648 CreateWebURLError(common_params.url, has_stale_copy_in_cache, error_code); | 4650 CreateWebURLError(common_params.url, has_stale_copy_in_cache, error_code); |
4649 WebURLRequest failed_request = CreateURLRequestForNavigation( | 4651 WebURLRequest failed_request = CreateURLRequestForNavigation( |
4650 common_params, scoped_ptr<StreamOverrideParameters>(), | 4652 common_params, scoped_ptr<StreamOverrideParameters>(), |
4651 frame_->isViewSourceModeEnabled()); | 4653 frame_->isViewSourceModeEnabled()); |
4652 SendFailedProvisionalLoad(failed_request, error, frame_); | 4654 SendFailedProvisionalLoad(failed_request, error, frame_); |
4653 | 4655 |
| 4656 // This check should have been done on the browser side already. |
4654 if (!ShouldDisplayErrorPageForFailedLoad(error_code, common_params.url)) { | 4657 if (!ShouldDisplayErrorPageForFailedLoad(error_code, common_params.url)) { |
4655 // TODO(avi): Remove this; we shouldn't ever be dropping navigations. | 4658 NOTREACHED(); |
4656 // http://crbug.com/501960 | |
4657 Send(new FrameHostMsg_DidDropNavigation(routing_id_)); | |
4658 return; | 4659 return; |
4659 } | 4660 } |
4660 | 4661 |
4661 // Make sure errors are not shown in view source mode. | 4662 // Make sure errors are not shown in view source mode. |
4662 frame_->enableViewSourceMode(false); | 4663 frame_->enableViewSourceMode(false); |
4663 | 4664 |
4664 // Replace the current history entry in reloads, history navigations and loads | 4665 // Replace the current history entry in reloads, history navigations and loads |
4665 // of the same url. This corresponds to Blink's notion of a standard | 4666 // of the same url. This corresponds to Blink's notion of a standard |
4666 // commit. | 4667 // commit. |
4667 // TODO(clamy): see if initial commits in subframes should be handled | 4668 // TODO(clamy): see if initial commits in subframes should be handled |
(...skipping 523 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5191 if (!common_params.base_url_for_data_url.is_empty() || | 5192 if (!common_params.base_url_for_data_url.is_empty() || |
5192 (browser_side_navigation && | 5193 (browser_side_navigation && |
5193 common_params.url.SchemeIs(url::kDataScheme))) { | 5194 common_params.url.SchemeIs(url::kDataScheme))) { |
5194 LoadDataURL(common_params, request_params, frame_, load_type); | 5195 LoadDataURL(common_params, request_params, frame_, load_type); |
5195 } else { | 5196 } else { |
5196 // Load the request. | 5197 // Load the request. |
5197 frame_->toWebLocalFrame()->load(request, load_type, | 5198 frame_->toWebLocalFrame()->load(request, load_type, |
5198 item_for_history_navigation, | 5199 item_for_history_navigation, |
5199 history_load_type); | 5200 history_load_type); |
5200 } | 5201 } |
| 5202 } else { |
| 5203 // The browser expects the frame to be loading this navigation. Inform it |
| 5204 // that the load stopped if needed. |
| 5205 if (!frame_->isLoading()) |
| 5206 Send(new FrameHostMsg_DidStopLoading(routing_id_)); |
5201 } | 5207 } |
5202 | 5208 |
5203 // In case LoadRequest failed before didCreateDataSource was called. | 5209 // In case LoadRequest failed before didCreateDataSource was called. |
5204 pending_navigation_params_.reset(); | 5210 pending_navigation_params_.reset(); |
5205 } | 5211 } |
5206 | 5212 |
5207 void RenderFrameImpl::UpdateEncoding(WebFrame* frame, | 5213 void RenderFrameImpl::UpdateEncoding(WebFrame* frame, |
5208 const std::string& encoding_name) { | 5214 const std::string& encoding_name) { |
5209 // Only update main frame's encoding_name. | 5215 // Only update main frame's encoding_name. |
5210 if (!frame->parent()) | 5216 if (!frame->parent()) |
(...skipping 566 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5777 media::ConvertToSwitchOutputDeviceCB(web_callbacks); | 5783 media::ConvertToSwitchOutputDeviceCB(web_callbacks); |
5778 scoped_refptr<media::AudioOutputDevice> device = | 5784 scoped_refptr<media::AudioOutputDevice> device = |
5779 AudioDeviceFactory::NewOutputDevice(routing_id_, 0, sink_id.utf8(), | 5785 AudioDeviceFactory::NewOutputDevice(routing_id_, 0, sink_id.utf8(), |
5780 security_origin); | 5786 security_origin); |
5781 media::OutputDeviceStatus status = device->GetDeviceStatus(); | 5787 media::OutputDeviceStatus status = device->GetDeviceStatus(); |
5782 device->Stop(); | 5788 device->Stop(); |
5783 callback.Run(status); | 5789 callback.Run(status); |
5784 } | 5790 } |
5785 | 5791 |
5786 } // namespace content | 5792 } // namespace content |
OLD | NEW |