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

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

Issue 1506203004: Reland of Downgrade lock icon for broken-HTTPS subresources (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix conflict Created 5 years 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 9
10 #include "base/auto_reset.h" 10 #include "base/auto_reset.h"
(...skipping 30 matching lines...) Expand all
41 #include "content/common/clipboard_messages.h" 41 #include "content/common/clipboard_messages.h"
42 #include "content/common/frame_messages.h" 42 #include "content/common/frame_messages.h"
43 #include "content/common/frame_replication_state.h" 43 #include "content/common/frame_replication_state.h"
44 #include "content/common/input_messages.h" 44 #include "content/common/input_messages.h"
45 #include "content/common/mojo/service_registry_for_route.h" 45 #include "content/common/mojo/service_registry_for_route.h"
46 #include "content/common/mojo/service_registry_impl.h" 46 #include "content/common/mojo/service_registry_impl.h"
47 #include "content/common/navigation_params.h" 47 #include "content/common/navigation_params.h"
48 #include "content/common/savable_subframe.h" 48 #include "content/common/savable_subframe.h"
49 #include "content/common/service_worker/service_worker_types.h" 49 #include "content/common/service_worker/service_worker_types.h"
50 #include "content/common/site_isolation_policy.h" 50 #include "content/common/site_isolation_policy.h"
51 #include "content/common/ssl_status_serialization.h"
51 #include "content/common/swapped_out_messages.h" 52 #include "content/common/swapped_out_messages.h"
52 #include "content/common/view_messages.h" 53 #include "content/common/view_messages.h"
53 #include "content/public/common/bindings_policy.h" 54 #include "content/public/common/bindings_policy.h"
54 #include "content/public/common/content_constants.h" 55 #include "content/public/common/content_constants.h"
55 #include "content/public/common/content_switches.h" 56 #include "content/public/common/content_switches.h"
56 #include "content/public/common/context_menu_params.h" 57 #include "content/public/common/context_menu_params.h"
57 #include "content/public/common/isolated_world_ids.h" 58 #include "content/public/common/isolated_world_ids.h"
58 #include "content/public/common/page_state.h" 59 #include "content/public/common/page_state.h"
59 #include "content/public/common/resource_response.h" 60 #include "content/public/common/resource_response.h"
60 #include "content/public/common/service_registry.h" 61 #include "content/public/common/service_registry.h"
(...skipping 507 matching lines...) Expand 10 before | Expand all | Expand 10 after
568 569
569 void OnGotContentHandlerID(uint32_t content_handler_id) {} 570 void OnGotContentHandlerID(uint32_t content_handler_id) {}
570 571
571 WebString ConvertRelativePathToHtmlAttribute(const base::FilePath& path) { 572 WebString ConvertRelativePathToHtmlAttribute(const base::FilePath& path) {
572 DCHECK(!path.IsAbsolute()); 573 DCHECK(!path.IsAbsolute());
573 return WebString::fromUTF8( 574 return WebString::fromUTF8(
574 std::string("./") + 575 std::string("./") +
575 path.NormalizePathSeparatorsTo(FILE_PATH_LITERAL('/')).AsUTF8Unsafe()); 576 path.NormalizePathSeparatorsTo(FILE_PATH_LITERAL('/')).AsUTF8Unsafe());
576 } 577 }
577 578
579 bool IsContentWithCertificateErrorsRelevantToUI(
580 const blink::WebURL& url,
581 const blink::WebCString& security_info,
582 const blink::WebURL& main_resource_url,
583 const blink::WebCString& main_resource_security_info) {
584 content::SSLStatus ssl_status;
585 content::SSLStatus main_resource_ssl_status;
586 CHECK(DeserializeSecurityInfo(security_info, &ssl_status));
587 CHECK(DeserializeSecurityInfo(main_resource_security_info,
588 &main_resource_ssl_status));
589
590 if (!GURL(main_resource_url).SchemeIsCryptographic())
591 return false;
592
593 // Do not handle subresource certificate errors if they are the same
594 // as errors that occured during the main page load. This compares
595 // most, but not all, fields of SSLStatus. For example, this check
596 // does not compare |content_status| because the navigation entry
597 // might have mixed content but also have the exact same SSL
598 // connection properties as the subresource, thereby making the
599 // subresource errors duplicative.
600 return (!url::Origin(GURL(url))
601 .IsSameOriginWith(url::Origin(GURL(main_resource_url))) ||
602 main_resource_ssl_status.security_style !=
603 ssl_status.security_style ||
604 main_resource_ssl_status.cert_id != ssl_status.cert_id ||
605 main_resource_ssl_status.cert_status != ssl_status.cert_status ||
606 main_resource_ssl_status.security_bits != ssl_status.security_bits ||
607 main_resource_ssl_status.connection_status !=
608 ssl_status.connection_status);
609 }
610
578 } // namespace 611 } // namespace
579 612
580 // static 613 // static
581 RenderFrameImpl* RenderFrameImpl::Create(RenderViewImpl* render_view, 614 RenderFrameImpl* RenderFrameImpl::Create(RenderViewImpl* render_view,
582 int32 routing_id) { 615 int32 routing_id) {
583 DCHECK(routing_id != MSG_ROUTING_NONE); 616 DCHECK(routing_id != MSG_ROUTING_NONE);
584 CreateParams params(render_view, routing_id); 617 CreateParams params(render_view, routing_id);
585 618
586 if (g_create_render_frame_impl) 619 if (g_create_render_frame_impl)
587 return g_create_render_frame_impl(params); 620 return g_create_render_frame_impl(params);
(...skipping 3091 matching lines...) Expand 10 before | Expand all | Expand 10 after
3679 } 3712 }
3680 3713
3681 void RenderFrameImpl::didDisplayInsecureContent() { 3714 void RenderFrameImpl::didDisplayInsecureContent() {
3682 Send(new FrameHostMsg_DidDisplayInsecureContent(routing_id_)); 3715 Send(new FrameHostMsg_DidDisplayInsecureContent(routing_id_));
3683 } 3716 }
3684 3717
3685 void RenderFrameImpl::didRunInsecureContent( 3718 void RenderFrameImpl::didRunInsecureContent(
3686 const blink::WebSecurityOrigin& origin, 3719 const blink::WebSecurityOrigin& origin,
3687 const blink::WebURL& target) { 3720 const blink::WebURL& target) {
3688 Send(new FrameHostMsg_DidRunInsecureContent( 3721 Send(new FrameHostMsg_DidRunInsecureContent(
3689 routing_id_, origin.toString().utf8(), target)); 3722 routing_id_, GURL(origin.toString().utf8()), target));
3690 GetContentClient()->renderer()->RecordRapporURL( 3723 GetContentClient()->renderer()->RecordRapporURL(
3691 "ContentSettings.MixedScript.RanMixedScript", 3724 "ContentSettings.MixedScript.RanMixedScript",
3692 GURL(origin.toString().utf8())); 3725 GURL(origin.toString().utf8()));
3693 } 3726 }
3694 3727
3728 void RenderFrameImpl::didDisplayContentWithCertificateErrors(
3729 const blink::WebURL& url,
3730 const blink::WebCString& security_info,
3731 const blink::WebURL& main_resource_url,
3732 const blink::WebCString& main_resource_security_info) {
3733 if (!IsContentWithCertificateErrorsRelevantToUI(
3734 url, security_info, main_resource_url, main_resource_security_info)) {
3735 return;
3736 }
3737 Send(new FrameHostMsg_DidDisplayContentWithCertificateErrors(routing_id_, url,
3738 security_info));
3739 }
3740
3741 void RenderFrameImpl::didRunContentWithCertificateErrors(
3742 const blink::WebURL& url,
3743 const blink::WebCString& security_info,
3744 const blink::WebURL& main_resource_url,
3745 const blink::WebCString& main_resource_security_info) {
3746 if (!IsContentWithCertificateErrorsRelevantToUI(
3747 url, security_info, main_resource_url, main_resource_security_info)) {
3748 return;
3749 }
3750 Send(new FrameHostMsg_DidRunContentWithCertificateErrors(
3751 routing_id_, GURL(main_resource_url).GetOrigin(), url, security_info));
3752 }
3753
3695 void RenderFrameImpl::didChangePerformanceTiming() { 3754 void RenderFrameImpl::didChangePerformanceTiming() {
3696 FOR_EACH_OBSERVER(RenderFrameObserver, 3755 FOR_EACH_OBSERVER(RenderFrameObserver,
3697 observers_, 3756 observers_,
3698 DidChangePerformanceTiming()); 3757 DidChangePerformanceTiming());
3699 } 3758 }
3700 3759
3701 void RenderFrameImpl::didCreateScriptContext(blink::WebLocalFrame* frame, 3760 void RenderFrameImpl::didCreateScriptContext(blink::WebLocalFrame* frame,
3702 v8::Local<v8::Context> context, 3761 v8::Local<v8::Context> context,
3703 int extension_group, 3762 int extension_group,
3704 int world_id) { 3763 int world_id) {
(...skipping 1758 matching lines...) Expand 10 before | Expand all | Expand 10 after
5463 media::ConvertToSwitchOutputDeviceCB(web_callbacks); 5522 media::ConvertToSwitchOutputDeviceCB(web_callbacks);
5464 scoped_refptr<media::AudioOutputDevice> device = 5523 scoped_refptr<media::AudioOutputDevice> device =
5465 AudioDeviceFactory::NewOutputDevice(routing_id_, 0, sink_id.utf8(), 5524 AudioDeviceFactory::NewOutputDevice(routing_id_, 0, sink_id.utf8(),
5466 security_origin); 5525 security_origin);
5467 media::OutputDeviceStatus status = device->GetDeviceStatus(); 5526 media::OutputDeviceStatus status = device->GetDeviceStatus();
5468 device->Stop(); 5527 device->Stop();
5469 callback.Run(status); 5528 callback.Run(status);
5470 } 5529 }
5471 5530
5472 } // namespace content 5531 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/render_frame_impl.h ('k') | third_party/WebKit/Source/core/loader/EmptyClients.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698