Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(8)

Side by Side Diff: content/renderer/render_frame_impl.cc

Issue 1545973002: Remove the is_loading_ field from WebContentsImpl (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed issue with tests Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 4664 matching lines...) Expand 10 before | Expand all | Expand 10 after
4675 // provide it with the response to the request. 4675 // provide it with the response to the request.
4676 scoped_ptr<StreamOverrideParameters> stream_override( 4676 scoped_ptr<StreamOverrideParameters> stream_override(
4677 new StreamOverrideParameters()); 4677 new StreamOverrideParameters());
4678 stream_override->stream_url = stream_url; 4678 stream_override->stream_url = stream_url;
4679 stream_override->response = response; 4679 stream_override->response = response;
4680 4680
4681 NavigateInternal(common_params, StartNavigationParams(), request_params, 4681 NavigateInternal(common_params, StartNavigationParams(), request_params,
4682 std::move(stream_override)); 4682 std::move(stream_override));
4683 } 4683 }
4684 4684
4685 // PlzNavigate
4685 void RenderFrameImpl::OnFailedNavigation( 4686 void RenderFrameImpl::OnFailedNavigation(
4686 const CommonNavigationParams& common_params, 4687 const CommonNavigationParams& common_params,
4687 const RequestNavigationParams& request_params, 4688 const RequestNavigationParams& request_params,
4688 bool has_stale_copy_in_cache, 4689 bool has_stale_copy_in_cache,
4689 int error_code) { 4690 int error_code) {
4691 DCHECK(IsBrowserSideNavigationEnabled());
4690 bool is_reload = IsReload(common_params.navigation_type); 4692 bool is_reload = IsReload(common_params.navigation_type);
4691 bool is_history_navigation = request_params.page_state.IsValid(); 4693 bool is_history_navigation = request_params.page_state.IsValid();
4692 WebURLRequest::CachePolicy cache_policy = 4694 WebURLRequest::CachePolicy cache_policy =
4693 WebURLRequest::UseProtocolCachePolicy; 4695 WebURLRequest::UseProtocolCachePolicy;
4694 RenderFrameImpl::PrepareRenderViewForNavigation( 4696 RenderFrameImpl::PrepareRenderViewForNavigation(
4695 common_params.url, request_params, &is_reload, &cache_policy); 4697 common_params.url, request_params, &is_reload, &cache_policy);
4696 4698
4697 GetContentClient()->SetActiveURL(common_params.url); 4699 GetContentClient()->SetActiveURL(common_params.url);
4698 4700
4699 pending_navigation_params_.reset(new NavigationParams( 4701 pending_navigation_params_.reset(new NavigationParams(
4700 common_params, StartNavigationParams(), request_params)); 4702 common_params, StartNavigationParams(), request_params));
4701 4703
4702 // Inform the browser of the start of the provisional load. This is needed so 4704 // Inform the browser of the start of the provisional load. This is needed so
4703 // that the load is properly tracked by the WebNavigation API. 4705 // that the load is properly tracked by the WebNavigation API.
4704 Send(new FrameHostMsg_DidStartProvisionalLoad( 4706 Send(new FrameHostMsg_DidStartProvisionalLoad(
4705 routing_id_, common_params.url, common_params.navigation_start)); 4707 routing_id_, common_params.url, common_params.navigation_start));
4706 4708
4707 // Send the provisional load failure. 4709 // Send the provisional load failure.
4708 blink::WebURLError error = 4710 blink::WebURLError error =
4709 CreateWebURLError(common_params.url, has_stale_copy_in_cache, error_code); 4711 CreateWebURLError(common_params.url, has_stale_copy_in_cache, error_code);
4710 WebURLRequest failed_request = CreateURLRequestForNavigation( 4712 WebURLRequest failed_request = CreateURLRequestForNavigation(
4711 common_params, scoped_ptr<StreamOverrideParameters>(), 4713 common_params, scoped_ptr<StreamOverrideParameters>(),
4712 frame_->isViewSourceModeEnabled()); 4714 frame_->isViewSourceModeEnabled());
4713 SendFailedProvisionalLoad(failed_request, error, frame_); 4715 SendFailedProvisionalLoad(failed_request, error, frame_);
4714 4716
4717 // This check should have been done on the browser side already.
4715 if (!ShouldDisplayErrorPageForFailedLoad(error_code, common_params.url)) { 4718 if (!ShouldDisplayErrorPageForFailedLoad(error_code, common_params.url)) {
4716 // TODO(avi): Remove this; we shouldn't ever be dropping navigations. 4719 NOTREACHED();
4717 // http://crbug.com/501960
4718 Send(new FrameHostMsg_DidDropNavigation(routing_id_));
4719 return; 4720 return;
4720 } 4721 }
4721 4722
4722 // Make sure errors are not shown in view source mode. 4723 // Make sure errors are not shown in view source mode.
4723 frame_->enableViewSourceMode(false); 4724 frame_->enableViewSourceMode(false);
4724 4725
4725 // Replace the current history entry in reloads, history navigations and loads 4726 // Replace the current history entry in reloads, history navigations and loads
4726 // of the same url. This corresponds to Blink's notion of a standard 4727 // of the same url. This corresponds to Blink's notion of a standard
4727 // commit. 4728 // commit.
4728 // TODO(clamy): see if initial commits in subframes should be handled 4729 // TODO(clamy): see if initial commits in subframes should be handled
(...skipping 757 matching lines...) Expand 10 before | Expand all | Expand 10 after
5486 bool is_client_redirect = browser_side_navigation 5487 bool is_client_redirect = browser_side_navigation
5487 ? !!(common_params.transition & 5488 ? !!(common_params.transition &
5488 ui::PAGE_TRANSITION_CLIENT_REDIRECT) 5489 ui::PAGE_TRANSITION_CLIENT_REDIRECT)
5489 : false; 5490 : false;
5490 5491
5491 // Load the request. 5492 // Load the request.
5492 frame_->toWebLocalFrame()->load(request, load_type, 5493 frame_->toWebLocalFrame()->load(request, load_type,
5493 item_for_history_navigation, 5494 item_for_history_navigation,
5494 history_load_type, is_client_redirect); 5495 history_load_type, is_client_redirect);
5495 } 5496 }
5497 } else {
5498 // The browser expects the frame to be loading this navigation. Inform it
5499 // that the load stopped if needed.
5500 if (!frame_->isLoading())
5501 Send(new FrameHostMsg_DidStopLoading(routing_id_));
5496 } 5502 }
5497 5503
5498 // In case LoadRequest failed before didCreateDataSource was called. 5504 // In case LoadRequest failed before didCreateDataSource was called.
5499 pending_navigation_params_.reset(); 5505 pending_navigation_params_.reset();
5500 } 5506 }
5501 5507
5502 void RenderFrameImpl::UpdateEncoding(WebFrame* frame, 5508 void RenderFrameImpl::UpdateEncoding(WebFrame* frame,
5503 const std::string& encoding_name) { 5509 const std::string& encoding_name) {
5504 // Only update main frame's encoding_name. 5510 // Only update main frame's encoding_name.
5505 if (!frame->parent()) 5511 if (!frame->parent())
(...skipping 591 matching lines...) Expand 10 before | Expand all | Expand 10 after
6097 int match_count, 6103 int match_count,
6098 int ordinal, 6104 int ordinal,
6099 const WebRect& selection_rect, 6105 const WebRect& selection_rect,
6100 bool final_status_update) { 6106 bool final_status_update) {
6101 Send(new FrameHostMsg_Find_Reply(routing_id_, request_id, match_count, 6107 Send(new FrameHostMsg_Find_Reply(routing_id_, request_id, match_count,
6102 selection_rect, ordinal, 6108 selection_rect, ordinal,
6103 final_status_update)); 6109 final_status_update));
6104 } 6110 }
6105 6111
6106 } // namespace content 6112 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698