| 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 30 matching lines...) Expand all Loading... |
| 41 | 41 |
| 42 class FrameLoaderClient; | 42 class FrameLoaderClient; |
| 43 class LocalFrame; | 43 class LocalFrame; |
| 44 class KURL; | 44 class KURL; |
| 45 class SecurityOrigin; | 45 class SecurityOrigin; |
| 46 | 46 |
| 47 class CORE_EXPORT MixedContentChecker final { | 47 class CORE_EXPORT MixedContentChecker final { |
| 48 WTF_MAKE_NONCOPYABLE(MixedContentChecker); | 48 WTF_MAKE_NONCOPYABLE(MixedContentChecker); |
| 49 DISALLOW_ALLOCATION(); | 49 DISALLOW_ALLOCATION(); |
| 50 public: | 50 public: |
| 51 enum ContextType { |
| 52 ContextTypeNotMixedContent, |
| 53 ContextTypeBlockable, |
| 54 ContextTypeOptionallyBlockable, |
| 55 ContextTypeShouldBeBlockable, |
| 56 }; |
| 57 |
| 51 enum ReportingStatus { SendReport, SuppressReport }; | 58 enum ReportingStatus { SendReport, SuppressReport }; |
| 52 static bool shouldBlockFetch(LocalFrame*, WebURLRequest::RequestContext, Web
URLRequest::FrameType, const KURL&, ReportingStatus = SendReport); | 59 static bool shouldBlockFetch(LocalFrame*, WebURLRequest::RequestContext, Web
URLRequest::FrameType, const KURL&, ReportingStatus = SendReport); |
| 53 static bool shouldBlockFetch(LocalFrame* frame, const ResourceRequest& reque
st, const KURL& url, ReportingStatus status = SendReport) | 60 static bool shouldBlockFetch(LocalFrame* frame, const ResourceRequest& reque
st, const KURL& url, ReportingStatus status = SendReport) |
| 54 { | 61 { |
| 55 return shouldBlockFetch(frame, request.requestContext(), request.frameTy
pe(), url, status); | 62 return shouldBlockFetch(frame, request.requestContext(), request.frameTy
pe(), url, status); |
| 56 } | 63 } |
| 57 | 64 |
| 58 static bool shouldBlockWebSocket(LocalFrame*, const KURL&, ReportingStatus =
SendReport); | 65 static bool shouldBlockWebSocket(LocalFrame*, const KURL&, ReportingStatus =
SendReport); |
| 59 | 66 |
| 60 static bool isMixedContent(SecurityOrigin*, const KURL&); | 67 static bool isMixedContent(SecurityOrigin*, const KURL&); |
| 61 static bool isMixedFormAction(LocalFrame*, const KURL&, ReportingStatus = Se
ndReport); | 68 static bool isMixedFormAction(LocalFrame*, const KURL&, ReportingStatus = Se
ndReport); |
| 62 | 69 |
| 63 static void checkMixedPrivatePublic(LocalFrame*, const AtomicString& resourc
eIPAddress); | 70 static void checkMixedPrivatePublic(LocalFrame*, const AtomicString& resourc
eIPAddress); |
| 64 | 71 |
| 72 static ContextType contextTypeForInspector(LocalFrame*, const ResourceReques
t&); |
| 73 |
| 74 // Returns the frame that should be considered the effective frame |
| 75 // for a mixed content check for the given frame type. |
| 76 static LocalFrame* effectiveFrameForFrameType(LocalFrame*, WebURLRequest::Fr
ameType); |
| 77 |
| 65 private: | 78 private: |
| 66 enum MixedContentType { | 79 enum MixedContentType { |
| 67 Display, | 80 Display, |
| 68 Execution, | 81 Execution, |
| 69 WebSocket, | 82 WebSocket, |
| 70 Submission | 83 Submission |
| 71 }; | 84 }; |
| 72 | 85 |
| 73 enum ContextType { | |
| 74 ContextTypeBlockable, | |
| 75 ContextTypeOptionallyBlockable, | |
| 76 ContextTypeShouldBeBlockable, | |
| 77 }; | |
| 78 | |
| 79 static LocalFrame* inWhichFrameIsContentMixed(LocalFrame*, WebURLRequest::Fr
ameType, const KURL&); | 86 static LocalFrame* inWhichFrameIsContentMixed(LocalFrame*, WebURLRequest::Fr
ameType, const KURL&); |
| 80 | 87 |
| 81 static ContextType contextTypeFromContext(WebURLRequest::RequestContext, Loc
alFrame*); | 88 static ContextType contextTypeFromContext(WebURLRequest::RequestContext, Loc
alFrame*); |
| 82 static const char* typeNameFromContext(WebURLRequest::RequestContext); | 89 static const char* typeNameFromContext(WebURLRequest::RequestContext); |
| 83 static void logToConsoleAboutFetch(LocalFrame*, const KURL&, WebURLRequest::
RequestContext, bool allowed); | 90 static void logToConsoleAboutFetch(LocalFrame*, const KURL&, WebURLRequest::
RequestContext, bool allowed); |
| 84 static void logToConsoleAboutWebSocket(LocalFrame*, const KURL&, bool allowe
d); | 91 static void logToConsoleAboutWebSocket(LocalFrame*, const KURL&, bool allowe
d); |
| 85 static void count(LocalFrame*, WebURLRequest::RequestContext); | 92 static void count(LocalFrame*, WebURLRequest::RequestContext); |
| 86 }; | 93 }; |
| 87 | 94 |
| 88 } // namespace blink | 95 } // namespace blink |
| 89 | 96 |
| 90 #endif // MixedContentChecker_h | 97 #endif // MixedContentChecker_h |
| OLD | NEW |