| 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 14 matching lines...) Expand all Loading... |
| 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 "platform/heap/Handle.h" | 34 #include "platform/heap/Handle.h" |
| 35 #include "platform/network/ResourceRequest.h" |
| 35 #include "public/platform/WebURLRequest.h" | 36 #include "public/platform/WebURLRequest.h" |
| 36 #include "wtf/text/WTFString.h" | 37 #include "wtf/text/WTFString.h" |
| 37 | 38 |
| 38 namespace blink { | 39 namespace blink { |
| 39 | 40 |
| 40 class FrameLoaderClient; | 41 class FrameLoaderClient; |
| 41 class LocalFrame; | 42 class LocalFrame; |
| 42 class KURL; | 43 class KURL; |
| 43 class SecurityOrigin; | 44 class SecurityOrigin; |
| 44 | 45 |
| 45 class MixedContentChecker FINAL { | 46 class MixedContentChecker FINAL { |
| 46 WTF_MAKE_NONCOPYABLE(MixedContentChecker); | 47 WTF_MAKE_NONCOPYABLE(MixedContentChecker); |
| 47 DISALLOW_ALLOCATION(); | 48 DISALLOW_ALLOCATION(); |
| 48 public: | 49 public: |
| 49 explicit MixedContentChecker(LocalFrame*); | 50 explicit MixedContentChecker(LocalFrame*); |
| 50 | 51 |
| 51 static bool shouldBlockFetch(LocalFrame*, const ResourceRequest&, const KURL
&); | 52 static bool shouldBlockFetch(LocalFrame* frame, const ResourceRequest& reque
st, const KURL& url) |
| 53 { |
| 54 return shouldBlockFetch(frame, request.requestContext(), request.frameTy
pe(), url); |
| 55 } |
| 56 static bool shouldBlockFetch(LocalFrame*, WebURLRequest::RequestContext, Web
URLRequest::FrameType, const KURL&); |
| 52 | 57 |
| 53 bool canDisplayInsecureContent(SecurityOrigin* securityOrigin, const KURL& u
rl) const | 58 bool canDisplayInsecureContent(SecurityOrigin* securityOrigin, const KURL& u
rl) const |
| 54 { | 59 { |
| 55 return canDisplayInsecureContentInternal(securityOrigin, url, MixedConte
ntChecker::Display); | 60 return canDisplayInsecureContentInternal(securityOrigin, url, MixedConte
ntChecker::Display); |
| 56 } | 61 } |
| 57 | 62 |
| 58 bool canRunInsecureContent(SecurityOrigin* securityOrigin, const KURL& url)
const | 63 bool canRunInsecureContent(SecurityOrigin* securityOrigin, const KURL& url)
const |
| 59 { | 64 { |
| 60 return canRunInsecureContentInternal(securityOrigin, url, MixedContentCh
ecker::Execution); | 65 return canRunInsecureContentInternal(securityOrigin, url, MixedContentCh
ecker::Execution); |
| 61 } | 66 } |
| (...skipping 15 matching lines...) Expand all Loading... |
| 77 Submission | 82 Submission |
| 78 }; | 83 }; |
| 79 | 84 |
| 80 enum ContextType { | 85 enum ContextType { |
| 81 ContextTypeBlockable, | 86 ContextTypeBlockable, |
| 82 ContextTypeOptionallyBlockable, | 87 ContextTypeOptionallyBlockable, |
| 83 ContextTypeShouldBeBlockable, | 88 ContextTypeShouldBeBlockable, |
| 84 ContextTypeBlockableUnlessLax | 89 ContextTypeBlockableUnlessLax |
| 85 }; | 90 }; |
| 86 | 91 |
| 92 static LocalFrame* inWhichFrameIsThisContentMixed(LocalFrame*, WebURLRequest
::RequestContext, WebURLRequest::FrameType, const KURL&); |
| 93 |
| 87 static ContextType contextTypeFromContext(WebURLRequest::RequestContext); | 94 static ContextType contextTypeFromContext(WebURLRequest::RequestContext); |
| 88 static const char* typeNameFromContext(WebURLRequest::RequestContext); | 95 static const char* typeNameFromContext(WebURLRequest::RequestContext); |
| 89 static void logToConsole(LocalFrame*, const KURL&, WebURLRequest::RequestCon
text, bool allowed); | 96 static void logToConsole(LocalFrame*, const KURL&, WebURLRequest::RequestCon
text, bool allowed); |
| 90 | 97 |
| 91 // FIXME: This should probably have a separate client from FrameLoader. | 98 // FIXME: This should probably have a separate client from FrameLoader. |
| 92 FrameLoaderClient* client() const; | 99 FrameLoaderClient* client() const; |
| 93 | 100 |
| 94 bool canDisplayInsecureContentInternal(SecurityOrigin*, const KURL&, const M
ixedContentType) const; | 101 bool canDisplayInsecureContentInternal(SecurityOrigin*, const KURL&, const M
ixedContentType) const; |
| 95 | 102 |
| 96 bool canRunInsecureContentInternal(SecurityOrigin*, const KURL&, const Mixed
ContentType) const; | 103 bool canRunInsecureContentInternal(SecurityOrigin*, const KURL&, const Mixed
ContentType) const; |
| 97 | 104 |
| 98 void logWarning(bool allowed, const KURL& i, const MixedContentType) const; | 105 void logWarning(bool allowed, const KURL& i, const MixedContentType) const; |
| 99 | 106 |
| 100 RawPtrWillBeMember<LocalFrame> m_frame; | 107 RawPtrWillBeMember<LocalFrame> m_frame; |
| 101 }; | 108 }; |
| 102 | 109 |
| 103 } // namespace blink | 110 } // namespace blink |
| 104 | 111 |
| 105 #endif // MixedContentChecker_h | 112 #endif // MixedContentChecker_h |
| OLD | NEW |