Index: content/browser/web_contents/web_contents_impl.cc |
diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc |
index b34f55c9edb9e37a8349a26317f054f8e799a196..6b0a66229712d7022e458440e3161600f7459578 100644 |
--- a/content/browser/web_contents/web_contents_impl.cc |
+++ b/content/browser/web_contents/web_contents_impl.cc |
@@ -180,6 +180,10 @@ const char kWebContentsAndroidKey[] = "web_contents_android"; |
base::LazyInstance<std::vector<WebContentsImpl::CreatedCallback> > |
g_created_callbacks = LAZY_INSTANCE_INITIALIZER; |
+bool HasInsecureContent(const net::CertStatus status) { |
+ return net::IsCertStatusError(status) && !net::IsCertStatusMinorError(status); |
+} |
+ |
static int StartDownload(RenderFrameHost* rfh, |
const GURL& url, |
bool is_favicon, |
@@ -2240,6 +2244,21 @@ void WebContentsImpl::DragSourceEndedAt(int client_x, int client_y, |
void WebContentsImpl::DidGetResourceResponseStart( |
const ResourceRequestDetails& details) { |
+ |
+ // If inline resource has invalid certificate, set the insecure content flag. |
+ // For all the intended notifications to be sent, we need to call |
+ // SSLManager::NotifySSLInternalStateChanged() after setting the flag. |
+ // In "standard" insecure content scenario (i.e. http resource in https |
+ // context) the flag is set and SSLManager gets notified in |
+ // OnDidDisplayInsecureContent() (Webkit notification handler). |
+ // When, however, the certificate for the inline is invalid, Webkit will not |
+ // tell us about it and we need to set the flag & notify SSLManager manually. |
+ // Note: the call to SSLManager::NotifySSLInternalStateChanged() will be done |
+ // from SSLManager::DidStartResourceResponse(). |
+ if (details.resource_type != RESOURCE_TYPE_FAVICON && |
+ HasInsecureContent(details.ssl_cert_status)) |
+ displayed_insecure_content_ = true; |
+ |
controller_.ssl_manager()->DidStartResourceResponse(details); |
FOR_EACH_OBSERVER(WebContentsObserver, observers_, |
@@ -2628,6 +2647,12 @@ void WebContentsImpl::OnDidLoadResourceFromMemoryCache( |
url, GetRenderProcessHost()->GetID(), cert_id, cert_status, http_method, |
mime_type, resource_type); |
+ // See WebContentsImpl::DidGetResourceResponseStart for an explanation of why |
+ // displayed_insecure_content_ is set here. |
+ if (details.resource_type != RESOURCE_TYPE_FAVICON && |
+ HasInsecureContent(cert_status)) |
+ displayed_insecure_content_ = true; |
+ |
controller_.ssl_manager()->DidLoadFromMemoryCache(details); |
FOR_EACH_OBSERVER(WebContentsObserver, observers_, |