Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1449)

Unified Diff: Source/core/loader/MixedContentChecker.h

Issue 1299493003: Attach mixed content status to resource requests when sent to devtools (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: isMixedContent() -> ContextTypeNotMixedContent, and rename devtools protocol enum Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: Source/core/loader/MixedContentChecker.h
diff --git a/Source/core/loader/MixedContentChecker.h b/Source/core/loader/MixedContentChecker.h
index f324a02ace2c06d4f5cdcca051ec72338ac63311..0561aa835570f80c0157bb5ace3888547772e71a 100644
--- a/Source/core/loader/MixedContentChecker.h
+++ b/Source/core/loader/MixedContentChecker.h
@@ -49,10 +49,20 @@ class CORE_EXPORT MixedContentChecker final {
DISALLOW_ALLOCATION();
public:
enum ReportingStatus { SendReport, SuppressReport };
- static bool shouldBlockFetch(LocalFrame*, WebURLRequest::RequestContext, WebURLRequest::FrameType, const KURL&, ReportingStatus = SendReport);
- static bool shouldBlockFetch(LocalFrame* frame, const ResourceRequest& request, const KURL& url, ReportingStatus status = SendReport)
+
+ static bool shouldBlockFetch(LocalFrame* frame, WebURLRequest::RequestContext context, WebURLRequest::FrameType frameType, const KURL& url, ReportingStatus status = SendReport)
{
- return shouldBlockFetch(frame, request.requestContext(), request.frameType(), url, status);
+ return shouldBlockFetch(frame, nullptr, context, frameType, url, status);
+ }
+
+ // Checks if the given request should be blocked due to mixed
+ // content restrictions. Returns true if it should be blocked and
+ // false if it should be allowed. Mutates |request| (if not nullptr)
+ // to set |request->contextType()| indicating which type of
+ // mixed content it is.
+ static bool shouldBlockFetch(LocalFrame* frame, ResourceRequest* request, const KURL& url, ReportingStatus status = SendReport)
+ {
+ return shouldBlockFetch(frame, request, request->requestContext(), request->frameType(), url, status);
}
static bool shouldBlockWebSocket(LocalFrame*, const KURL&, ReportingStatus = SendReport);
@@ -70,15 +80,11 @@ private:
Submission
};
- enum ContextType {
- ContextTypeBlockable,
- ContextTypeOptionallyBlockable,
- ContextTypeShouldBeBlockable,
- };
+ static bool shouldBlockFetch(LocalFrame*, ResourceRequest*, WebURLRequest::RequestContext, WebURLRequest::FrameType, const KURL&, ReportingStatus = SendReport);
static LocalFrame* inWhichFrameIsContentMixed(LocalFrame*, WebURLRequest::FrameType, const KURL&);
- static ContextType contextTypeFromContext(WebURLRequest::RequestContext, LocalFrame*);
+ static ResourceRequest::ContextType contextTypeFromContext(WebURLRequest::RequestContext, LocalFrame*);
static const char* typeNameFromContext(WebURLRequest::RequestContext);
static void logToConsoleAboutFetch(LocalFrame*, const KURL&, WebURLRequest::RequestContext, bool allowed);
static void logToConsoleAboutWebSocket(LocalFrame*, const KURL&, bool allowed);

Powered by Google App Engine
This is Rietveld 408576698