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

Side by Side Diff: Source/core/loader/MixedContentChecker.h

Issue 566533003: Mixed Content: Make MixedContentChecker completely static. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Fixing tests. Created 6 years, 3 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 | Annotate | Revision Log
« no previous file with comments | « Source/core/loader/FrameLoader.cpp ('k') | Source/core/loader/MixedContentChecker.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 27 matching lines...) Expand all
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
OLDNEW
« no previous file with comments | « Source/core/loader/FrameLoader.cpp ('k') | Source/core/loader/MixedContentChecker.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698