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

Side by Side Diff: Source/platform/network/ResourceRequest.h

Issue 360233005: Replace 'ResourceRequest::TargetType' with 'ResourceRequest::RequestContext'. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Uninitialized === crash. :( Created 6 years, 5 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/platform/exported/WebURLRequest.cpp ('k') | Source/platform/network/ResourceRequest.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) 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 16 matching lines...) Expand all
27 27
28 #ifndef ResourceRequest_h 28 #ifndef ResourceRequest_h
29 #define ResourceRequest_h 29 #define ResourceRequest_h
30 30
31 #include "platform/network/FormData.h" 31 #include "platform/network/FormData.h"
32 #include "platform/network/HTTPHeaderMap.h" 32 #include "platform/network/HTTPHeaderMap.h"
33 #include "platform/network/HTTPParsers.h" 33 #include "platform/network/HTTPParsers.h"
34 #include "platform/network/ResourceLoadPriority.h" 34 #include "platform/network/ResourceLoadPriority.h"
35 #include "platform/weborigin/KURL.h" 35 #include "platform/weborigin/KURL.h"
36 #include "platform/weborigin/Referrer.h" 36 #include "platform/weborigin/Referrer.h"
37 #include "public/platform/WebURLRequest.h"
37 #include "wtf/OwnPtr.h" 38 #include "wtf/OwnPtr.h"
38 39
39 namespace WebCore { 40 namespace WebCore {
40 41
41 enum ResourceRequestCachePolicy { 42 enum ResourceRequestCachePolicy {
42 UseProtocolCachePolicy, // normal load 43 UseProtocolCachePolicy, // normal load
43 ReloadIgnoringCacheData, // reload 44 ReloadIgnoringCacheData, // reload
44 ReturnCacheDataElseLoad, // back/forward or encoding change - allow stale da ta 45 ReturnCacheDataElseLoad, // back/forward or encoding change - allow stale da ta
45 ReturnCacheDataDontLoad, // results of a post - allow stale data and only us e cache 46 ReturnCacheDataDontLoad, // results of a post - allow stale data and only us e cache
46 ReloadBypassingCache, // end-to-end reload 47 ReloadBypassingCache, // end-to-end reload
47 }; 48 };
48 49
49 struct CrossThreadResourceRequestData; 50 struct CrossThreadResourceRequestData;
50 51
51 class PLATFORM_EXPORT ResourceRequest { 52 class PLATFORM_EXPORT ResourceRequest {
52 WTF_MAKE_FAST_ALLOCATED; 53 WTF_MAKE_FAST_ALLOCATED;
53 public: 54 public:
54 // The type of this ResourceRequest, based on how the resource will be used.
55 enum TargetType {
56 TargetIsMainFrame,
57 TargetIsSubframe,
58 TargetIsSubresource, // Resource is a generic subresource. (Generally a specific type should be specified)
59 TargetIsStyleSheet,
60 TargetIsScript,
61 TargetIsFont,
62 TargetIsImage,
63 TargetIsObject,
64 TargetIsMedia,
65 TargetIsWorker,
66 TargetIsSharedWorker,
67 TargetIsPrefetch,
68 TargetIsFavicon,
69 TargetIsXHR,
70 TargetIsTextTrack,
71 TargetIsPing,
72 TargetIsServiceWorker,
73 TargetIsUnspecified,
74 };
75
76 class ExtraData : public RefCounted<ExtraData> { 55 class ExtraData : public RefCounted<ExtraData> {
77 public: 56 public:
78 virtual ~ExtraData() { } 57 virtual ~ExtraData() { }
79 }; 58 };
80 59
81 ResourceRequest() 60 ResourceRequest()
82 { 61 {
83 initialize(KURL(), UseProtocolCachePolicy); 62 initialize(KURL(), UseProtocolCachePolicy);
84 } 63 }
85 64
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
195 void setHasUserGesture(bool hasUserGesture) { m_hasUserGesture = hasUserGest ure; } 174 void setHasUserGesture(bool hasUserGesture) { m_hasUserGesture = hasUserGest ure; }
196 175
197 // True if request should be downloaded to file. 176 // True if request should be downloaded to file.
198 bool downloadToFile() const { return m_downloadToFile; } 177 bool downloadToFile() const { return m_downloadToFile; }
199 void setDownloadToFile(bool downloadToFile) { m_downloadToFile = downloadToF ile; } 178 void setDownloadToFile(bool downloadToFile) { m_downloadToFile = downloadToF ile; }
200 179
201 // Extra data associated with this request. 180 // Extra data associated with this request.
202 ExtraData* extraData() const { return m_extraData.get(); } 181 ExtraData* extraData() const { return m_extraData.get(); }
203 void setExtraData(PassRefPtr<ExtraData> extraData) { m_extraData = extraData ; } 182 void setExtraData(PassRefPtr<ExtraData> extraData) { m_extraData = extraData ; }
204 183
205 // What this request is for. 184 blink::WebURLRequest::RequestContext requestContext() const { return m_reque stContext; }
206 TargetType targetType() const { return m_targetType; } 185 void setRequestContext(blink::WebURLRequest::RequestContext context) { m_req uestContext = context; }
207 void setTargetType(TargetType type) { m_targetType = type; }
208 186
209 bool cacheControlContainsNoCache() const; 187 bool cacheControlContainsNoCache() const;
210 bool cacheControlContainsNoStore() const; 188 bool cacheControlContainsNoStore() const;
211 bool hasCacheValidatorFields() const; 189 bool hasCacheValidatorFields() const;
212 190
213 static double defaultTimeoutInterval(); // May return 0 when using platform default. 191 static double defaultTimeoutInterval(); // May return 0 when using platform default.
214 static void setDefaultTimeoutInterval(double); 192 static void setDefaultTimeoutInterval(double);
215 193
216 static bool compare(const ResourceRequest&, const ResourceRequest&); 194 static bool compare(const ResourceRequest&, const ResourceRequest&);
217 195
(...skipping 13 matching lines...) Expand all
231 bool m_reportUploadProgress : 1; 209 bool m_reportUploadProgress : 1;
232 bool m_reportRawHeaders : 1; 210 bool m_reportRawHeaders : 1;
233 bool m_hasUserGesture : 1; 211 bool m_hasUserGesture : 1;
234 bool m_downloadToFile : 1; 212 bool m_downloadToFile : 1;
235 ResourceLoadPriority m_priority; 213 ResourceLoadPriority m_priority;
236 int m_intraPriorityValue; 214 int m_intraPriorityValue;
237 int m_requestorID; 215 int m_requestorID;
238 int m_requestorProcessID; 216 int m_requestorProcessID;
239 int m_appCacheHostID; 217 int m_appCacheHostID;
240 RefPtr<ExtraData> m_extraData; 218 RefPtr<ExtraData> m_extraData;
241 TargetType m_targetType; 219 blink::WebURLRequest::RequestContext m_requestContext;
242 ReferrerPolicy m_referrerPolicy; 220 ReferrerPolicy m_referrerPolicy;
243 221
244 mutable CacheControlHeader m_cacheControlHeaderCache; 222 mutable CacheControlHeader m_cacheControlHeaderCache;
245 223
246 static double s_defaultTimeoutInterval; 224 static double s_defaultTimeoutInterval;
247 }; 225 };
248 226
249 bool equalIgnoringHeaderFields(const ResourceRequest&, const ResourceRequest&); 227 bool equalIgnoringHeaderFields(const ResourceRequest&, const ResourceRequest&);
250 228
251 inline bool operator==(const ResourceRequest& a, const ResourceRequest& b) { ret urn ResourceRequest::compare(a, b); } 229 inline bool operator==(const ResourceRequest& a, const ResourceRequest& b) { ret urn ResourceRequest::compare(a, b); }
(...skipping 14 matching lines...) Expand all
266 RefPtr<FormData> m_httpBody; 244 RefPtr<FormData> m_httpBody;
267 bool m_allowStoredCredentials; 245 bool m_allowStoredCredentials;
268 bool m_reportUploadProgress; 246 bool m_reportUploadProgress;
269 bool m_hasUserGesture; 247 bool m_hasUserGesture;
270 bool m_downloadToFile; 248 bool m_downloadToFile;
271 ResourceLoadPriority m_priority; 249 ResourceLoadPriority m_priority;
272 int m_intraPriorityValue; 250 int m_intraPriorityValue;
273 int m_requestorID; 251 int m_requestorID;
274 int m_requestorProcessID; 252 int m_requestorProcessID;
275 int m_appCacheHostID; 253 int m_appCacheHostID;
276 ResourceRequest::TargetType m_targetType; 254 blink::WebURLRequest::RequestContext m_requestContext;
277 ReferrerPolicy m_referrerPolicy; 255 ReferrerPolicy m_referrerPolicy;
278 }; 256 };
279 257
280 unsigned initializeMaximumHTTPConnectionCountPerHost(); 258 unsigned initializeMaximumHTTPConnectionCountPerHost();
281 259
282 } // namespace WebCore 260 } // namespace WebCore
283 261
284 #endif // ResourceRequest_h 262 #endif // ResourceRequest_h
OLDNEW
« no previous file with comments | « Source/platform/exported/WebURLRequest.cpp ('k') | Source/platform/network/ResourceRequest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698