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 27 matching lines...) Expand all Loading... |
38 | 38 |
39 class LocalFrame; | 39 class LocalFrame; |
40 class FrameLoaderClient; | 40 class FrameLoaderClient; |
41 class KURL; | 41 class KURL; |
42 class SecurityOrigin; | 42 class SecurityOrigin; |
43 class ResourceRequest; | 43 class ResourceRequest; |
44 | 44 |
45 class MixedContentChecker { | 45 class MixedContentChecker { |
46 WTF_MAKE_NONCOPYABLE(MixedContentChecker); | 46 WTF_MAKE_NONCOPYABLE(MixedContentChecker); |
47 public: | 47 public: |
48 explicit MixedContentChecker(LocalFrame*); | 48 static bool shouldBlockFetch(LocalFrame*, WebURLRequest::RequestContext, Web
URLRequest::FrameType, const KURL&); |
49 | 49 static bool shouldBlockWebSocket(LocalFrame*, const KURL&); |
50 static bool shouldBlockFetch(LocalFrame*, const ResourceRequest&, const KURL
&); | 50 static bool checkFormAction(LocalFrame*, const KURL&); |
51 | |
52 bool canDisplayInsecureContent(SecurityOrigin* securityOrigin, const KURL& u
rl) const | |
53 { | |
54 return canDisplayInsecureContentInternal(securityOrigin, url, MixedConte
ntChecker::Display); | |
55 } | |
56 | |
57 bool canRunInsecureContent(SecurityOrigin* securityOrigin, const KURL& url)
const | |
58 { | |
59 return canRunInsecureContentInternal(securityOrigin, url, MixedContentCh
ecker::Execution); | |
60 } | |
61 | |
62 bool canSubmitToInsecureForm(SecurityOrigin*, const KURL&) const; | |
63 bool canConnectInsecureWebSocket(SecurityOrigin*, const KURL&) const; | |
64 bool canFrameInsecureContent(SecurityOrigin*, const KURL&) const; | |
65 static bool isMixedContent(SecurityOrigin*, const KURL&); | 51 static bool isMixedContent(SecurityOrigin*, const KURL&); |
66 | 52 |
67 private: | 53 private: |
68 enum MixedContentType { | |
69 Display, | |
70 Execution, | |
71 WebSocket, | |
72 Submission | |
73 }; | |
74 | |
75 enum ContextType { | 54 enum ContextType { |
76 ContextTypeBlockable, | 55 ContextTypeBlockable, |
77 ContextTypeOptionallyBlockable, | 56 ContextTypeOptionallyBlockable, |
78 ContextTypeShouldBeBlockable, | 57 ContextTypeShouldBeBlockable, |
79 ContextTypeBlockableUnlessLax | 58 ContextTypeBlockableUnlessLax |
80 }; | 59 }; |
81 | 60 |
| 61 static LocalFrame* inWhichFrameIsThisContentMixed(LocalFrame*, WebURLRequest
::RequestContext, WebURLRequest::FrameType, const KURL&); |
82 static ContextType contextTypeFromContext(WebURLRequest::RequestContext); | 62 static ContextType contextTypeFromContext(WebURLRequest::RequestContext); |
83 static const char* typeNameFromContext(WebURLRequest::RequestContext); | 63 static const char* typeNameFromContext(WebURLRequest::RequestContext); |
84 static void logToConsole(LocalFrame*, const KURL&, WebURLRequest::RequestCon
text, bool allowed); | 64 static void logToConsole(LocalFrame*, const KURL&, WebURLRequest::RequestCon
text, bool allowed); |
85 | |
86 // FIXME: This should probably have a separate client from FrameLoader. | |
87 FrameLoaderClient* client() const; | |
88 | |
89 bool canDisplayInsecureContentInternal(SecurityOrigin*, const KURL&, const M
ixedContentType) const; | |
90 | |
91 bool canRunInsecureContentInternal(SecurityOrigin*, const KURL&, const Mixed
ContentType) const; | |
92 | |
93 void logWarning(bool allowed, const KURL& i, const MixedContentType) const; | |
94 | |
95 LocalFrame* m_frame; | |
96 }; | 65 }; |
97 | 66 |
98 } // namespace blink | 67 } // namespace blink |
99 | 68 |
100 #endif // MixedContentChecker_h | 69 #endif // MixedContentChecker_h |
OLD | NEW |