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 | 9 |
10 #include "base/auto_reset.h" | 10 #include "base/auto_reset.h" |
(...skipping 3917 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3928 params.referrer = | 3928 params.referrer = |
3929 Referrer(params.redirects[0], ds->request().referrerPolicy()); | 3929 Referrer(params.redirects[0], ds->request().referrerPolicy()); |
3930 params.transition = ui::PageTransitionFromInt( | 3930 params.transition = ui::PageTransitionFromInt( |
3931 params.transition | ui::PAGE_TRANSITION_CLIENT_REDIRECT); | 3931 params.transition | ui::PAGE_TRANSITION_CLIENT_REDIRECT); |
3932 } else { | 3932 } else { |
3933 params.referrer = RenderViewImpl::GetReferrerFromRequest( | 3933 params.referrer = RenderViewImpl::GetReferrerFromRequest( |
3934 frame, ds->request()); | 3934 frame, ds->request()); |
3935 } | 3935 } |
3936 | 3936 |
3937 base::string16 method = request.httpMethod(); | 3937 base::string16 method = request.httpMethod(); |
3938 if (EqualsASCII(method, "POST")) { | 3938 if (base::EqualsASCII(method, "POST")) { |
3939 params.is_post = true; | 3939 params.is_post = true; |
3940 params.post_id = ExtractPostId(entry); | 3940 params.post_id = ExtractPostId(entry); |
3941 } | 3941 } |
3942 | 3942 |
3943 // Send the user agent override back. | 3943 // Send the user agent override back. |
3944 params.is_overriding_user_agent = internal_data->is_overriding_user_agent(); | 3944 params.is_overriding_user_agent = internal_data->is_overriding_user_agent(); |
3945 | 3945 |
3946 // Track the URL of the original request. We use the first entry of the | 3946 // Track the URL of the original request. We use the first entry of the |
3947 // redirect chain if it exists because the chain may have started in another | 3947 // redirect chain if it exists because the chain may have started in another |
3948 // process. | 3948 // process. |
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4157 // script, drag-n-drop operation, etc. | 4157 // script, drag-n-drop operation, etc. |
4158 DocumentState* document_state = static_cast<DocumentState*>(info.extraData); | 4158 DocumentState* document_state = static_cast<DocumentState*>(info.extraData); |
4159 bool is_content_initiated = | 4159 bool is_content_initiated = |
4160 document_state->navigation_state()->IsContentInitiated(); | 4160 document_state->navigation_state()->IsContentInitiated(); |
4161 | 4161 |
4162 // If the browser is interested, then give it a chance to look at the request. | 4162 // If the browser is interested, then give it a chance to look at the request. |
4163 if (is_content_initiated) { | 4163 if (is_content_initiated) { |
4164 bool is_form_post = | 4164 bool is_form_post = |
4165 ((info.navigationType == blink::WebNavigationTypeFormSubmitted) || | 4165 ((info.navigationType == blink::WebNavigationTypeFormSubmitted) || |
4166 (info.navigationType == blink::WebNavigationTypeFormResubmitted)) && | 4166 (info.navigationType == blink::WebNavigationTypeFormResubmitted)) && |
4167 EqualsASCII(info.urlRequest.httpMethod(), "POST"); | 4167 base::EqualsASCII(info.urlRequest.httpMethod(), "POST"); |
4168 bool browser_handles_request = | 4168 bool browser_handles_request = |
4169 render_view_->renderer_preferences_ | 4169 render_view_->renderer_preferences_ |
4170 .browser_handles_non_local_top_level_requests | 4170 .browser_handles_non_local_top_level_requests |
4171 && IsNonLocalTopLevelNavigation(url, info.frame, info.navigationType, | 4171 && IsNonLocalTopLevelNavigation(url, info.frame, info.navigationType, |
4172 is_form_post); | 4172 is_form_post); |
4173 if (!browser_handles_request) { | 4173 if (!browser_handles_request) { |
4174 browser_handles_request = IsTopLevelNavigation(info.frame) && | 4174 browser_handles_request = IsTopLevelNavigation(info.frame) && |
4175 render_view_->renderer_preferences_ | 4175 render_view_->renderer_preferences_ |
4176 .browser_handles_all_top_level_requests; | 4176 .browser_handles_all_top_level_requests; |
4177 } | 4177 } |
(...skipping 545 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4723 } else { | 4723 } else { |
4724 CHECK(false) << "Invalid URL passed: " | 4724 CHECK(false) << "Invalid URL passed: " |
4725 << params.url.possibly_invalid_spec(); | 4725 << params.url.possibly_invalid_spec(); |
4726 } | 4726 } |
4727 } | 4727 } |
4728 | 4728 |
4729 void RenderFrameImpl::SendFailedProvisionalLoad( | 4729 void RenderFrameImpl::SendFailedProvisionalLoad( |
4730 const blink::WebURLRequest& request, | 4730 const blink::WebURLRequest& request, |
4731 const blink::WebURLError& error, | 4731 const blink::WebURLError& error, |
4732 blink::WebLocalFrame* frame) { | 4732 blink::WebLocalFrame* frame) { |
4733 bool show_repost_interstitial = (error.reason == net::ERR_CACHE_MISS && | 4733 bool show_repost_interstitial = |
4734 EqualsASCII(request.httpMethod(), "POST")); | 4734 (error.reason == net::ERR_CACHE_MISS && |
| 4735 base::EqualsASCII(request.httpMethod(), "POST")); |
4735 | 4736 |
4736 FrameHostMsg_DidFailProvisionalLoadWithError_Params params; | 4737 FrameHostMsg_DidFailProvisionalLoadWithError_Params params; |
4737 params.error_code = error.reason; | 4738 params.error_code = error.reason; |
4738 GetContentClient()->renderer()->GetNavigationErrorStrings( | 4739 GetContentClient()->renderer()->GetNavigationErrorStrings( |
4739 render_view_.get(), frame, request, error, NULL, | 4740 render_view_.get(), frame, request, error, NULL, |
4740 ¶ms.error_description); | 4741 ¶ms.error_description); |
4741 params.url = error.unreachableURL; | 4742 params.url = error.unreachableURL; |
4742 params.showing_repost_interstitial = show_repost_interstitial; | 4743 params.showing_repost_interstitial = show_repost_interstitial; |
4743 Send(new FrameHostMsg_DidFailProvisionalLoadWithError(routing_id_, params)); | 4744 Send(new FrameHostMsg_DidFailProvisionalLoadWithError(routing_id_, params)); |
4744 } | 4745 } |
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4923 #elif defined(ENABLE_BROWSER_CDMS) | 4924 #elif defined(ENABLE_BROWSER_CDMS) |
4924 cdm_manager_, | 4925 cdm_manager_, |
4925 #endif | 4926 #endif |
4926 this); | 4927 this); |
4927 } | 4928 } |
4928 | 4929 |
4929 return cdm_factory_; | 4930 return cdm_factory_; |
4930 } | 4931 } |
4931 | 4932 |
4932 } // namespace content | 4933 } // namespace content |
OLD | NEW |