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

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

Issue 605453002: Merge 182515 "Revert "Mixed Content: Make MixedContentChecker co..." (Closed) Base URL: svn://svn.chromium.org/blink/branches/chromium/2167/
Patch Set: 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 18 matching lines...) Expand all
29 */ 29 */
30 30
31 #ifndef MixedContentChecker_h 31 #ifndef MixedContentChecker_h
32 #define MixedContentChecker_h 32 #define MixedContentChecker_h
33 33
34 #include "public/platform/WebURLRequest.h" 34 #include "public/platform/WebURLRequest.h"
35 #include "wtf/text/WTFString.h" 35 #include "wtf/text/WTFString.h"
36 36
37 namespace blink { 37 namespace blink {
38 38
39 class FrameLoaderClient;
39 class LocalFrame; 40 class LocalFrame;
40 class KURL; 41 class KURL;
41 class SecurityOrigin; 42 class SecurityOrigin;
42 43
43 class MixedContentChecker { 44 class MixedContentChecker {
44 WTF_MAKE_NONCOPYABLE(MixedContentChecker); 45 WTF_MAKE_NONCOPYABLE(MixedContentChecker);
45 public: 46 public:
46 static bool shouldBlockFetch(LocalFrame*, WebURLRequest::RequestContext, Web URLRequest::FrameType, const KURL&); 47 explicit MixedContentChecker(LocalFrame*);
47 static bool shouldBlockWebSocket(LocalFrame*, const KURL&); 48
48 static bool checkFormAction(LocalFrame*, const KURL&); 49 static bool shouldBlockFetch(LocalFrame*, const ResourceRequest&, const KURL &);
50
51 bool canDisplayInsecureContent(SecurityOrigin* securityOrigin, const KURL& u rl) const
52 {
53 return canDisplayInsecureContentInternal(securityOrigin, url, MixedConte ntChecker::Display);
54 }
55
56 bool canRunInsecureContent(SecurityOrigin* securityOrigin, const KURL& url) const
57 {
58 return canRunInsecureContentInternal(securityOrigin, url, MixedContentCh ecker::Execution);
59 }
60
61 bool canSubmitToInsecureForm(SecurityOrigin*, const KURL&) const;
62 bool canConnectInsecureWebSocket(SecurityOrigin*, const KURL&) const;
63 bool canFrameInsecureContent(SecurityOrigin*, const KURL&) const;
49 static bool isMixedContent(SecurityOrigin*, const KURL&); 64 static bool isMixedContent(SecurityOrigin*, const KURL&);
50 65
51 static void checkMixedPrivatePublic(LocalFrame*, const AtomicString& resourc eIPAddress); 66 static void checkMixedPrivatePublic(LocalFrame*, const AtomicString& resourc eIPAddress);
52 67
53 private: 68 private:
69 enum MixedContentType {
70 Display,
71 Execution,
72 WebSocket,
73 Submission
74 };
75
54 enum ContextType { 76 enum ContextType {
55 ContextTypeBlockable, 77 ContextTypeBlockable,
56 ContextTypeOptionallyBlockable, 78 ContextTypeOptionallyBlockable,
57 ContextTypeShouldBeBlockable, 79 ContextTypeShouldBeBlockable,
58 ContextTypeBlockableUnlessLax 80 ContextTypeBlockableUnlessLax
59 }; 81 };
60 82
61 static LocalFrame* inWhichFrameIsThisContentMixed(LocalFrame*, WebURLRequest ::RequestContext, WebURLRequest::FrameType, const KURL&);
62 static ContextType contextTypeFromContext(WebURLRequest::RequestContext); 83 static ContextType contextTypeFromContext(WebURLRequest::RequestContext);
63 static const char* typeNameFromContext(WebURLRequest::RequestContext); 84 static const char* typeNameFromContext(WebURLRequest::RequestContext);
64 static void logToConsole(LocalFrame*, const KURL&, WebURLRequest::RequestCon text, bool allowed); 85 static void logToConsole(LocalFrame*, const KURL&, WebURLRequest::RequestCon text, bool allowed);
86
87 // FIXME: This should probably have a separate client from FrameLoader.
88 FrameLoaderClient* client() const;
89
90 bool canDisplayInsecureContentInternal(SecurityOrigin*, const KURL&, const M ixedContentType) const;
91
92 bool canRunInsecureContentInternal(SecurityOrigin*, const KURL&, const Mixed ContentType) const;
93
94 void logWarning(bool allowed, const KURL& i, const MixedContentType) const;
95
96 LocalFrame* m_frame;
65 }; 97 };
66 98
67 } // namespace blink 99 } // namespace blink
68 100
69 #endif // MixedContentChecker_h 101 #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