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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
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 ReportingStatus { SendReport, SuppressReport }; | 51 enum ReportingStatus { SendReport, SuppressReport }; |
52 static bool shouldBlockFetch(LocalFrame*, WebURLRequest::RequestContext, Web URLRequest::FrameType, const KURL&, ReportingStatus = SendReport); | 52 |
53 static bool shouldBlockFetch(LocalFrame* frame, const ResourceRequest& reque st, const KURL& url, ReportingStatus status = SendReport) | 53 // Checks if the given request should be blocked due to mixed |
54 // content restrictions. Returns true if it should be blocked and | |
55 // false if it should be allowed. Mutates |request| to set | |
56 // |request->mixedContentStatus()| indicating which type of mixed | |
57 // content it is. | |
58 static bool shouldBlockFetch(LocalFrame*, ResourceRequest*, WebURLRequest::R equestContext, WebURLRequest::FrameType, const KURL&, ReportingStatus = SendRepo rt); | |
Mike West
2015/08/17 15:36:45
You can probably make this variant private, as I t
estark
2015/08/17 17:20:12
Done.
| |
59 | |
60 static bool shouldBlockFetch(LocalFrame* frame, WebURLRequest::RequestContex t context, WebURLRequest::FrameType frameType, const KURL& url, ReportingStatus status = SendReport) | |
54 { | 61 { |
55 return shouldBlockFetch(frame, request.requestContext(), request.frameTy pe(), url, status); | 62 return shouldBlockFetch(frame, nullptr, context, frameType, url, status) ; |
63 } | |
64 | |
65 static bool shouldBlockFetch(LocalFrame* frame, ResourceRequest* request, co nst KURL& url, ReportingStatus status = SendReport) | |
66 { | |
67 return shouldBlockFetch(frame, request, request->requestContext(), reque st->frameType(), url, status); | |
56 } | 68 } |
57 | 69 |
58 static bool shouldBlockWebSocket(LocalFrame*, const KURL&, ReportingStatus = SendReport); | 70 static bool shouldBlockWebSocket(LocalFrame*, const KURL&, ReportingStatus = SendReport); |
59 | 71 |
60 static bool isMixedContent(SecurityOrigin*, const KURL&); | 72 static bool isMixedContent(SecurityOrigin*, const KURL&); |
61 static bool isMixedFormAction(LocalFrame*, const KURL&, ReportingStatus = Se ndReport); | 73 static bool isMixedFormAction(LocalFrame*, const KURL&, ReportingStatus = Se ndReport); |
62 | 74 |
63 static void checkMixedPrivatePublic(LocalFrame*, const AtomicString& resourc eIPAddress); | 75 static void checkMixedPrivatePublic(LocalFrame*, const AtomicString& resourc eIPAddress); |
64 | 76 |
65 private: | 77 private: |
(...skipping 15 matching lines...) Expand all Loading... | |
81 static ContextType contextTypeFromContext(WebURLRequest::RequestContext, Loc alFrame*); | 93 static ContextType contextTypeFromContext(WebURLRequest::RequestContext, Loc alFrame*); |
82 static const char* typeNameFromContext(WebURLRequest::RequestContext); | 94 static const char* typeNameFromContext(WebURLRequest::RequestContext); |
83 static void logToConsoleAboutFetch(LocalFrame*, const KURL&, WebURLRequest:: RequestContext, bool allowed); | 95 static void logToConsoleAboutFetch(LocalFrame*, const KURL&, WebURLRequest:: RequestContext, bool allowed); |
84 static void logToConsoleAboutWebSocket(LocalFrame*, const KURL&, bool allowe d); | 96 static void logToConsoleAboutWebSocket(LocalFrame*, const KURL&, bool allowe d); |
85 static void count(LocalFrame*, WebURLRequest::RequestContext); | 97 static void count(LocalFrame*, WebURLRequest::RequestContext); |
86 }; | 98 }; |
87 | 99 |
88 } // namespace blink | 100 } // namespace blink |
89 | 101 |
90 #endif // MixedContentChecker_h | 102 #endif // MixedContentChecker_h |
OLD | NEW |