Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (C) 2003, 2006 Apple Computer, Inc. All rights reserved. | 2 * Copyright (C) 2003, 2006 Apple Computer, Inc. All rights reserved. |
| 3 * Copyright (C) 2006 Samuel Weinig <sam.weinig@gmail.com> | 3 * Copyright (C) 2006 Samuel Weinig <sam.weinig@gmail.com> |
| 4 * Copyright (C) 2009, 2012 Google Inc. All rights reserved. | 4 * Copyright (C) 2009, 2012 Google Inc. All rights reserved. |
| 5 * | 5 * |
| 6 * Redistribution and use in source and binary forms, with or without | 6 * Redistribution and use in source and binary forms, with or without |
| 7 * modification, are permitted provided that the following conditions | 7 * modification, are permitted provided that the following conditions |
| 8 * are met: | 8 * are met: |
| 9 * 1. Redistributions of source code must retain the above copyright | 9 * 1. 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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 44 ReturnCacheDataElseLoad, // back/forward or encoding change - allow stale da ta | 44 ReturnCacheDataElseLoad, // back/forward or encoding change - allow stale da ta |
| 45 ReturnCacheDataDontLoad, // results of a post - allow stale data and only us e cache | 45 ReturnCacheDataDontLoad, // results of a post - allow stale data and only us e cache |
| 46 ReloadBypassingCache, // end-to-end reload | 46 ReloadBypassingCache, // end-to-end reload |
| 47 }; | 47 }; |
| 48 | 48 |
| 49 struct CrossThreadResourceRequestData; | 49 struct CrossThreadResourceRequestData; |
| 50 | 50 |
| 51 class PLATFORM_EXPORT ResourceRequest { | 51 class PLATFORM_EXPORT ResourceRequest { |
| 52 WTF_MAKE_FAST_ALLOCATED; | 52 WTF_MAKE_FAST_ALLOCATED; |
| 53 public: | 53 public: |
| 54 // The type of this ResourceRequest, based on how the resource will be used. | 54 // The request context of this ResourceRequest, as defined at http://fetch.s pec.whatwg.org/#concept-request-context. |
| 55 enum TargetType { | 55 enum RequestContext { |
|
abarth-chromium
2014/07/01 14:50:53
We can just use blink::URLRequest::RequestContext
Mike West
2014/07/01 15:00:20
One enum sounds great. That said, it looks like we
| |
| 56 TargetIsMainFrame, | 56 UnspecifiedContext, |
| 57 TargetIsSubframe, | 57 AudioContext, |
| 58 TargetIsSubresource, // Resource is a generic subresource. (Generally a specific type should be specified) | 58 ConnectContext, |
| 59 TargetIsStyleSheet, | 59 DownloadContext, |
| 60 TargetIsScript, | 60 FaviconContext, |
| 61 TargetIsFont, | 61 FontContext, |
| 62 TargetIsImage, | 62 FormContext, |
| 63 TargetIsObject, | 63 ImageContext, |
| 64 TargetIsMedia, | 64 MainFrameContext, |
| 65 TargetIsWorker, | 65 ManifestContext, |
| 66 TargetIsSharedWorker, | 66 ObjectContext, |
| 67 TargetIsPrefetch, | 67 ObjectRequestContext, |
| 68 TargetIsFavicon, | 68 PingContext, |
| 69 TargetIsXHR, | 69 PopupContext, |
| 70 TargetIsTextTrack, | 70 PrefetchContext, |
| 71 TargetIsPing, | 71 ScriptContext, |
| 72 TargetIsServiceWorker, | 72 ServiceWorkerContext, |
| 73 TargetIsUnspecified, | 73 SharedWorkerContext, |
| 74 StyleContext, | |
| 75 SubFrameContext, | |
| 76 SubresourceContext, | |
| 77 TextTrackContext, | |
| 78 VideoContext, | |
| 79 WorkerContext | |
| 74 }; | 80 }; |
| 75 | 81 |
| 76 class ExtraData : public RefCounted<ExtraData> { | 82 class ExtraData : public RefCounted<ExtraData> { |
| 77 public: | 83 public: |
| 78 virtual ~ExtraData() { } | 84 virtual ~ExtraData() { } |
| 79 }; | 85 }; |
| 80 | 86 |
| 81 ResourceRequest() | 87 ResourceRequest() |
| 82 { | 88 { |
| 83 initialize(KURL(), UseProtocolCachePolicy); | 89 initialize(KURL(), UseProtocolCachePolicy); |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 195 void setHasUserGesture(bool hasUserGesture) { m_hasUserGesture = hasUserGest ure; } | 201 void setHasUserGesture(bool hasUserGesture) { m_hasUserGesture = hasUserGest ure; } |
| 196 | 202 |
| 197 // True if request should be downloaded to file. | 203 // True if request should be downloaded to file. |
| 198 bool downloadToFile() const { return m_downloadToFile; } | 204 bool downloadToFile() const { return m_downloadToFile; } |
| 199 void setDownloadToFile(bool downloadToFile) { m_downloadToFile = downloadToF ile; } | 205 void setDownloadToFile(bool downloadToFile) { m_downloadToFile = downloadToF ile; } |
| 200 | 206 |
| 201 // Extra data associated with this request. | 207 // Extra data associated with this request. |
| 202 ExtraData* extraData() const { return m_extraData.get(); } | 208 ExtraData* extraData() const { return m_extraData.get(); } |
| 203 void setExtraData(PassRefPtr<ExtraData> extraData) { m_extraData = extraData ; } | 209 void setExtraData(PassRefPtr<ExtraData> extraData) { m_extraData = extraData ; } |
| 204 | 210 |
| 205 // What this request is for. | 211 RequestContext requestContext() const { return m_requestContext; } |
| 206 TargetType targetType() const { return m_targetType; } | 212 void setRequestContext(RequestContext context) { m_requestContext = context; } |
| 207 void setTargetType(TargetType type) { m_targetType = type; } | |
| 208 | 213 |
| 209 bool cacheControlContainsNoCache() const; | 214 bool cacheControlContainsNoCache() const; |
| 210 bool cacheControlContainsNoStore() const; | 215 bool cacheControlContainsNoStore() const; |
| 211 bool hasCacheValidatorFields() const; | 216 bool hasCacheValidatorFields() const; |
| 212 | 217 |
| 213 static double defaultTimeoutInterval(); // May return 0 when using platform default. | 218 static double defaultTimeoutInterval(); // May return 0 when using platform default. |
| 214 static void setDefaultTimeoutInterval(double); | 219 static void setDefaultTimeoutInterval(double); |
| 215 | 220 |
| 216 static bool compare(const ResourceRequest&, const ResourceRequest&); | 221 static bool compare(const ResourceRequest&, const ResourceRequest&); |
| 217 | 222 |
| (...skipping 13 matching lines...) Expand all Loading... | |
| 231 bool m_reportUploadProgress : 1; | 236 bool m_reportUploadProgress : 1; |
| 232 bool m_reportRawHeaders : 1; | 237 bool m_reportRawHeaders : 1; |
| 233 bool m_hasUserGesture : 1; | 238 bool m_hasUserGesture : 1; |
| 234 bool m_downloadToFile : 1; | 239 bool m_downloadToFile : 1; |
| 235 ResourceLoadPriority m_priority; | 240 ResourceLoadPriority m_priority; |
| 236 int m_intraPriorityValue; | 241 int m_intraPriorityValue; |
| 237 int m_requestorID; | 242 int m_requestorID; |
| 238 int m_requestorProcessID; | 243 int m_requestorProcessID; |
| 239 int m_appCacheHostID; | 244 int m_appCacheHostID; |
| 240 RefPtr<ExtraData> m_extraData; | 245 RefPtr<ExtraData> m_extraData; |
| 241 TargetType m_targetType; | 246 RequestContext m_requestContext; |
| 242 ReferrerPolicy m_referrerPolicy; | 247 ReferrerPolicy m_referrerPolicy; |
| 243 | 248 |
| 244 mutable CacheControlHeader m_cacheControlHeaderCache; | 249 mutable CacheControlHeader m_cacheControlHeaderCache; |
| 245 | 250 |
| 246 static double s_defaultTimeoutInterval; | 251 static double s_defaultTimeoutInterval; |
| 247 }; | 252 }; |
| 248 | 253 |
| 249 bool equalIgnoringHeaderFields(const ResourceRequest&, const ResourceRequest&); | 254 bool equalIgnoringHeaderFields(const ResourceRequest&, const ResourceRequest&); |
| 250 | 255 |
| 251 inline bool operator==(const ResourceRequest& a, const ResourceRequest& b) { ret urn ResourceRequest::compare(a, b); } | 256 inline bool operator==(const ResourceRequest& a, const ResourceRequest& b) { ret urn ResourceRequest::compare(a, b); } |
| (...skipping 14 matching lines...) Expand all Loading... | |
| 266 RefPtr<FormData> m_httpBody; | 271 RefPtr<FormData> m_httpBody; |
| 267 bool m_allowStoredCredentials; | 272 bool m_allowStoredCredentials; |
| 268 bool m_reportUploadProgress; | 273 bool m_reportUploadProgress; |
| 269 bool m_hasUserGesture; | 274 bool m_hasUserGesture; |
| 270 bool m_downloadToFile; | 275 bool m_downloadToFile; |
| 271 ResourceLoadPriority m_priority; | 276 ResourceLoadPriority m_priority; |
| 272 int m_intraPriorityValue; | 277 int m_intraPriorityValue; |
| 273 int m_requestorID; | 278 int m_requestorID; |
| 274 int m_requestorProcessID; | 279 int m_requestorProcessID; |
| 275 int m_appCacheHostID; | 280 int m_appCacheHostID; |
| 276 ResourceRequest::TargetType m_targetType; | 281 ResourceRequest::RequestContext m_requestContext; |
| 277 ReferrerPolicy m_referrerPolicy; | 282 ReferrerPolicy m_referrerPolicy; |
| 278 }; | 283 }; |
| 279 | 284 |
| 280 unsigned initializeMaximumHTTPConnectionCountPerHost(); | 285 unsigned initializeMaximumHTTPConnectionCountPerHost(); |
| 281 | 286 |
| 282 } // namespace WebCore | 287 } // namespace WebCore |
| 283 | 288 |
| 284 #endif // ResourceRequest_h | 289 #endif // ResourceRequest_h |
| OLD | NEW |