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

Side by Side Diff: third_party/WebKit/Source/modules/fetch/FetchResponseData.h

Issue 1965013002: Implement headers attributes in ForeignFetchResponse (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: using instead of typedef Created 4 years, 7 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 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef FetchResponseData_h 5 #ifndef FetchResponseData_h
6 #define FetchResponseData_h 6 #define FetchResponseData_h
7 7
8 #include "core/fetch/CrossOriginAccessControl.h"
8 #include "modules/ModulesExport.h" 9 #include "modules/ModulesExport.h"
9 #include "platform/heap/Handle.h" 10 #include "platform/heap/Handle.h"
10 #include "platform/weborigin/KURL.h" 11 #include "platform/weborigin/KURL.h"
11 #include "public/platform/modules/serviceworker/WebServiceWorkerRequest.h" 12 #include "public/platform/modules/serviceworker/WebServiceWorkerRequest.h"
12 #include "wtf/PassRefPtr.h" 13 #include "wtf/PassRefPtr.h"
13 #include "wtf/text/AtomicString.h" 14 #include "wtf/text/AtomicString.h"
14 15
15 namespace blink { 16 namespace blink {
16 17
17 class BodyStreamBuffer; 18 class BodyStreamBuffer;
(...skipping 10 matching lines...) Expand all
28 enum Type { BasicType, CORSType, DefaultType, ErrorType, OpaqueType, OpaqueR edirectType }; 29 enum Type { BasicType, CORSType, DefaultType, ErrorType, OpaqueType, OpaqueR edirectType };
29 // "A response can have an associated termination reason which is one of 30 // "A response can have an associated termination reason which is one of
30 // end-user abort, fatal, and timeout." 31 // end-user abort, fatal, and timeout."
31 enum TerminationReason { EndUserAbortTermination, FatalTermination, TimeoutT ermination }; 32 enum TerminationReason { EndUserAbortTermination, FatalTermination, TimeoutT ermination };
32 33
33 static FetchResponseData* create(); 34 static FetchResponseData* create();
34 static FetchResponseData* createNetworkErrorResponse(); 35 static FetchResponseData* createNetworkErrorResponse();
35 static FetchResponseData* createWithBuffer(BodyStreamBuffer*); 36 static FetchResponseData* createWithBuffer(BodyStreamBuffer*);
36 37
37 FetchResponseData* createBasicFilteredResponse() const; 38 FetchResponseData* createBasicFilteredResponse() const;
39 // Creates a CORS filtered response, settings the response's cors exposed
40 // header names list to the result of parsing the Access-Control-Expose-Head ers
41 // header.
38 FetchResponseData* createCORSFilteredResponse() const; 42 FetchResponseData* createCORSFilteredResponse() const;
43 // Creates a CORS filtered response with an explicit set of exposed header
44 // names.
45 FetchResponseData* createCORSFilteredResponse(const HTTPHeaderSet& exposedHe aders) const;
39 FetchResponseData* createOpaqueFilteredResponse() const; 46 FetchResponseData* createOpaqueFilteredResponse() const;
40 FetchResponseData* createOpaqueRedirectFilteredResponse() const; 47 FetchResponseData* createOpaqueRedirectFilteredResponse() const;
41 48
42 FetchResponseData* internalResponse() { return m_internalResponse; } 49 FetchResponseData* internalResponse() { return m_internalResponse; }
43 const FetchResponseData* internalResponse() const { return m_internalRespons e; } 50 const FetchResponseData* internalResponse() const { return m_internalRespons e; }
44 51
45 FetchResponseData* clone(ScriptState*); 52 FetchResponseData* clone(ScriptState*);
46 53
47 Type getType() const { return m_type; } 54 Type getType() const { return m_type; }
48 const KURL& url() const { return m_url; } 55 const KURL& url() const { return m_url; }
49 unsigned short status() const { return m_status; } 56 unsigned short status() const { return m_status; }
50 AtomicString statusMessage() const { return m_statusMessage; } 57 AtomicString statusMessage() const { return m_statusMessage; }
51 FetchHeaderList* headerList() const { return m_headerList.get(); } 58 FetchHeaderList* headerList() const { return m_headerList.get(); }
52 BodyStreamBuffer* buffer() const { return m_buffer; } 59 BodyStreamBuffer* buffer() const { return m_buffer; }
53 String mimeType() const; 60 String mimeType() const;
54 BodyStreamBuffer* internalBuffer() const; 61 BodyStreamBuffer* internalBuffer() const;
55 String internalMIMEType() const; 62 String internalMIMEType() const;
56 int64_t responseTime() const { return m_responseTime; } 63 int64_t responseTime() const { return m_responseTime; }
57 String cacheStorageCacheName() const { return m_cacheStorageCacheName; } 64 String cacheStorageCacheName() const { return m_cacheStorageCacheName; }
65 const HTTPHeaderSet& corsExposedHeaderNames() const { return m_corsExposedHe aderNames; }
58 66
59 void setURL(const KURL& url) { m_url = url; } 67 void setURL(const KURL& url) { m_url = url; }
60 void setStatus(unsigned short status) { m_status = status; } 68 void setStatus(unsigned short status) { m_status = status; }
61 void setStatusMessage(AtomicString statusMessage) { m_statusMessage = status Message; } 69 void setStatusMessage(AtomicString statusMessage) { m_statusMessage = status Message; }
62 void setMIMEType(const String& type) { m_mimeType = type; } 70 void setMIMEType(const String& type) { m_mimeType = type; }
63 void setResponseTime(int64_t responseTime) { m_responseTime = responseTime; } 71 void setResponseTime(int64_t responseTime) { m_responseTime = responseTime; }
64 void setCacheStorageCacheName(const String& cacheStorageCacheName) { m_cache StorageCacheName = cacheStorageCacheName; } 72 void setCacheStorageCacheName(const String& cacheStorageCacheName) { m_cache StorageCacheName = cacheStorageCacheName; }
73 void setCorsExposedHeaderNames(const HTTPHeaderSet& headerNames) { m_corsExp osedHeaderNames = headerNames; }
65 74
66 // If the type is Default, replaces |m_buffer|. 75 // If the type is Default, replaces |m_buffer|.
67 // If the type is Basic or CORS, replaces |m_buffer| and 76 // If the type is Basic or CORS, replaces |m_buffer| and
68 // |m_internalResponse->m_buffer|. 77 // |m_internalResponse->m_buffer|.
69 // If the type is Error or Opaque, does nothing. 78 // If the type is Error or Opaque, does nothing.
70 void replaceBodyStreamBuffer(BodyStreamBuffer*); 79 void replaceBodyStreamBuffer(BodyStreamBuffer*);
71 80
72 // Does not call response.setBlobDataHandle(). 81 // Does not call response.setBlobDataHandle().
73 void populateWebServiceWorkerResponse(WebServiceWorkerResponse& /* response */); 82 void populateWebServiceWorkerResponse(WebServiceWorkerResponse& /* response */);
74 83
75 DECLARE_TRACE(); 84 DECLARE_TRACE();
76 85
77 private: 86 private:
78 FetchResponseData(Type, unsigned short, AtomicString); 87 FetchResponseData(Type, unsigned short, AtomicString);
79 88
80 Type m_type; 89 Type m_type;
81 OwnPtr<TerminationReason> m_terminationReason; 90 OwnPtr<TerminationReason> m_terminationReason;
82 KURL m_url; 91 KURL m_url;
83 unsigned short m_status; 92 unsigned short m_status;
84 AtomicString m_statusMessage; 93 AtomicString m_statusMessage;
85 Member<FetchHeaderList> m_headerList; 94 Member<FetchHeaderList> m_headerList;
86 Member<FetchResponseData> m_internalResponse; 95 Member<FetchResponseData> m_internalResponse;
87 Member<BodyStreamBuffer> m_buffer; 96 Member<BodyStreamBuffer> m_buffer;
88 String m_mimeType; 97 String m_mimeType;
89 int64_t m_responseTime; 98 int64_t m_responseTime;
90 String m_cacheStorageCacheName; 99 String m_cacheStorageCacheName;
100 HTTPHeaderSet m_corsExposedHeaderNames;
91 }; 101 };
92 102
93 } // namespace blink 103 } // namespace blink
94 104
95 #endif // FetchResponseData_h 105 #endif // FetchResponseData_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698