| 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 30 matching lines...) Expand all Loading... |
| 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" | |
| 52 #include "content/common/swapped_out_messages.h" | 51 #include "content/common/swapped_out_messages.h" |
| 53 #include "content/common/view_messages.h" | 52 #include "content/common/view_messages.h" |
| 54 #include "content/public/common/bindings_policy.h" | 53 #include "content/public/common/bindings_policy.h" |
| 55 #include "content/public/common/content_constants.h" | 54 #include "content/public/common/content_constants.h" |
| 56 #include "content/public/common/content_switches.h" | 55 #include "content/public/common/content_switches.h" |
| 57 #include "content/public/common/context_menu_params.h" | 56 #include "content/public/common/context_menu_params.h" |
| 58 #include "content/public/common/isolated_world_ids.h" | 57 #include "content/public/common/isolated_world_ids.h" |
| 59 #include "content/public/common/page_state.h" | 58 #include "content/public/common/page_state.h" |
| 60 #include "content/public/common/resource_response.h" | 59 #include "content/public/common/resource_response.h" |
| 61 #include "content/public/common/service_registry.h" | 60 #include "content/public/common/service_registry.h" |
| (...skipping 499 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 561 return navigation_type == FrameMsg_Navigate_Type::RELOAD || | 560 return navigation_type == FrameMsg_Navigate_Type::RELOAD || |
| 562 navigation_type == FrameMsg_Navigate_Type::RELOAD_IGNORING_CACHE || | 561 navigation_type == FrameMsg_Navigate_Type::RELOAD_IGNORING_CACHE || |
| 563 navigation_type == FrameMsg_Navigate_Type::RELOAD_ORIGINAL_REQUEST_URL; | 562 navigation_type == FrameMsg_Navigate_Type::RELOAD_ORIGINAL_REQUEST_URL; |
| 564 } | 563 } |
| 565 | 564 |
| 566 RenderFrameImpl::CreateRenderFrameImplFunction g_create_render_frame_impl = | 565 RenderFrameImpl::CreateRenderFrameImplFunction g_create_render_frame_impl = |
| 567 nullptr; | 566 nullptr; |
| 568 | 567 |
| 569 void OnGotContentHandlerID(uint32_t content_handler_id) {} | 568 void OnGotContentHandlerID(uint32_t content_handler_id) {} |
| 570 | 569 |
| 571 bool IsContentWithCertificateErrorsRelevantToUI( | |
| 572 const blink::WebURL& url, | |
| 573 const blink::WebCString& security_info, | |
| 574 const blink::WebURL& main_resource_url, | |
| 575 const blink::WebCString& main_resource_security_info) { | |
| 576 content::SSLStatus ssl_status; | |
| 577 content::SSLStatus main_resource_ssl_status; | |
| 578 CHECK(DeserializeSecurityInfo(security_info, &ssl_status)); | |
| 579 CHECK(DeserializeSecurityInfo(main_resource_security_info, | |
| 580 &main_resource_ssl_status)); | |
| 581 | |
| 582 if (!GURL(main_resource_url).SchemeIsCryptographic()) | |
| 583 return false; | |
| 584 | |
| 585 // Do not handle subresource certificate errors if they are the same | |
| 586 // as errors that occured during the main page load. This compares | |
| 587 // most, but not all, fields of SSLStatus. For example, this check | |
| 588 // does not compare |content_status| because the navigation entry | |
| 589 // might have mixed content but also have the exact same SSL | |
| 590 // connection properties as the subresource, thereby making the | |
| 591 // subresource errors duplicative. | |
| 592 return (!url::Origin(GURL(url)) | |
| 593 .IsSameOriginWith(url::Origin(GURL(main_resource_url))) || | |
| 594 main_resource_ssl_status.security_style != | |
| 595 ssl_status.security_style || | |
| 596 main_resource_ssl_status.cert_id != ssl_status.cert_id || | |
| 597 main_resource_ssl_status.cert_status != ssl_status.cert_status || | |
| 598 main_resource_ssl_status.security_bits != ssl_status.security_bits || | |
| 599 main_resource_ssl_status.connection_status != | |
| 600 ssl_status.connection_status); | |
| 601 } | |
| 602 | |
| 603 } // namespace | 570 } // namespace |
| 604 | 571 |
| 605 // static | 572 // static |
| 606 RenderFrameImpl* RenderFrameImpl::Create(RenderViewImpl* render_view, | 573 RenderFrameImpl* RenderFrameImpl::Create(RenderViewImpl* render_view, |
| 607 int32 routing_id) { | 574 int32 routing_id) { |
| 608 DCHECK(routing_id != MSG_ROUTING_NONE); | 575 DCHECK(routing_id != MSG_ROUTING_NONE); |
| 609 CreateParams params(render_view, routing_id); | 576 CreateParams params(render_view, routing_id); |
| 610 | 577 |
| 611 if (g_create_render_frame_impl) | 578 if (g_create_render_frame_impl) |
| 612 return g_create_render_frame_impl(params); | 579 return g_create_render_frame_impl(params); |
| (...skipping 3086 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3699 } | 3666 } |
| 3700 | 3667 |
| 3701 void RenderFrameImpl::didDisplayInsecureContent() { | 3668 void RenderFrameImpl::didDisplayInsecureContent() { |
| 3702 Send(new FrameHostMsg_DidDisplayInsecureContent(routing_id_)); | 3669 Send(new FrameHostMsg_DidDisplayInsecureContent(routing_id_)); |
| 3703 } | 3670 } |
| 3704 | 3671 |
| 3705 void RenderFrameImpl::didRunInsecureContent( | 3672 void RenderFrameImpl::didRunInsecureContent( |
| 3706 const blink::WebSecurityOrigin& origin, | 3673 const blink::WebSecurityOrigin& origin, |
| 3707 const blink::WebURL& target) { | 3674 const blink::WebURL& target) { |
| 3708 Send(new FrameHostMsg_DidRunInsecureContent( | 3675 Send(new FrameHostMsg_DidRunInsecureContent( |
| 3709 routing_id_, GURL(origin.toString().utf8()), target)); | 3676 routing_id_, origin.toString().utf8(), target)); |
| 3710 GetContentClient()->renderer()->RecordRapporURL( | 3677 GetContentClient()->renderer()->RecordRapporURL( |
| 3711 "ContentSettings.MixedScript.RanMixedScript", | 3678 "ContentSettings.MixedScript.RanMixedScript", |
| 3712 GURL(origin.toString().utf8())); | 3679 GURL(origin.toString().utf8())); |
| 3713 } | 3680 } |
| 3714 | 3681 |
| 3715 void RenderFrameImpl::didDisplayContentWithCertificateErrors( | |
| 3716 const blink::WebURL& url, | |
| 3717 const blink::WebCString& security_info, | |
| 3718 const blink::WebURL& main_resource_url, | |
| 3719 const blink::WebCString& main_resource_security_info) { | |
| 3720 if (!IsContentWithCertificateErrorsRelevantToUI( | |
| 3721 url, security_info, main_resource_url, main_resource_security_info)) { | |
| 3722 return; | |
| 3723 } | |
| 3724 Send(new FrameHostMsg_DidDisplayContentWithCertificateErrors(routing_id_, url, | |
| 3725 security_info)); | |
| 3726 } | |
| 3727 | |
| 3728 void RenderFrameImpl::didRunContentWithCertificateErrors( | |
| 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_DidRunContentWithCertificateErrors( | |
| 3738 routing_id_, GURL(main_resource_url).GetOrigin(), url, security_info)); | |
| 3739 } | |
| 3740 | |
| 3741 void RenderFrameImpl::didChangePerformanceTiming() { | 3682 void RenderFrameImpl::didChangePerformanceTiming() { |
| 3742 FOR_EACH_OBSERVER(RenderFrameObserver, | 3683 FOR_EACH_OBSERVER(RenderFrameObserver, |
| 3743 observers_, | 3684 observers_, |
| 3744 DidChangePerformanceTiming()); | 3685 DidChangePerformanceTiming()); |
| 3745 } | 3686 } |
| 3746 | 3687 |
| 3747 void RenderFrameImpl::didCreateScriptContext(blink::WebLocalFrame* frame, | 3688 void RenderFrameImpl::didCreateScriptContext(blink::WebLocalFrame* frame, |
| 3748 v8::Local<v8::Context> context, | 3689 v8::Local<v8::Context> context, |
| 3749 int extension_group, | 3690 int extension_group, |
| 3750 int world_id) { | 3691 int world_id) { |
| (...skipping 1752 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5503 media::ConvertToSwitchOutputDeviceCB(web_callbacks); | 5444 media::ConvertToSwitchOutputDeviceCB(web_callbacks); |
| 5504 scoped_refptr<media::AudioOutputDevice> device = | 5445 scoped_refptr<media::AudioOutputDevice> device = |
| 5505 AudioDeviceFactory::NewOutputDevice(routing_id_, 0, sink_id.utf8(), | 5446 AudioDeviceFactory::NewOutputDevice(routing_id_, 0, sink_id.utf8(), |
| 5506 security_origin); | 5447 security_origin); |
| 5507 media::OutputDeviceStatus status = device->GetDeviceStatus(); | 5448 media::OutputDeviceStatus status = device->GetDeviceStatus(); |
| 5508 device->Stop(); | 5449 device->Stop(); |
| 5509 callback.Run(status); | 5450 callback.Run(status); |
| 5510 } | 5451 } |
| 5511 | 5452 |
| 5512 } // namespace content | 5453 } // namespace content |
| OLD | NEW |