| 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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 54 #include "content/common/frame_messages.h" | 54 #include "content/common/frame_messages.h" |
| 55 #include "content/common/frame_owner_properties.h" | 55 #include "content/common/frame_owner_properties.h" |
| 56 #include "content/common/frame_replication_state.h" | 56 #include "content/common/frame_replication_state.h" |
| 57 #include "content/common/gpu/client/context_provider_command_buffer.h" | 57 #include "content/common/gpu/client/context_provider_command_buffer.h" |
| 58 #include "content/common/input_messages.h" | 58 #include "content/common/input_messages.h" |
| 59 #include "content/common/navigation_params.h" | 59 #include "content/common/navigation_params.h" |
| 60 #include "content/common/page_messages.h" | 60 #include "content/common/page_messages.h" |
| 61 #include "content/common/savable_subframe.h" | 61 #include "content/common/savable_subframe.h" |
| 62 #include "content/common/service_worker/service_worker_types.h" | 62 #include "content/common/service_worker/service_worker_types.h" |
| 63 #include "content/common/site_isolation_policy.h" | 63 #include "content/common/site_isolation_policy.h" |
| 64 #include "content/common/ssl_status_serialization.h" | |
| 65 #include "content/common/swapped_out_messages.h" | 64 #include "content/common/swapped_out_messages.h" |
| 66 #include "content/common/view_messages.h" | 65 #include "content/common/view_messages.h" |
| 67 #include "content/public/common/bindings_policy.h" | 66 #include "content/public/common/bindings_policy.h" |
| 68 #include "content/public/common/browser_side_navigation_policy.h" | 67 #include "content/public/common/browser_side_navigation_policy.h" |
| 69 #include "content/public/common/content_constants.h" | 68 #include "content/public/common/content_constants.h" |
| 70 #include "content/public/common/content_features.h" | 69 #include "content/public/common/content_features.h" |
| 71 #include "content/public/common/content_switches.h" | 70 #include "content/public/common/content_switches.h" |
| 72 #include "content/public/common/context_menu_params.h" | 71 #include "content/public/common/context_menu_params.h" |
| 73 #include "content/public/common/file_chooser_file_info.h" | 72 #include "content/public/common/file_chooser_file_info.h" |
| 74 #include "content/public/common/file_chooser_params.h" | 73 #include "content/public/common/file_chooser_params.h" |
| (...skipping 702 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 777 | 776 |
| 778 bool useBinaryEncoding() override { return params_.mhtml_binary_encoding; } | 777 bool useBinaryEncoding() override { return params_.mhtml_binary_encoding; } |
| 779 | 778 |
| 780 private: | 779 private: |
| 781 const FrameMsg_SerializeAsMHTML_Params& params_; | 780 const FrameMsg_SerializeAsMHTML_Params& params_; |
| 782 std::set<std::string>* digests_of_uris_of_serialized_resources_; | 781 std::set<std::string>* digests_of_uris_of_serialized_resources_; |
| 783 | 782 |
| 784 DISALLOW_COPY_AND_ASSIGN(MHTMLPartsGenerationDelegate); | 783 DISALLOW_COPY_AND_ASSIGN(MHTMLPartsGenerationDelegate); |
| 785 }; | 784 }; |
| 786 | 785 |
| 787 // Returns true if a subresource certificate error (described by |url| | |
| 788 // and |security_info|) is "interesting" to the browser process. The | |
| 789 // browser process is interested in certificate errors that differ from | |
| 790 // certificate errors encountered while loading the main frame's main | |
| 791 // resource. In other words, it would be confusing to mark a page as | |
| 792 // having displayed/run insecure content when the whole page has already | |
| 793 // been marked as insecure for the same reason, so subresources with the | |
| 794 // same certificate errors as the main resource are not sent to the | |
| 795 // browser process. | |
| 796 bool IsContentWithCertificateErrorsRelevantToUI( | |
| 797 blink::WebFrame* frame, | |
| 798 const blink::WebURL& url, | |
| 799 const blink::WebCString& security_info) { | |
| 800 blink::WebFrame* main_frame = frame->top(); | |
| 801 | |
| 802 // If the main frame is remote, then it must be cross-site and | |
| 803 // therefore this subresource's certificate errors are potentially | |
| 804 // interesting to the browser (not redundant with the main frame's | |
| 805 // main resource). | |
| 806 if (main_frame->isWebRemoteFrame()) | |
| 807 return true; | |
| 808 | |
| 809 WebDataSource* main_ds = main_frame->toWebLocalFrame()->dataSource(); | |
| 810 content::SSLStatus ssl_status; | |
| 811 content::SSLStatus main_resource_ssl_status; | |
| 812 CHECK(DeserializeSecurityInfo(security_info, &ssl_status)); | |
| 813 CHECK(DeserializeSecurityInfo(main_ds->response().securityInfo(), | |
| 814 &main_resource_ssl_status)); | |
| 815 | |
| 816 // Do not send subresource certificate errors if they are the same | |
| 817 // as errors that occured during the main page load. This compares | |
| 818 // most, but not all, fields of SSLStatus. For example, this check | |
| 819 // does not compare |content_status| because the navigation entry | |
| 820 // might have mixed content but also have the exact same SSL | |
| 821 // connection properties as the subresource, thereby making the | |
| 822 // subresource errors duplicative. | |
| 823 return (!url::Origin(GURL(url)).IsSameOriginWith( | |
| 824 url::Origin(GURL(main_ds->request().url()))) || | |
| 825 main_resource_ssl_status.cert_id != ssl_status.cert_id || | |
| 826 main_resource_ssl_status.cert_status != ssl_status.cert_status || | |
| 827 main_resource_ssl_status.security_bits != ssl_status.security_bits || | |
| 828 main_resource_ssl_status.connection_status != | |
| 829 ssl_status.connection_status); | |
| 830 } | |
| 831 | |
| 832 bool IsHttpPost(const blink::WebURLRequest& request) { | 786 bool IsHttpPost(const blink::WebURLRequest& request) { |
| 833 return request.httpMethod().utf8() == "POST"; | 787 return request.httpMethod().utf8() == "POST"; |
| 834 } | 788 } |
| 835 | 789 |
| 836 #if defined(OS_ANDROID) | 790 #if defined(OS_ANDROID) |
| 837 // Returns true if WMPI should be used for playback, false otherwise. | 791 // Returns true if WMPI should be used for playback, false otherwise. |
| 838 // | 792 // |
| 839 // Note that HLS and MP4 detection are pre-redirect and path-based. It is | 793 // Note that HLS and MP4 detection are pre-redirect and path-based. It is |
| 840 // possible to load such a URL and find different content. | 794 // possible to load such a URL and find different content. |
| 841 bool UseWebMediaPlayerImpl(const GURL& url) { | 795 bool UseWebMediaPlayerImpl(const GURL& url) { |
| (...skipping 3368 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4210 Send(new FrameHostMsg_DidRunInsecureContent( | 4164 Send(new FrameHostMsg_DidRunInsecureContent( |
| 4211 routing_id_, GURL(origin.toString().utf8()), target)); | 4165 routing_id_, GURL(origin.toString().utf8()), target)); |
| 4212 GetContentClient()->renderer()->RecordRapporURL( | 4166 GetContentClient()->renderer()->RecordRapporURL( |
| 4213 "ContentSettings.MixedScript.RanMixedScript", | 4167 "ContentSettings.MixedScript.RanMixedScript", |
| 4214 GURL(origin.toString().utf8())); | 4168 GURL(origin.toString().utf8())); |
| 4215 } | 4169 } |
| 4216 | 4170 |
| 4217 void RenderFrameImpl::didDisplayContentWithCertificateErrors( | 4171 void RenderFrameImpl::didDisplayContentWithCertificateErrors( |
| 4218 const blink::WebURL& url, | 4172 const blink::WebURL& url, |
| 4219 const blink::WebCString& security_info) { | 4173 const blink::WebCString& security_info) { |
| 4220 if (IsContentWithCertificateErrorsRelevantToUI(frame_, url, security_info)) { | 4174 Send(new FrameHostMsg_DidDisplayContentWithCertificateErrors( |
| 4221 Send(new FrameHostMsg_DidDisplayContentWithCertificateErrors( | 4175 routing_id_, url)); |
| 4222 routing_id_, url)); | |
| 4223 } | |
| 4224 } | 4176 } |
| 4225 | 4177 |
| 4226 void RenderFrameImpl::didRunContentWithCertificateErrors( | 4178 void RenderFrameImpl::didRunContentWithCertificateErrors( |
| 4227 const blink::WebURL& url, | 4179 const blink::WebURL& url, |
| 4228 const blink::WebCString& security_info) { | 4180 const blink::WebCString& security_info) { |
| 4229 if (IsContentWithCertificateErrorsRelevantToUI(frame_, url, security_info)) | 4181 Send(new FrameHostMsg_DidRunContentWithCertificateErrors(routing_id_, url)); |
| 4230 Send(new FrameHostMsg_DidRunContentWithCertificateErrors(routing_id_, url)); | |
| 4231 } | 4182 } |
| 4232 | 4183 |
| 4233 void RenderFrameImpl::didChangePerformanceTiming() { | 4184 void RenderFrameImpl::didChangePerformanceTiming() { |
| 4234 FOR_EACH_OBSERVER(RenderFrameObserver, | 4185 FOR_EACH_OBSERVER(RenderFrameObserver, |
| 4235 observers_, | 4186 observers_, |
| 4236 DidChangePerformanceTiming()); | 4187 DidChangePerformanceTiming()); |
| 4237 } | 4188 } |
| 4238 | 4189 |
| 4239 void RenderFrameImpl::didObserveLoadingBehavior( | 4190 void RenderFrameImpl::didObserveLoadingBehavior( |
| 4240 blink::WebLoadingBehaviorFlag behavior) { | 4191 blink::WebLoadingBehaviorFlag behavior) { |
| (...skipping 2104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6345 // event target. Potentially a Pepper plugin will receive the event. | 6296 // event target. Potentially a Pepper plugin will receive the event. |
| 6346 // In order to tell whether a plugin gets the last mouse event and which it | 6297 // In order to tell whether a plugin gets the last mouse event and which it |
| 6347 // is, we set |pepper_last_mouse_event_target_| to null here. If a plugin gets | 6298 // is, we set |pepper_last_mouse_event_target_| to null here. If a plugin gets |
| 6348 // the event, it will notify us via DidReceiveMouseEvent() and set itself as | 6299 // the event, it will notify us via DidReceiveMouseEvent() and set itself as |
| 6349 // |pepper_last_mouse_event_target_|. | 6300 // |pepper_last_mouse_event_target_|. |
| 6350 pepper_last_mouse_event_target_ = nullptr; | 6301 pepper_last_mouse_event_target_ = nullptr; |
| 6351 #endif | 6302 #endif |
| 6352 } | 6303 } |
| 6353 | 6304 |
| 6354 } // namespace content | 6305 } // namespace content |
| OLD | NEW |