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" |
34 #include "core/CoreExport.h" | 35 #include "core/CoreExport.h" |
35 #include "platform/heap/Handle.h" | 36 #include "platform/heap/Handle.h" |
36 #include "platform/network/ResourceRequest.h" | 37 #include "platform/network/ResourceRequest.h" |
37 #include "public/platform/WebURLRequest.h" | 38 #include "public/platform/WebURLRequest.h" |
38 #include "wtf/text/WTFString.h" | 39 #include "wtf/text/WTFString.h" |
39 | 40 |
40 namespace blink { | 41 namespace blink { |
41 | 42 |
42 class FrameLoaderClient; | 43 class FrameLoaderClient; |
43 class LocalFrame; | 44 class LocalFrame; |
44 class KURL; | 45 class KURL; |
| 46 class ResourceResponse; |
45 class SecurityOrigin; | 47 class SecurityOrigin; |
46 | 48 |
47 class CORE_EXPORT MixedContentChecker final { | 49 class CORE_EXPORT MixedContentChecker final { |
48 WTF_MAKE_NONCOPYABLE(MixedContentChecker); | 50 WTF_MAKE_NONCOPYABLE(MixedContentChecker); |
49 DISALLOW_NEW(); | 51 DISALLOW_NEW(); |
50 public: | 52 public: |
51 enum ContextType { | 53 enum ContextType { |
52 ContextTypeNotMixedContent, | 54 ContextTypeNotMixedContent, |
53 ContextTypeBlockable, | 55 ContextTypeBlockable, |
54 ContextTypeOptionallyBlockable, | 56 ContextTypeOptionallyBlockable, |
(...skipping 13 matching lines...) Expand all Loading... |
68 static bool isMixedFormAction(LocalFrame*, const KURL&, ReportingStatus = Se
ndReport); | 70 static bool isMixedFormAction(LocalFrame*, const KURL&, ReportingStatus = Se
ndReport); |
69 | 71 |
70 static void checkMixedPrivatePublic(LocalFrame*, const AtomicString& resourc
eIPAddress); | 72 static void checkMixedPrivatePublic(LocalFrame*, const AtomicString& resourc
eIPAddress); |
71 | 73 |
72 static ContextType contextTypeForInspector(LocalFrame*, const ResourceReques
t&); | 74 static ContextType contextTypeForInspector(LocalFrame*, const ResourceReques
t&); |
73 | 75 |
74 // Returns the frame that should be considered the effective frame | 76 // Returns the frame that should be considered the effective frame |
75 // for a mixed content check for the given frame type. | 77 // for a mixed content check for the given frame type. |
76 static LocalFrame* effectiveFrameForFrameType(LocalFrame*, WebURLRequest::Fr
ameType); | 78 static LocalFrame* effectiveFrameForFrameType(LocalFrame*, WebURLRequest::Fr
ameType); |
77 | 79 |
| 80 static void handleCertificateError(LocalFrame*, const ResourceRequest&, cons
t ResourceResponse&); |
| 81 |
78 private: | 82 private: |
| 83 FRIEND_TEST_ALL_PREFIXES(MixedContentCheckerTest, HandleCertificateError); |
79 enum MixedContentType { | 84 enum MixedContentType { |
80 Display, | 85 Display, |
81 Execution, | 86 Execution, |
82 WebSocket, | 87 WebSocket, |
83 Submission | 88 Submission |
84 }; | 89 }; |
85 | 90 |
86 static LocalFrame* inWhichFrameIsContentMixed(LocalFrame*, WebURLRequest::Fr
ameType, const KURL&); | 91 static LocalFrame* inWhichFrameIsContentMixed(LocalFrame*, WebURLRequest::Fr
ameType, const KURL&); |
87 | 92 |
88 static ContextType contextTypeFromContext(WebURLRequest::RequestContext, Loc
alFrame*); | 93 static ContextType contextTypeFromContext(WebURLRequest::RequestContext, Loc
alFrame*); |
89 static const char* typeNameFromContext(WebURLRequest::RequestContext); | 94 static const char* typeNameFromContext(WebURLRequest::RequestContext); |
90 static void logToConsoleAboutFetch(LocalFrame*, const KURL&, WebURLRequest::
RequestContext, bool allowed); | 95 static void logToConsoleAboutFetch(LocalFrame*, const KURL&, WebURLRequest::
RequestContext, bool allowed); |
91 static void logToConsoleAboutWebSocket(LocalFrame*, const KURL&, bool allowe
d); | 96 static void logToConsoleAboutWebSocket(LocalFrame*, const KURL&, bool allowe
d); |
92 static void count(LocalFrame*, WebURLRequest::RequestContext); | 97 static void count(LocalFrame*, WebURLRequest::RequestContext); |
93 }; | 98 }; |
94 | 99 |
95 } // namespace blink | 100 } // namespace blink |
96 | 101 |
97 #endif // MixedContentChecker_h | 102 #endif // MixedContentChecker_h |
OLD | NEW |