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

Side by Side Diff: third_party/WebKit/Source/core/loader/DocumentThreadableLoader.h

Issue 1866433002: Use RequestContext to apply CSP in FrameFetchContext (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rename redirectReceivedAndNotFollowed() to redirectBlocked() Created 4 years, 8 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) 2009, 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2009, 2012 Google Inc. All rights reserved.
3 * Copyright (C) 2013, Intel Corporation 3 * Copyright (C) 2013, Intel Corporation
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are 6 * modification, are permitted provided that the following conditions are
7 * met: 7 * met:
8 * 8 *
9 * * Redistributions of source code must retain the above copyright 9 * * Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 17 matching lines...) Expand all
28 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 */ 30 */
31 31
32 #ifndef DocumentThreadableLoader_h 32 #ifndef DocumentThreadableLoader_h
33 #define DocumentThreadableLoader_h 33 #define DocumentThreadableLoader_h
34 34
35 #include "core/CoreExport.h" 35 #include "core/CoreExport.h"
36 #include "core/fetch/RawResource.h" 36 #include "core/fetch/RawResource.h"
37 #include "core/fetch/ResourceOwner.h" 37 #include "core/fetch/ResourceOwner.h"
38 #include "core/frame/csp/ContentSecurityPolicy.h"
39 #include "core/loader/ThreadableLoader.h" 38 #include "core/loader/ThreadableLoader.h"
40 #include "platform/Timer.h" 39 #include "platform/Timer.h"
41 #include "platform/heap/Handle.h" 40 #include "platform/heap/Handle.h"
42 #include "platform/network/HTTPHeaderMap.h" 41 #include "platform/network/HTTPHeaderMap.h"
43 #include "platform/network/ResourceError.h" 42 #include "platform/network/ResourceError.h"
44 #include "wtf/Forward.h" 43 #include "wtf/Forward.h"
45 #include "wtf/OwnPtr.h" 44 #include "wtf/OwnPtr.h"
46 #include "wtf/PassOwnPtr.h" 45 #include "wtf/PassOwnPtr.h"
47 #include "wtf/WeakPtr.h" 46 #include "wtf/WeakPtr.h"
48 #include "wtf/text/WTFString.h" 47 #include "wtf/text/WTFString.h"
(...skipping 20 matching lines...) Expand all
69 // |this| may be dead after calling this method in async mode. 68 // |this| may be dead after calling this method in async mode.
70 void cancel() override; 69 void cancel() override;
71 void setDefersLoading(bool); 70 void setDefersLoading(bool);
72 71
73 private: 72 private:
74 enum BlockingBehavior { 73 enum BlockingBehavior {
75 LoadSynchronously, 74 LoadSynchronously,
76 LoadAsynchronously 75 LoadAsynchronously
77 }; 76 };
78 77
79 enum EnforceContentSecurityPolicyDirective {
80 EnforceWorkerDirective,
81 EnforceConnectSrcDirective,
82 EnforceManifestSrcDirective,
83 EnforceMediaSrcDirective,
84 };
85
86 DocumentThreadableLoader(Document&, ThreadableLoaderClient*, BlockingBeh avior, const ThreadableLoaderOptions&, const ResourceLoaderOptions&); 78 DocumentThreadableLoader(Document&, ThreadableLoaderClient*, BlockingBeh avior, const ThreadableLoaderOptions&, const ResourceLoaderOptions&);
87 79
88 void clear(); 80 void clear();
89 81
90 // ResourceClient 82 // ResourceClient
91 // 83 //
92 // |this| may be dead after calling this method. 84 // |this| may be dead after calling this method.
93 void notifyFinished(Resource*) override; 85 void notifyFinished(Resource*) override;
94 86
95 String debugName() const override { return "DocumentThreadableLoader"; } 87 String debugName() const override { return "DocumentThreadableLoader"; }
96 88
97 // RawResourceClient 89 // RawResourceClient
98 // 90 //
99 // |this| may be dead after calling these methods. 91 // |this| may be dead after calling these methods.
100 void dataSent(Resource*, unsigned long long bytesSent, unsigned long lon g totalBytesToBeSent) override; 92 void dataSent(Resource*, unsigned long long bytesSent, unsigned long lon g totalBytesToBeSent) override;
101 void responseReceived(Resource*, const ResourceResponse&, PassOwnPtr<Web DataConsumerHandle>) override; 93 void responseReceived(Resource*, const ResourceResponse&, PassOwnPtr<Web DataConsumerHandle>) override;
102 void setSerializedCachedMetadata(Resource*, const char*, size_t) overrid e; 94 void setSerializedCachedMetadata(Resource*, const char*, size_t) overrid e;
103 void dataReceived(Resource*, const char* data, size_t dataLength) overri de; 95 void dataReceived(Resource*, const char* data, size_t dataLength) overri de;
104 void redirectReceived(Resource*, ResourceRequest&, const ResourceRespons e&) override; 96 void redirectReceived(Resource*, ResourceRequest&, const ResourceRespons e&) override;
97 void redirectBlocked() override;
105 void dataDownloaded(Resource*, int) override; 98 void dataDownloaded(Resource*, int) override;
106 void didReceiveResourceTiming(Resource*, const ResourceTimingInfo&) over ride; 99 void didReceiveResourceTiming(Resource*, const ResourceTimingInfo&) over ride;
107 100
108 // |this| may be dead after calling this method in async mode. 101 // |this| may be dead after calling this method in async mode.
109 void cancelWithError(const ResourceError&); 102 void cancelWithError(const ResourceError&);
110 103
111 // Notify Inspector and log to console about resource response. Use 104 // Notify Inspector and log to console about resource response. Use
112 // this method if response is not going to be finished normally. 105 // this method if response is not going to be finished normally.
113 void reportResponseReceived(unsigned long identifier, const ResourceResp onse&); 106 void reportResponseReceived(unsigned long identifier, const ResourceResp onse&);
114 107
(...skipping 29 matching lines...) Expand all
144 // Investigates the response for the preflight request. If successful, 137 // Investigates the response for the preflight request. If successful,
145 // the actual request will be made later in handleSuccessfulFinish(). 138 // the actual request will be made later in handleSuccessfulFinish().
146 // 139 //
147 // |this| may be dead after calling this method in async mode. 140 // |this| may be dead after calling this method in async mode.
148 void handlePreflightResponse(const ResourceResponse&); 141 void handlePreflightResponse(const ResourceResponse&);
149 // |this| may be dead after calling this method. 142 // |this| may be dead after calling this method.
150 void handleError(const ResourceError&); 143 void handleError(const ResourceError&);
151 144
152 void loadRequest(const ResourceRequest&, ResourceLoaderOptions); 145 void loadRequest(const ResourceRequest&, ResourceLoaderOptions);
153 bool isAllowedRedirect(const KURL&) const; 146 bool isAllowedRedirect(const KURL&) const;
154 bool isAllowedByContentSecurityPolicy(const KURL&, ContentSecurityPolicy ::RedirectStatus) const;
155 // Returns DoNotAllowStoredCredentials 147 // Returns DoNotAllowStoredCredentials
156 // if m_forceDoNotAllowStoredCredentials is set. Otherwise, just 148 // if m_forceDoNotAllowStoredCredentials is set. Otherwise, just
157 // returns allowCredentials value of m_resourceLoaderOptions. 149 // returns allowCredentials value of m_resourceLoaderOptions.
158 StoredCredentials effectiveAllowCredentials() const; 150 StoredCredentials effectiveAllowCredentials() const;
159 151
160 // TODO(oilpan): DocumentThreadableLoader used to be a ResourceOwner, 152 // TODO(oilpan): DocumentThreadableLoader used to be a ResourceOwner,
161 // but ResourceOwner was moved onto the oilpan heap before 153 // but ResourceOwner was moved onto the oilpan heap before
162 // DocumentThreadableLoader was ready. When DocumentThreadableLoader 154 // DocumentThreadableLoader was ready. When DocumentThreadableLoader
163 // moves onto the oilpan heap, make it a ResourceOwner again and remove 155 // moves onto the oilpan heap, make it a ResourceOwner again and remove
164 // this re-implementation of ResourceOwner. 156 // this re-implementation of ResourceOwner.
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
201 bool m_sameOriginRequest; 193 bool m_sameOriginRequest;
202 // Set to true if the current request is cross-origin and not simple. 194 // Set to true if the current request is cross-origin and not simple.
203 bool m_crossOriginNonSimpleRequest; 195 bool m_crossOriginNonSimpleRequest;
204 196
205 // Set to true when the response data is given to a data consumer 197 // Set to true when the response data is given to a data consumer
206 // handle. 198 // handle.
207 bool m_isUsingDataConsumerHandle; 199 bool m_isUsingDataConsumerHandle;
208 200
209 const bool m_async; 201 const bool m_async;
210 202
211 // Holds the original request context (used for sanity checks and Conten t Security Policy enforcement). 203 // Holds the original request context (used for sanity checks).
212 WebURLRequest::RequestContext m_requestContext; 204 WebURLRequest::RequestContext m_requestContext;
213 205
214 // Holds the original request for fallback in case the Service Worker 206 // Holds the original request for fallback in case the Service Worker
215 // does not respond. 207 // does not respond.
216 ResourceRequest m_fallbackRequestForServiceWorker; 208 ResourceRequest m_fallbackRequestForServiceWorker;
217 209
218 // Holds the original request and options for it during preflight 210 // Holds the original request and options for it during preflight
219 // request handling phase. 211 // request handling phase.
220 ResourceRequest m_actualRequest; 212 ResourceRequest m_actualRequest;
221 ResourceLoaderOptions m_actualOptions; 213 ResourceLoaderOptions m_actualOptions;
(...skipping 10 matching lines...) Expand all
232 int m_corsRedirectLimit; 224 int m_corsRedirectLimit;
233 225
234 WebURLRequest::FetchRedirectMode m_redirectMode; 226 WebURLRequest::FetchRedirectMode m_redirectMode;
235 227
236 WeakPtrFactory<DocumentThreadableLoader> m_weakFactory; 228 WeakPtrFactory<DocumentThreadableLoader> m_weakFactory;
237 }; 229 };
238 230
239 } // namespace blink 231 } // namespace blink
240 232
241 #endif // DocumentThreadableLoader_h 233 #endif // DocumentThreadableLoader_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698