| OLD | NEW |
| 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 Loading... |
| 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 Resour
ceRequest& request, const ResourceResponse& response) |
| 462 { |
| 463 WebURLRequest::FrameType frameType = request.frameType(); |
| 464 LocalFrame* effectiveFrame = effectiveFrameForFrameType(frame, frameType); |
| 465 if (frameType == WebURLRequest::FrameTypeTopLevel || !effectiveFrame) |
| 466 return; |
| 467 |
| 468 FrameLoaderClient* client = effectiveFrame->loader().client(); |
| 469 WebURLRequest::RequestContext requestContext = request.requestContext(); |
| 470 ContextType contextType = MixedContentChecker::contextTypeFromContext(reques
tContext, frame); |
| 471 if (contextType == ContextTypeBlockable) { |
| 472 client->didRunContentWithCertificateErrors(response.url(), response.getS
ecurityInfo(), effectiveFrame->document()->url(), effectiveFrame->loader().docum
entLoader()->response().getSecurityInfo()); |
| 473 } else { |
| 474 // contextTypeFromContext() never returns NotMixedContent (it |
| 475 // computes the type of mixed content, given that the content is |
| 476 // mixed). |
| 477 ASSERT(contextType != ContextTypeNotMixedContent); |
| 478 client->didDisplayContentWithCertificateErrors(response.url(), response.
getSecurityInfo(), effectiveFrame->document()->url(), effectiveFrame->loader().d
ocumentLoader()->response().getSecurityInfo()); |
| 479 } |
| 480 } |
| 481 |
| 461 MixedContentChecker::ContextType MixedContentChecker::contextTypeForInspector(Lo
calFrame* frame, const ResourceRequest& request) | 482 MixedContentChecker::ContextType MixedContentChecker::contextTypeForInspector(Lo
calFrame* frame, const ResourceRequest& request) |
| 462 { | 483 { |
| 463 LocalFrame* effectiveFrame = effectiveFrameForFrameType(frame, request.frame
Type()); | 484 LocalFrame* effectiveFrame = effectiveFrameForFrameType(frame, request.frame
Type()); |
| 464 | 485 |
| 465 LocalFrame* mixedFrame = inWhichFrameIsContentMixed(effectiveFrame, request.
frameType(), request.url()); | 486 LocalFrame* mixedFrame = inWhichFrameIsContentMixed(effectiveFrame, request.
frameType(), request.url()); |
| 466 if (!mixedFrame) | 487 if (!mixedFrame) |
| 467 return ContextTypeNotMixedContent; | 488 return ContextTypeNotMixedContent; |
| 468 | 489 |
| 469 // See comment in shouldBlockFetch() about loading the main resource of a su
bframe. | 490 // See comment in shouldBlockFetch() about loading the main resource of a su
bframe. |
| 470 if (request.frameType() == WebURLRequest::FrameTypeNested && !SchemeRegistry
::shouldTreatURLSchemeAsCORSEnabled(request.url().protocol())) { | 491 if (request.frameType() == WebURLRequest::FrameTypeNested && !SchemeRegistry
::shouldTreatURLSchemeAsCORSEnabled(request.url().protocol())) { |
| 471 return ContextTypeOptionallyBlockable; | 492 return ContextTypeOptionallyBlockable; |
| 472 } | 493 } |
| 473 | 494 |
| 474 return contextTypeFromContext(request.requestContext(), mixedFrame); | 495 return contextTypeFromContext(request.requestContext(), mixedFrame); |
| 475 } | 496 } |
| 476 | 497 |
| 477 } // namespace blink | 498 } // namespace blink |
| OLD | NEW |