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 701 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
776 | 775 |
777 bool useBinaryEncoding() override { return params_.mhtml_binary_encoding; } | 776 bool useBinaryEncoding() override { return params_.mhtml_binary_encoding; } |
778 | 777 |
779 private: | 778 private: |
780 const FrameMsg_SerializeAsMHTML_Params& params_; | 779 const FrameMsg_SerializeAsMHTML_Params& params_; |
781 std::set<std::string>* digests_of_uris_of_serialized_resources_; | 780 std::set<std::string>* digests_of_uris_of_serialized_resources_; |
782 | 781 |
783 DISALLOW_COPY_AND_ASSIGN(MHTMLPartsGenerationDelegate); | 782 DISALLOW_COPY_AND_ASSIGN(MHTMLPartsGenerationDelegate); |
784 }; | 783 }; |
785 | 784 |
786 // Returns true if a subresource certificate error (described by |url| | |
787 // and |security_info|) is "interesting" to the browser process. The | |
788 // browser process is interested in certificate errors that differ from | |
789 // certificate errors encountered while loading the main frame's main | |
790 // resource. In other words, it would be confusing to mark a page as | |
791 // having displayed/run insecure content when the whole page has already | |
792 // been marked as insecure for the same reason, so subresources with the | |
793 // same certificate errors as the main resource are not sent to the | |
794 // browser process. | |
795 bool IsContentWithCertificateErrorsRelevantToUI( | |
796 blink::WebFrame* frame, | |
797 const blink::WebURL& url, | |
798 const blink::WebCString& security_info) { | |
799 blink::WebFrame* main_frame = frame->top(); | |
800 | |
801 // If the main frame is remote, then it must be cross-site and | |
802 // therefore this subresource's certificate errors are potentially | |
803 // interesting to the browser (not redundant with the main frame's | |
804 // main resource). | |
805 if (main_frame->isWebRemoteFrame()) | |
806 return true; | |
807 | |
808 WebDataSource* main_ds = main_frame->toWebLocalFrame()->dataSource(); | |
809 content::SSLStatus ssl_status; | |
810 content::SSLStatus main_resource_ssl_status; | |
811 CHECK(DeserializeSecurityInfo(security_info, &ssl_status)); | |
812 CHECK(DeserializeSecurityInfo(main_ds->response().securityInfo(), | |
813 &main_resource_ssl_status)); | |
814 | |
815 // Do not send subresource certificate errors if they are the same | |
816 // as errors that occured during the main page load. This compares | |
817 // most, but not all, fields of SSLStatus. For example, this check | |
818 // does not compare |content_status| because the navigation entry | |
819 // might have mixed content but also have the exact same SSL | |
820 // connection properties as the subresource, thereby making the | |
821 // subresource errors duplicative. | |
822 return (!url::Origin(GURL(url)).IsSameOriginWith( | |
823 url::Origin(GURL(main_ds->request().url()))) || | |
824 main_resource_ssl_status.cert_id != ssl_status.cert_id || | |
825 main_resource_ssl_status.cert_status != ssl_status.cert_status || | |
826 main_resource_ssl_status.security_bits != ssl_status.security_bits || | |
827 main_resource_ssl_status.connection_status != | |
828 ssl_status.connection_status); | |
829 } | |
830 | |
831 bool IsHttpPost(const blink::WebURLRequest& request) { | 785 bool IsHttpPost(const blink::WebURLRequest& request) { |
832 return request.httpMethod().utf8() == "POST"; | 786 return request.httpMethod().utf8() == "POST"; |
833 } | 787 } |
834 | 788 |
835 #if defined(OS_ANDROID) | 789 #if defined(OS_ANDROID) |
836 // Returns true if WMPI should be used for playback, false otherwise. | 790 // Returns true if WMPI should be used for playback, false otherwise. |
837 // | 791 // |
838 // Note that HLS and MP4 detection are pre-redirect and path-based. It is | 792 // Note that HLS and MP4 detection are pre-redirect and path-based. It is |
839 // possible to load such a URL and find different content. | 793 // possible to load such a URL and find different content. |
840 bool UseWebMediaPlayerImpl(const GURL& url) { | 794 bool UseWebMediaPlayerImpl(const GURL& url) { |
(...skipping 3367 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4208 Send(new FrameHostMsg_DidRunInsecureContent( | 4162 Send(new FrameHostMsg_DidRunInsecureContent( |
4209 routing_id_, GURL(origin.toString().utf8()), target)); | 4163 routing_id_, GURL(origin.toString().utf8()), target)); |
4210 GetContentClient()->renderer()->RecordRapporURL( | 4164 GetContentClient()->renderer()->RecordRapporURL( |
4211 "ContentSettings.MixedScript.RanMixedScript", | 4165 "ContentSettings.MixedScript.RanMixedScript", |
4212 GURL(origin.toString().utf8())); | 4166 GURL(origin.toString().utf8())); |
4213 } | 4167 } |
4214 | 4168 |
4215 void RenderFrameImpl::didDisplayContentWithCertificateErrors( | 4169 void RenderFrameImpl::didDisplayContentWithCertificateErrors( |
4216 const blink::WebURL& url, | 4170 const blink::WebURL& url, |
4217 const blink::WebCString& security_info) { | 4171 const blink::WebCString& security_info) { |
4218 if (IsContentWithCertificateErrorsRelevantToUI(frame_, url, security_info)) { | 4172 Send(new FrameHostMsg_DidDisplayContentWithCertificateErrors( |
4219 Send(new FrameHostMsg_DidDisplayContentWithCertificateErrors( | 4173 routing_id_, url)); |
4220 routing_id_, url)); | |
4221 } | |
4222 } | 4174 } |
4223 | 4175 |
4224 void RenderFrameImpl::didRunContentWithCertificateErrors( | 4176 void RenderFrameImpl::didRunContentWithCertificateErrors( |
4225 const blink::WebURL& url, | 4177 const blink::WebURL& url, |
4226 const blink::WebCString& security_info) { | 4178 const blink::WebCString& security_info) { |
4227 if (IsContentWithCertificateErrorsRelevantToUI(frame_, url, security_info)) | 4179 Send(new FrameHostMsg_DidRunContentWithCertificateErrors(routing_id_, url)); |
4228 Send(new FrameHostMsg_DidRunContentWithCertificateErrors(routing_id_, url)); | |
4229 } | 4180 } |
4230 | 4181 |
4231 void RenderFrameImpl::didChangePerformanceTiming() { | 4182 void RenderFrameImpl::didChangePerformanceTiming() { |
4232 FOR_EACH_OBSERVER(RenderFrameObserver, | 4183 FOR_EACH_OBSERVER(RenderFrameObserver, |
4233 observers_, | 4184 observers_, |
4234 DidChangePerformanceTiming()); | 4185 DidChangePerformanceTiming()); |
4235 } | 4186 } |
4236 | 4187 |
4237 void RenderFrameImpl::didObserveLoadingBehavior( | 4188 void RenderFrameImpl::didObserveLoadingBehavior( |
4238 blink::WebLoadingBehaviorFlag behavior) { | 4189 blink::WebLoadingBehaviorFlag behavior) { |
(...skipping 2127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6366 // event target. Potentially a Pepper plugin will receive the event. | 6317 // event target. Potentially a Pepper plugin will receive the event. |
6367 // In order to tell whether a plugin gets the last mouse event and which it | 6318 // In order to tell whether a plugin gets the last mouse event and which it |
6368 // is, we set |pepper_last_mouse_event_target_| to null here. If a plugin gets | 6319 // is, we set |pepper_last_mouse_event_target_| to null here. If a plugin gets |
6369 // the event, it will notify us via DidReceiveMouseEvent() and set itself as | 6320 // the event, it will notify us via DidReceiveMouseEvent() and set itself as |
6370 // |pepper_last_mouse_event_target_|. | 6321 // |pepper_last_mouse_event_target_|. |
6371 pepper_last_mouse_event_target_ = nullptr; | 6322 pepper_last_mouse_event_target_ = nullptr; |
6372 #endif | 6323 #endif |
6373 } | 6324 } |
6374 | 6325 |
6375 } // namespace content | 6326 } // namespace content |
OLD | NEW |