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

Unified Diff: third_party/WebKit/Source/core/loader/MixedContentChecker.cpp

Issue 1415923015: Downgrade lock icon for broken-HTTPS subresources (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: missing #incldue Created 5 years, 1 month 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/loader/MixedContentChecker.cpp
diff --git a/third_party/WebKit/Source/core/loader/MixedContentChecker.cpp b/third_party/WebKit/Source/core/loader/MixedContentChecker.cpp
index fdcc09b14a13bba18e331b1fa85bb1848942e2f5..00d31fecf7cadc8fae04c11982fcd5c72f9ae3a4 100644
--- a/third_party/WebKit/Source/core/loader/MixedContentChecker.cpp
+++ b/third_party/WebKit/Source/core/loader/MixedContentChecker.cpp
@@ -458,6 +458,37 @@ LocalFrame* MixedContentChecker::effectiveFrameForFrameType(LocalFrame* frame, W
return effectiveFrame;
}
+void MixedContentChecker::handleCertificateError(LocalFrame* frame, const ResourceRequest& request, const ResourceResponse& response)
+{
+ WebURLRequest::FrameType frameType = request.frameType();
+ LocalFrame* effectiveFrame = effectiveFrameForFrameType(frame, frameType);
+ if (frameType == WebURLRequest::FrameTypeTopLevel || !effectiveFrame)
+ return;
+
+ FrameLoaderClient* client = effectiveFrame->loader().client();
+ WebURLRequest::RequestContext requestContext = request.requestContext();
+ ContextType contextType = MixedContentChecker::contextTypeFromContext(requestContext, frame);
+ logToConsoleAboutCertificateError(effectiveFrame, response.url(), requestContext);
+ if (contextType == ContextTypeBlockable) {
+ client->didRunContentWithCertificateErrors(response.url(), response.getSecurityInfo(), effectiveFrame->document()->url(), effectiveFrame->loader().documentLoader()->response().getSecurityInfo());
+ } else {
+ // contextTypeFromContext() never returns NotMixedContent (it
+ // computes the type of mixed content, given that the content is
+ // mixed).
+ ASSERT(contextType != ContextTypeNotMixedContent);
+ client->didDisplayContentWithCertificateErrors(response.url(), response.getSecurityInfo(), effectiveFrame->document()->url(), effectiveFrame->loader().documentLoader()->response().getSecurityInfo());
+ }
+}
+
+// static
+void MixedContentChecker::logToConsoleAboutCertificateError(LocalFrame* frame, const KURL& url, WebURLRequest::RequestContext requestContext)
+{
+ String message = String::format(
+ "Invalid certificate: The page at '%s' loaded a %s with certificate errors from '%s'.",
+ frame->document()->url().elidedString().utf8().data(), typeNameFromContext(requestContext), url.elidedString().utf8().data());
+ frame->document()->addConsoleMessage(ConsoleMessage::create(SecurityMessageSource, WarningMessageLevel, message));
+}
+
MixedContentChecker::ContextType MixedContentChecker::contextTypeForInspector(LocalFrame* frame, const ResourceRequest& request)
{
LocalFrame* effectiveFrame = effectiveFrameForFrameType(frame, request.frameType());

Powered by Google App Engine
This is Rietveld 408576698