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

Side by Side 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: mkwst comments 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 unified diff | Download patch
OLDNEW
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
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 static bool shouldBlockFetch(LocalFrame* frame, WebURLRequest::RequestContex t context, WebURLRequest::FrameType frameType, const KURL& url, ReportingStatus status = SendReport)
54 { 54 {
55 return shouldBlockFetch(frame, request.requestContext(), request.frameTy pe(), url, status); 55 return shouldBlockFetch(frame, nullptr, context, frameType, url, status) ;
56 }
57
58 // Checks if the given request should be blocked due to mixed
59 // content restrictions. Returns true if it should be blocked and
60 // false if it should be allowed. Mutates |request| (if not nullptr)
61 // to set |request->contextType()| indicating which type of
62 // mixed content it is.
63 static bool shouldBlockFetch(LocalFrame* frame, ResourceRequest* request, co nst KURL& url, ReportingStatus status = SendReport)
64 {
65 return shouldBlockFetch(frame, request, request->requestContext(), reque st->frameType(), url, status);
56 } 66 }
57 67
58 static bool shouldBlockWebSocket(LocalFrame*, const KURL&, ReportingStatus = SendReport); 68 static bool shouldBlockWebSocket(LocalFrame*, const KURL&, ReportingStatus = SendReport);
59 69
60 static bool isMixedContent(SecurityOrigin*, const KURL&); 70 static bool isMixedContent(SecurityOrigin*, const KURL&);
61 static bool isMixedFormAction(LocalFrame*, const KURL&, ReportingStatus = Se ndReport); 71 static bool isMixedFormAction(LocalFrame*, const KURL&, ReportingStatus = Se ndReport);
62 72
63 static void checkMixedPrivatePublic(LocalFrame*, const AtomicString& resourc eIPAddress); 73 static void checkMixedPrivatePublic(LocalFrame*, const AtomicString& resourc eIPAddress);
64 74
65 private: 75 private:
66 enum MixedContentType { 76 enum MixedContentType {
67 Display, 77 Display,
68 Execution, 78 Execution,
69 WebSocket, 79 WebSocket,
70 Submission 80 Submission
71 }; 81 };
72 82
73 enum ContextType { 83 static bool shouldBlockFetch(LocalFrame*, ResourceRequest*, WebURLRequest::R equestContext, WebURLRequest::FrameType, const KURL&, ReportingStatus = SendRepo rt);
74 ContextTypeBlockable,
75 ContextTypeOptionallyBlockable,
76 ContextTypeShouldBeBlockable,
77 };
78 84
79 static LocalFrame* inWhichFrameIsContentMixed(LocalFrame*, WebURLRequest::Fr ameType, const KURL&); 85 static LocalFrame* inWhichFrameIsContentMixed(LocalFrame*, WebURLRequest::Fr ameType, const KURL&);
80 86
81 static ContextType contextTypeFromContext(WebURLRequest::RequestContext, Loc alFrame*); 87 static ResourceRequest::ContextType contextTypeFromContext(WebURLRequest::Re questContext, LocalFrame*);
82 static const char* typeNameFromContext(WebURLRequest::RequestContext); 88 static const char* typeNameFromContext(WebURLRequest::RequestContext);
83 static void logToConsoleAboutFetch(LocalFrame*, const KURL&, WebURLRequest:: RequestContext, bool allowed); 89 static void logToConsoleAboutFetch(LocalFrame*, const KURL&, WebURLRequest:: RequestContext, bool allowed);
84 static void logToConsoleAboutWebSocket(LocalFrame*, const KURL&, bool allowe d); 90 static void logToConsoleAboutWebSocket(LocalFrame*, const KURL&, bool allowe d);
85 static void count(LocalFrame*, WebURLRequest::RequestContext); 91 static void count(LocalFrame*, WebURLRequest::RequestContext);
86 }; 92 };
87 93
88 } // namespace blink 94 } // namespace blink
89 95
90 #endif // MixedContentChecker_h 96 #endif // MixedContentChecker_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698