| 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 are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * 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 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 29 */ | 29 */ |
| 30 | 30 |
| 31 #ifndef MixedContentChecker_h | 31 #ifndef MixedContentChecker_h |
| 32 #define MixedContentChecker_h | 32 #define MixedContentChecker_h |
| 33 | 33 |
| 34 #include "base/gtest_prod_util.h" | |
| 35 #include "core/CoreExport.h" | 34 #include "core/CoreExport.h" |
| 36 #include "platform/heap/Handle.h" | 35 #include "platform/heap/Handle.h" |
| 37 #include "platform/network/ResourceRequest.h" | 36 #include "platform/network/ResourceRequest.h" |
| 38 #include "public/platform/WebURLRequest.h" | 37 #include "public/platform/WebURLRequest.h" |
| 39 #include "wtf/text/WTFString.h" | 38 #include "wtf/text/WTFString.h" |
| 40 | 39 |
| 41 namespace blink { | 40 namespace blink { |
| 42 | 41 |
| 43 class FrameLoaderClient; | 42 class FrameLoaderClient; |
| 44 class LocalFrame; | 43 class LocalFrame; |
| 45 class KURL; | 44 class KURL; |
| 46 class ResourceResponse; | |
| 47 class SecurityOrigin; | 45 class SecurityOrigin; |
| 48 | 46 |
| 49 class CORE_EXPORT MixedContentChecker final { | 47 class CORE_EXPORT MixedContentChecker final { |
| 50 WTF_MAKE_NONCOPYABLE(MixedContentChecker); | 48 WTF_MAKE_NONCOPYABLE(MixedContentChecker); |
| 51 DISALLOW_NEW(); | 49 DISALLOW_NEW(); |
| 52 public: | 50 public: |
| 53 enum ContextType { | 51 enum ContextType { |
| 54 ContextTypeNotMixedContent, | 52 ContextTypeNotMixedContent, |
| 55 ContextTypeBlockable, | 53 ContextTypeBlockable, |
| 56 ContextTypeOptionallyBlockable, | 54 ContextTypeOptionallyBlockable, |
| (...skipping 13 matching lines...) Expand all Loading... |
| 70 static bool isMixedFormAction(LocalFrame*, const KURL&, ReportingStatus = Se
ndReport); | 68 static bool isMixedFormAction(LocalFrame*, const KURL&, ReportingStatus = Se
ndReport); |
| 71 | 69 |
| 72 static void checkMixedPrivatePublic(LocalFrame*, const AtomicString& resourc
eIPAddress); | 70 static void checkMixedPrivatePublic(LocalFrame*, const AtomicString& resourc
eIPAddress); |
| 73 | 71 |
| 74 static ContextType contextTypeForInspector(LocalFrame*, const ResourceReques
t&); | 72 static ContextType contextTypeForInspector(LocalFrame*, const ResourceReques
t&); |
| 75 | 73 |
| 76 // Returns the frame that should be considered the effective frame | 74 // Returns the frame that should be considered the effective frame |
| 77 // for a mixed content check for the given frame type. | 75 // for a mixed content check for the given frame type. |
| 78 static LocalFrame* effectiveFrameForFrameType(LocalFrame*, WebURLRequest::Fr
ameType); | 76 static LocalFrame* effectiveFrameForFrameType(LocalFrame*, WebURLRequest::Fr
ameType); |
| 79 | 77 |
| 80 static void handleCertificateError(LocalFrame*, const ResourceRequest&, cons
t ResourceResponse&); | |
| 81 | |
| 82 private: | 78 private: |
| 83 FRIEND_TEST_ALL_PREFIXES(MixedContentCheckerTest, HandleCertificateError); | |
| 84 enum MixedContentType { | 79 enum MixedContentType { |
| 85 Display, | 80 Display, |
| 86 Execution, | 81 Execution, |
| 87 WebSocket, | 82 WebSocket, |
| 88 Submission | 83 Submission |
| 89 }; | 84 }; |
| 90 | 85 |
| 91 static LocalFrame* inWhichFrameIsContentMixed(LocalFrame*, WebURLRequest::Fr
ameType, const KURL&); | 86 static LocalFrame* inWhichFrameIsContentMixed(LocalFrame*, WebURLRequest::Fr
ameType, const KURL&); |
| 92 | 87 |
| 93 static ContextType contextTypeFromContext(WebURLRequest::RequestContext, Loc
alFrame*); | 88 static ContextType contextTypeFromContext(WebURLRequest::RequestContext, Loc
alFrame*); |
| 94 static const char* typeNameFromContext(WebURLRequest::RequestContext); | 89 static const char* typeNameFromContext(WebURLRequest::RequestContext); |
| 95 static void logToConsoleAboutFetch(LocalFrame*, const KURL&, WebURLRequest::
RequestContext, bool allowed); | 90 static void logToConsoleAboutFetch(LocalFrame*, const KURL&, WebURLRequest::
RequestContext, bool allowed); |
| 96 static void logToConsoleAboutWebSocket(LocalFrame*, const KURL&, bool allowe
d); | 91 static void logToConsoleAboutWebSocket(LocalFrame*, const KURL&, bool allowe
d); |
| 97 static void count(LocalFrame*, WebURLRequest::RequestContext); | 92 static void count(LocalFrame*, WebURLRequest::RequestContext); |
| 98 }; | 93 }; |
| 99 | 94 |
| 100 } // namespace blink | 95 } // namespace blink |
| 101 | 96 |
| 102 #endif // MixedContentChecker_h | 97 #endif // MixedContentChecker_h |
| OLD | NEW |