Chromium Code Reviews| 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 29 matching lines...) Expand all Loading... | |
| 40 #include "wtf/text/WTFString.h" | 40 #include "wtf/text/WTFString.h" |
| 41 | 41 |
| 42 namespace blink { | 42 namespace blink { |
| 43 | 43 |
| 44 class Frame; | 44 class Frame; |
| 45 class LocalFrame; | 45 class LocalFrame; |
| 46 class KURL; | 46 class KURL; |
| 47 class ResourceResponse; | 47 class ResourceResponse; |
| 48 class SecurityOrigin; | 48 class SecurityOrigin; |
| 49 | 49 |
| 50 // Checks resource loads for mixed-content. If PlzNavigate is enabled then this | |
| 51 // class only checks for sub-resource loads while frame-level loads are | |
| 52 // delegated to the browser where they are checked by | |
| 53 // MixedContentNavigationThrottle. Changes to this class might need to be | |
| 54 // reflected on its browser counterpart. | |
| 55 // | |
| 56 // Current mixed content W3C draft that drives this implementation: | |
| 57 // https://w3c.github.io/webappsec-mixed-content/ | |
| 50 class CORE_EXPORT MixedContentChecker final { | 58 class CORE_EXPORT MixedContentChecker final { |
| 51 WTF_MAKE_NONCOPYABLE(MixedContentChecker); | 59 WTF_MAKE_NONCOPYABLE(MixedContentChecker); |
| 52 DISALLOW_NEW(); | 60 DISALLOW_NEW(); |
| 53 | 61 |
| 54 public: | 62 public: |
| 55 enum ReportingStatus { SendReport, SuppressReport }; | 63 enum ReportingStatus { SendReport, SuppressReport }; |
| 56 static bool shouldBlockFetch(LocalFrame*, | 64 static bool shouldBlockFetch(LocalFrame*, |
| 57 WebURLRequest::RequestContext, | 65 WebURLRequest::RequestContext, |
| 58 WebURLRequest::FrameType, | 66 WebURLRequest::FrameType, |
| 59 ResourceRequest::RedirectStatus, | 67 ResourceRequest::RedirectStatus, |
| (...skipping 27 matching lines...) Expand all Loading... | |
| 87 // Returns the frame that should be considered the effective frame | 95 // Returns the frame that should be considered the effective frame |
| 88 // for a mixed content check for the given frame type. | 96 // for a mixed content check for the given frame type. |
| 89 static Frame* effectiveFrameForFrameType(LocalFrame*, | 97 static Frame* effectiveFrameForFrameType(LocalFrame*, |
| 90 WebURLRequest::FrameType); | 98 WebURLRequest::FrameType); |
| 91 | 99 |
| 92 static void handleCertificateError(LocalFrame*, | 100 static void handleCertificateError(LocalFrame*, |
| 93 const ResourceResponse&, | 101 const ResourceResponse&, |
| 94 WebURLRequest::FrameType, | 102 WebURLRequest::FrameType, |
| 95 WebURLRequest::RequestContext); | 103 WebURLRequest::RequestContext); |
| 96 | 104 |
| 105 // Receive a information about mixed content that was found by the browser. | |
|
nasko
2017/01/12 18:32:38
nit: No need for "a" before information.
carlosk
2017/01/21 02:54:59
Done.
| |
| 106 static void mixedContentFoundByTheBrowser(LocalFrame*, | |
| 107 const KURL& mainResourceUrl, | |
| 108 const KURL& mixedContentUrl, | |
| 109 WebURLRequest::RequestContext, | |
| 110 bool wasAllowed, | |
| 111 bool hadRedirect); | |
| 112 | |
| 97 private: | 113 private: |
| 98 FRIEND_TEST_ALL_PREFIXES(MixedContentCheckerTest, HandleCertificateError); | 114 FRIEND_TEST_ALL_PREFIXES(MixedContentCheckerTest, HandleCertificateError); |
| 99 | 115 |
| 100 static Frame* inWhichFrameIsContentMixed(Frame*, | 116 static Frame* inWhichFrameIsContentMixed(Frame*, |
| 101 WebURLRequest::FrameType, | 117 WebURLRequest::FrameType, |
| 102 const KURL&); | 118 const KURL&); |
| 103 | 119 |
| 104 static void logToConsoleAboutFetch(LocalFrame*, | 120 static void logToConsoleAboutFetch(LocalFrame*, |
| 105 const KURL&, | 121 const KURL&, |
| 106 const KURL&, | 122 const KURL&, |
| 107 WebURLRequest::RequestContext, | 123 WebURLRequest::RequestContext, |
| 108 bool allowed); | 124 bool allowed); |
| 109 static void logToConsoleAboutWebSocket(LocalFrame*, | 125 static void logToConsoleAboutWebSocket(LocalFrame*, |
| 110 const KURL&, | 126 const KURL&, |
| 111 const KURL&, | 127 const KURL&, |
| 112 bool allowed); | 128 bool allowed); |
| 113 static void count(Frame*, WebURLRequest::RequestContext); | 129 static void count(Frame*, WebURLRequest::RequestContext); |
| 114 }; | 130 }; |
| 115 | 131 |
| 116 } // namespace blink | 132 } // namespace blink |
| 117 | 133 |
| 118 #endif // MixedContentChecker_h | 134 #endif // MixedContentChecker_h |
| OLD | NEW |