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

Side by Side 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: add MixedContentChecker unit test 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 /* 1 /*
2 * Copyright (C) 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2012 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 7 *
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 440 matching lines...) Expand 10 before | Expand all | Expand 10 after
451 if (frameType == WebURLRequest::FrameTypeNested) { 451 if (frameType == WebURLRequest::FrameTypeNested) {
452 // FIXME: Deal with RemoteFrames. 452 // FIXME: Deal with RemoteFrames.
453 Frame* parentFrame = effectiveFrame->tree().parent(); 453 Frame* parentFrame = effectiveFrame->tree().parent();
454 ASSERT(parentFrame); 454 ASSERT(parentFrame);
455 if (parentFrame->isLocalFrame()) 455 if (parentFrame->isLocalFrame())
456 effectiveFrame = toLocalFrame(parentFrame); 456 effectiveFrame = toLocalFrame(parentFrame);
457 } 457 }
458 return effectiveFrame; 458 return effectiveFrame;
459 } 459 }
460 460
461 void MixedContentChecker::handleCertificateError(LocalFrame* frame, const KURL& url, WebURLRequest::RequestContext requestContext, WebURLRequest::FrameType fram eType, const CString& securityInfo)
462 {
463 if (frameType == WebURLRequest::FrameTypeTopLevel || !frame)
464 return;
465
466 FrameLoaderClient* client = frame->loader().client();
467 ContextType contextType = MixedContentChecker::contextTypeFromContext(reques tContext, frame);
468 if (contextType == ContextTypeBlockable) {
469 client->didRunContentWithCertificateErrors(url, securityInfo, frame->doc ument()->url(), frame->loader().documentLoader()->response().getSecurityInfo());
470 } else {
471 // contextTypeFromContext() never returns NotMixedContent (it
472 // computes the type of mixed content, given that the content is
473 // mixed).
474 ASSERT(contextType != ContextTypeNotMixedContent);
475 client->didDisplayContentWithCertificateErrors(url, securityInfo, frame- >document()->url(), frame->loader().documentLoader()->response().getSecurityInfo ());
476 }
Mike West 2015/11/27 05:30:38 Should we output a console message noting the resp
estark 2015/11/28 02:46:56 Done. I think we should keep the console messages
estark 2015/11/30 18:13:27 Mike: Oops, this turned out to be more complicated
477 }
478
461 MixedContentChecker::ContextType MixedContentChecker::contextTypeForInspector(Lo calFrame* frame, const ResourceRequest& request) 479 MixedContentChecker::ContextType MixedContentChecker::contextTypeForInspector(Lo calFrame* frame, const ResourceRequest& request)
462 { 480 {
463 LocalFrame* effectiveFrame = effectiveFrameForFrameType(frame, request.frame Type()); 481 LocalFrame* effectiveFrame = effectiveFrameForFrameType(frame, request.frame Type());
464 482
465 LocalFrame* mixedFrame = inWhichFrameIsContentMixed(effectiveFrame, request. frameType(), request.url()); 483 LocalFrame* mixedFrame = inWhichFrameIsContentMixed(effectiveFrame, request. frameType(), request.url());
466 if (!mixedFrame) 484 if (!mixedFrame)
467 return ContextTypeNotMixedContent; 485 return ContextTypeNotMixedContent;
468 486
469 // See comment in shouldBlockFetch() about loading the main resource of a su bframe. 487 // See comment in shouldBlockFetch() about loading the main resource of a su bframe.
470 if (request.frameType() == WebURLRequest::FrameTypeNested && !SchemeRegistry ::shouldTreatURLSchemeAsCORSEnabled(request.url().protocol())) { 488 if (request.frameType() == WebURLRequest::FrameTypeNested && !SchemeRegistry ::shouldTreatURLSchemeAsCORSEnabled(request.url().protocol())) {
471 return ContextTypeOptionallyBlockable; 489 return ContextTypeOptionallyBlockable;
472 } 490 }
473 491
474 return contextTypeFromContext(request.requestContext(), mixedFrame); 492 return contextTypeFromContext(request.requestContext(), mixedFrame);
475 } 493 }
476 494
477 } // namespace blink 495 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698