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

Side by Side Diff: Source/core/xml/XMLHttpRequest.h

Issue 99733002: Update HTTPHeaderMap wrappers to use AtomicString type for header values (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rebase on master Created 7 years 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
« no previous file with comments | « Source/core/loader/FrameLoader.cpp ('k') | Source/core/xml/XMLHttpRequest.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, 2008 Apple Inc. All rights reserved. 2 * Copyright (C) 2003, 2006, 2008 Apple Inc. All rights reserved.
3 * Copyright (C) 2005, 2006 Alexey Proskuryakov <ap@nypop.com> 3 * Copyright (C) 2005, 2006 Alexey Proskuryakov <ap@nypop.com>
4 * Copyright (C) 2011 Google Inc. All rights reserved. 4 * Copyright (C) 2011 Google Inc. All rights reserved.
5 * Copyright (C) 2012 Intel Corporation 5 * Copyright (C) 2012 Intel Corporation
6 * 6 *
7 * This library is free software; you can redistribute it and/or 7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public 8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either 9 * License as published by the Free Software Foundation; either
10 * version 2 of the License, or (at your option) any later version. 10 * version 2 of the License, or (at your option) any later version.
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 91
92 virtual const AtomicString& interfaceName() const OVERRIDE; 92 virtual const AtomicString& interfaceName() const OVERRIDE;
93 virtual ExecutionContext* executionContext() const OVERRIDE; 93 virtual ExecutionContext* executionContext() const OVERRIDE;
94 94
95 const KURL& url() const { return m_url; } 95 const KURL& url() const { return m_url; }
96 String statusText(ExceptionState&) const; 96 String statusText(ExceptionState&) const;
97 int status(ExceptionState&) const; 97 int status(ExceptionState&) const;
98 State readyState() const; 98 State readyState() const;
99 bool withCredentials() const { return m_includeCredentials; } 99 bool withCredentials() const { return m_includeCredentials; }
100 void setWithCredentials(bool, ExceptionState&); 100 void setWithCredentials(bool, ExceptionState&);
101 void open(const String& method, const KURL&, ExceptionState&); 101 void open(const AtomicString& method, const KURL&, ExceptionState&);
102 void open(const String& method, const KURL&, bool async, ExceptionState&); 102 void open(const AtomicString& method, const KURL&, bool async, ExceptionStat e&);
103 void open(const String& method, const KURL&, bool async, const String& user, ExceptionState&); 103 void open(const AtomicString& method, const KURL&, bool async, const String& user, ExceptionState&);
104 void open(const String& method, const KURL&, bool async, const String& user, const String& password, ExceptionState&); 104 void open(const AtomicString& method, const KURL&, bool async, const String& user, const String& password, ExceptionState&);
105 void send(ExceptionState&); 105 void send(ExceptionState&);
106 void send(Document*, ExceptionState&); 106 void send(Document*, ExceptionState&);
107 void send(const String&, ExceptionState&); 107 void send(const String&, ExceptionState&);
108 void send(Blob*, ExceptionState&); 108 void send(Blob*, ExceptionState&);
109 void send(DOMFormData*, ExceptionState&); 109 void send(DOMFormData*, ExceptionState&);
110 void send(ArrayBuffer*, ExceptionState&); 110 void send(ArrayBuffer*, ExceptionState&);
111 void send(ArrayBufferView*, ExceptionState&); 111 void send(ArrayBufferView*, ExceptionState&);
112 void abort(); 112 void abort();
113 void setRequestHeader(const AtomicString& name, const String& value, Excepti onState&); 113 void setRequestHeader(const AtomicString& name, const AtomicString& value, E xceptionState&);
114 void overrideMimeType(const String& override); 114 void overrideMimeType(const AtomicString& override);
115 String getAllResponseHeaders(ExceptionState&) const; 115 String getAllResponseHeaders(ExceptionState&) const;
116 String getResponseHeader(const AtomicString& name, ExceptionState&) const; 116 AtomicString getResponseHeader(const AtomicString& name, ExceptionState&) co nst;
117 ScriptString responseText(ExceptionState&); 117 ScriptString responseText(ExceptionState&);
118 ScriptString responseJSONSource(); 118 ScriptString responseJSONSource();
119 Document* responseXML(ExceptionState&); 119 Document* responseXML(ExceptionState&);
120 Blob* responseBlob(); 120 Blob* responseBlob();
121 Stream* responseStream(); 121 Stream* responseStream();
122 unsigned long timeout() const { return m_timeoutMilliseconds; } 122 unsigned long timeout() const { return m_timeoutMilliseconds; }
123 void setTimeout(unsigned long timeout, ExceptionState&); 123 void setTimeout(unsigned long timeout, ExceptionState&);
124 124
125 void sendForInspectorXHRReplay(PassRefPtr<FormData>, ExceptionState&); 125 void sendForInspectorXHRReplay(PassRefPtr<FormData>, ExceptionState&);
126 126
127 // Expose HTTP validation methods for other untrusted requests. 127 // Expose HTTP validation methods for other untrusted requests.
128 static bool isAllowedHTTPMethod(const String&); 128 static bool isAllowedHTTPMethod(const String&);
129 static String uppercaseKnownHTTPMethod(const String&); 129 static AtomicString uppercaseKnownHTTPMethod(const AtomicString&);
130 static bool isAllowedHTTPHeader(const String&); 130 static bool isAllowedHTTPHeader(const String&);
131 131
132 void setResponseType(const String&, ExceptionState&); 132 void setResponseType(const String&, ExceptionState&);
133 String responseType(); 133 String responseType();
134 ResponseTypeCode responseTypeCode() const { return m_responseTypeCode; } 134 ResponseTypeCode responseTypeCode() const { return m_responseTypeCode; }
135 135
136 // response attribute has custom getter. 136 // response attribute has custom getter.
137 ArrayBuffer* responseArrayBuffer(); 137 ArrayBuffer* responseArrayBuffer();
138 138
139 void setLastSendLineNumber(unsigned lineNumber) { m_lastSendLineNumber = lin eNumber; } 139 void setLastSendLineNumber(unsigned lineNumber) { m_lastSendLineNumber = lin eNumber; }
140 void setLastSendURL(const String& url) { m_lastSendURL = url; } 140 void setLastSendURL(const String& url) { m_lastSendURL = url; }
141 141
142 XMLHttpRequestUpload* upload(); 142 XMLHttpRequestUpload* upload();
143 143
144 DEFINE_ATTRIBUTE_EVENT_LISTENER(readystatechange); 144 DEFINE_ATTRIBUTE_EVENT_LISTENER(readystatechange);
145 145
146 private: 146 private:
147 XMLHttpRequest(ExecutionContext*, PassRefPtr<SecurityOrigin>); 147 XMLHttpRequest(ExecutionContext*, PassRefPtr<SecurityOrigin>);
148 148
149 Document* document() const; 149 Document* document() const;
150 SecurityOrigin* securityOrigin() const; 150 SecurityOrigin* securityOrigin() const;
151 151
152 virtual void didSendData(unsigned long long bytesSent, unsigned long long to talBytesToBeSent); 152 virtual void didSendData(unsigned long long bytesSent, unsigned long long to talBytesToBeSent);
153 virtual void didReceiveResponse(unsigned long identifier, const ResourceResp onse&); 153 virtual void didReceiveResponse(unsigned long identifier, const ResourceResp onse&);
154 virtual void didReceiveData(const char* data, int dataLength); 154 virtual void didReceiveData(const char* data, int dataLength);
155 virtual void didFinishLoading(unsigned long identifier, double finishTime); 155 virtual void didFinishLoading(unsigned long identifier, double finishTime);
156 virtual void didFail(const ResourceError&); 156 virtual void didFail(const ResourceError&);
157 virtual void didFailRedirectCheck(); 157 virtual void didFailRedirectCheck();
158 158
159 String responseMIMEType() const; 159 AtomicString responseMIMEType() const;
160 bool responseIsXML() const; 160 bool responseIsXML() const;
161 161
162 bool areMethodAndURLValidForSend(); 162 bool areMethodAndURLValidForSend();
163 163
164 bool initSend(ExceptionState&); 164 bool initSend(ExceptionState&);
165 void sendBytesData(const void*, size_t, ExceptionState&); 165 void sendBytesData(const void*, size_t, ExceptionState&);
166 166
167 String getRequestHeader(const AtomicString& name) const; 167 AtomicString getRequestHeader(const AtomicString& name) const;
168 void setRequestHeaderInternal(const AtomicString& name, const String& value) ; 168 void setRequestHeaderInternal(const AtomicString& name, const AtomicString& value);
169 169
170 // Changes m_state and dispatches a readyStateChange event if new m_state 170 // Changes m_state and dispatches a readyStateChange event if new m_state
171 // value is different from last one. 171 // value is different from last one.
172 void changeState(State newState); 172 void changeState(State newState);
173 void dispatchReadyStateChangeEvent(); 173 void dispatchReadyStateChangeEvent();
174 174
175 void dropProtectionSoon(); 175 void dropProtectionSoon();
176 void dropProtection(); 176 void dropProtection();
177 // Clears variables used only while the resource is being loaded. 177 // Clears variables used only while the resource is being loaded.
178 void clearVariablesForLoading(); 178 void clearVariablesForLoading();
(...skipping 22 matching lines...) Expand all
201 // Handles didFail() call triggered by m_loader->cancel(). 201 // Handles didFail() call triggered by m_loader->cancel().
202 void handleDidCancel(); 202 void handleDidCancel();
203 // Handles didFail() call for timeout. 203 // Handles didFail() call for timeout.
204 void handleDidTimeout(); 204 void handleDidTimeout();
205 205
206 void handleRequestError(ExceptionCode, const AtomicString&, long long, long long); 206 void handleRequestError(ExceptionCode, const AtomicString&, long long, long long);
207 207
208 OwnPtr<XMLHttpRequestUpload> m_upload; 208 OwnPtr<XMLHttpRequestUpload> m_upload;
209 209
210 KURL m_url; 210 KURL m_url;
211 String m_method; 211 AtomicString m_method;
212 HTTPHeaderMap m_requestHeaders; 212 HTTPHeaderMap m_requestHeaders;
213 RefPtr<FormData> m_requestEntityBody; 213 RefPtr<FormData> m_requestEntityBody;
214 String m_mimeTypeOverride; 214 AtomicString m_mimeTypeOverride;
215 bool m_async; 215 bool m_async;
216 bool m_includeCredentials; 216 bool m_includeCredentials;
217 unsigned long m_timeoutMilliseconds; 217 unsigned long m_timeoutMilliseconds;
218 RefPtr<Blob> m_responseBlob; 218 RefPtr<Blob> m_responseBlob;
219 RefPtr<Stream> m_responseStream; 219 RefPtr<Stream> m_responseStream;
220 220
221 RefPtr<ThreadableLoader> m_loader; 221 RefPtr<ThreadableLoader> m_loader;
222 State m_state; 222 State m_state;
223 223
224 ResourceResponse m_response; 224 ResourceResponse m_response;
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
256 256
257 // An enum corresponding to the allowed string values for the responseType a ttribute. 257 // An enum corresponding to the allowed string values for the responseType a ttribute.
258 ResponseTypeCode m_responseTypeCode; 258 ResponseTypeCode m_responseTypeCode;
259 AsyncMethodRunner<XMLHttpRequest> m_dropProtectionRunner; 259 AsyncMethodRunner<XMLHttpRequest> m_dropProtectionRunner;
260 RefPtr<SecurityOrigin> m_securityOrigin; 260 RefPtr<SecurityOrigin> m_securityOrigin;
261 }; 261 };
262 262
263 } // namespace WebCore 263 } // namespace WebCore
264 264
265 #endif // XMLHttpRequest_h 265 #endif // XMLHttpRequest_h
OLDNEW
« no previous file with comments | « Source/core/loader/FrameLoader.cpp ('k') | Source/core/xml/XMLHttpRequest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698