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

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

Issue 2214293003: Revert of Remove usage of SSLStatus in RenderFrameImpl. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 4 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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
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"
64 #include "content/common/swapped_out_messages.h" 65 #include "content/common/swapped_out_messages.h"
65 #include "content/common/view_messages.h" 66 #include "content/common/view_messages.h"
66 #include "content/public/common/bindings_policy.h" 67 #include "content/public/common/bindings_policy.h"
67 #include "content/public/common/browser_side_navigation_policy.h" 68 #include "content/public/common/browser_side_navigation_policy.h"
68 #include "content/public/common/content_constants.h" 69 #include "content/public/common/content_constants.h"
69 #include "content/public/common/content_features.h" 70 #include "content/public/common/content_features.h"
70 #include "content/public/common/content_switches.h" 71 #include "content/public/common/content_switches.h"
71 #include "content/public/common/context_menu_params.h" 72 #include "content/public/common/context_menu_params.h"
72 #include "content/public/common/file_chooser_file_info.h" 73 #include "content/public/common/file_chooser_file_info.h"
73 #include "content/public/common/file_chooser_params.h" 74 #include "content/public/common/file_chooser_params.h"
(...skipping 702 matching lines...) Expand 10 before | Expand all | Expand 10 after
776 777
777 bool useBinaryEncoding() override { return params_.mhtml_binary_encoding; } 778 bool useBinaryEncoding() override { return params_.mhtml_binary_encoding; }
778 779
779 private: 780 private:
780 const FrameMsg_SerializeAsMHTML_Params& params_; 781 const FrameMsg_SerializeAsMHTML_Params& params_;
781 std::set<std::string>* digests_of_uris_of_serialized_resources_; 782 std::set<std::string>* digests_of_uris_of_serialized_resources_;
782 783
783 DISALLOW_COPY_AND_ASSIGN(MHTMLPartsGenerationDelegate); 784 DISALLOW_COPY_AND_ASSIGN(MHTMLPartsGenerationDelegate);
784 }; 785 };
785 786
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
786 bool IsHttpPost(const blink::WebURLRequest& request) { 832 bool IsHttpPost(const blink::WebURLRequest& request) {
787 return request.httpMethod().utf8() == "POST"; 833 return request.httpMethod().utf8() == "POST";
788 } 834 }
789 835
790 #if defined(OS_ANDROID) 836 #if defined(OS_ANDROID)
791 // Returns true if WMPI should be used for playback, false otherwise. 837 // Returns true if WMPI should be used for playback, false otherwise.
792 // 838 //
793 // Note that HLS and MP4 detection are pre-redirect and path-based. It is 839 // Note that HLS and MP4 detection are pre-redirect and path-based. It is
794 // possible to load such a URL and find different content. 840 // possible to load such a URL and find different content.
795 bool UseWebMediaPlayerImpl(const GURL& url) { 841 bool UseWebMediaPlayerImpl(const GURL& url) {
(...skipping 3368 matching lines...) Expand 10 before | Expand all | Expand 10 after
4164 Send(new FrameHostMsg_DidRunInsecureContent( 4210 Send(new FrameHostMsg_DidRunInsecureContent(
4165 routing_id_, GURL(origin.toString().utf8()), target)); 4211 routing_id_, GURL(origin.toString().utf8()), target));
4166 GetContentClient()->renderer()->RecordRapporURL( 4212 GetContentClient()->renderer()->RecordRapporURL(
4167 "ContentSettings.MixedScript.RanMixedScript", 4213 "ContentSettings.MixedScript.RanMixedScript",
4168 GURL(origin.toString().utf8())); 4214 GURL(origin.toString().utf8()));
4169 } 4215 }
4170 4216
4171 void RenderFrameImpl::didDisplayContentWithCertificateErrors( 4217 void RenderFrameImpl::didDisplayContentWithCertificateErrors(
4172 const blink::WebURL& url, 4218 const blink::WebURL& url,
4173 const blink::WebCString& security_info) { 4219 const blink::WebCString& security_info) {
4174 Send(new FrameHostMsg_DidDisplayContentWithCertificateErrors( 4220 if (IsContentWithCertificateErrorsRelevantToUI(frame_, url, security_info)) {
4175 routing_id_, url)); 4221 Send(new FrameHostMsg_DidDisplayContentWithCertificateErrors(
4222 routing_id_, url));
4223 }
4176 } 4224 }
4177 4225
4178 void RenderFrameImpl::didRunContentWithCertificateErrors( 4226 void RenderFrameImpl::didRunContentWithCertificateErrors(
4179 const blink::WebURL& url, 4227 const blink::WebURL& url,
4180 const blink::WebCString& security_info) { 4228 const blink::WebCString& security_info) {
4181 Send(new FrameHostMsg_DidRunContentWithCertificateErrors(routing_id_, url)); 4229 if (IsContentWithCertificateErrorsRelevantToUI(frame_, url, security_info))
4230 Send(new FrameHostMsg_DidRunContentWithCertificateErrors(routing_id_, url));
4182 } 4231 }
4183 4232
4184 void RenderFrameImpl::didChangePerformanceTiming() { 4233 void RenderFrameImpl::didChangePerformanceTiming() {
4185 FOR_EACH_OBSERVER(RenderFrameObserver, 4234 FOR_EACH_OBSERVER(RenderFrameObserver,
4186 observers_, 4235 observers_,
4187 DidChangePerformanceTiming()); 4236 DidChangePerformanceTiming());
4188 } 4237 }
4189 4238
4190 void RenderFrameImpl::didObserveLoadingBehavior( 4239 void RenderFrameImpl::didObserveLoadingBehavior(
4191 blink::WebLoadingBehaviorFlag behavior) { 4240 blink::WebLoadingBehaviorFlag behavior) {
(...skipping 2104 matching lines...) Expand 10 before | Expand all | Expand 10 after
6296 // event target. Potentially a Pepper plugin will receive the event. 6345 // event target. Potentially a Pepper plugin will receive the event.
6297 // In order to tell whether a plugin gets the last mouse event and which it 6346 // In order to tell whether a plugin gets the last mouse event and which it
6298 // is, we set |pepper_last_mouse_event_target_| to null here. If a plugin gets 6347 // is, we set |pepper_last_mouse_event_target_| to null here. If a plugin gets
6299 // the event, it will notify us via DidReceiveMouseEvent() and set itself as 6348 // the event, it will notify us via DidReceiveMouseEvent() and set itself as
6300 // |pepper_last_mouse_event_target_|. 6349 // |pepper_last_mouse_event_target_|.
6301 pepper_last_mouse_event_target_ = nullptr; 6350 pepper_last_mouse_event_target_ = nullptr;
6302 #endif 6351 #endif
6303 } 6352 }
6304 6353
6305 } // namespace content 6354 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698