| OLD | NEW |
| 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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 class ExceptionState; | 46 class ExceptionState; |
| 47 class ResourceRequest; | 47 class ResourceRequest; |
| 48 class SecurityOrigin; | 48 class SecurityOrigin; |
| 49 class SharedBuffer; | 49 class SharedBuffer; |
| 50 class Stream; | 50 class Stream; |
| 51 class TextResourceDecoder; | 51 class TextResourceDecoder; |
| 52 class ThreadableLoader; | 52 class ThreadableLoader; |
| 53 | 53 |
| 54 typedef int ExceptionCode; | 54 typedef int ExceptionCode; |
| 55 | 55 |
| 56 class XMLHttpRequest : public ScriptWrappable, public RefCounted<XMLHttpRequest>
, public XMLHttpRequestEventTarget, private ThreadableLoaderClient, public Activ
eDOMObject { | 56 class XMLHttpRequest FINAL : public ScriptWrappable, public RefCounted<XMLHttpRe
quest>, public XMLHttpRequestEventTarget, private ThreadableLoaderClient, public
ActiveDOMObject { |
| 57 WTF_MAKE_FAST_ALLOCATED; | 57 WTF_MAKE_FAST_ALLOCATED; |
| 58 REFCOUNTED_EVENT_TARGET(XMLHttpRequest); | 58 REFCOUNTED_EVENT_TARGET(XMLHttpRequest); |
| 59 public: | 59 public: |
| 60 static PassRefPtr<XMLHttpRequest> create(ExecutionContext*, PassRefPtr<Secur
ityOrigin> = 0); | 60 static PassRefPtr<XMLHttpRequest> create(ExecutionContext*, PassRefPtr<Secur
ityOrigin> = 0); |
| 61 ~XMLHttpRequest(); | 61 virtual ~XMLHttpRequest(); |
| 62 | 62 |
| 63 // These exact numeric values are important because JS expects them. | 63 // These exact numeric values are important because JS expects them. |
| 64 enum State { | 64 enum State { |
| 65 UNSENT = 0, | 65 UNSENT = 0, |
| 66 OPENED = 1, | 66 OPENED = 1, |
| 67 HEADERS_RECEIVED = 2, | 67 HEADERS_RECEIVED = 2, |
| 68 LOADING = 3, | 68 LOADING = 3, |
| 69 DONE = 4 | 69 DONE = 4 |
| 70 }; | 70 }; |
| 71 | 71 |
| 72 enum ResponseTypeCode { | 72 enum ResponseTypeCode { |
| 73 ResponseTypeDefault, | 73 ResponseTypeDefault, |
| 74 ResponseTypeText, | 74 ResponseTypeText, |
| 75 ResponseTypeJSON, | 75 ResponseTypeJSON, |
| 76 ResponseTypeDocument, | 76 ResponseTypeDocument, |
| 77 ResponseTypeBlob, | 77 ResponseTypeBlob, |
| 78 ResponseTypeArrayBuffer, | 78 ResponseTypeArrayBuffer, |
| 79 ResponseTypeStream | 79 ResponseTypeStream |
| 80 }; | 80 }; |
| 81 | 81 |
| 82 enum DropProtection { | 82 enum DropProtection { |
| 83 DropProtectionSync, | 83 DropProtectionSync, |
| 84 DropProtectionAsync, | 84 DropProtectionAsync, |
| 85 }; | 85 }; |
| 86 | 86 |
| 87 virtual void contextDestroyed(); | 87 virtual void contextDestroyed() OVERRIDE; |
| 88 virtual void suspend(); | 88 virtual void suspend() OVERRIDE; |
| 89 virtual void resume(); | 89 virtual void resume() OVERRIDE; |
| 90 virtual void stop(); | 90 virtual void stop() OVERRIDE; |
| 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() const; | 96 String statusText() const; |
| 97 int status() const; | 97 int status() 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&); |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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) OVERRIDE; |
| 153 virtual void didReceiveResponse(unsigned long identifier, const ResourceResp
onse&); | 153 virtual void didReceiveResponse(unsigned long identifier, const ResourceResp
onse&) OVERRIDE; |
| 154 virtual void didReceiveData(const char* data, int dataLength); | 154 virtual void didReceiveData(const char* data, int dataLength) OVERRIDE; |
| 155 // When "blob" is specified as the responseType attribute, didDownloadData | 155 // When "blob" is specified as the responseType attribute, didDownloadData |
| 156 // is called instead of didReceiveData. | 156 // is called instead of didReceiveData. |
| 157 virtual void didDownloadData(int dataLength); | 157 virtual void didDownloadData(int dataLength) OVERRIDE; |
| 158 virtual void didFinishLoading(unsigned long identifier, double finishTime); | 158 virtual void didFinishLoading(unsigned long identifier, double finishTime) O
VERRIDE; |
| 159 virtual void didFail(const ResourceError&); | 159 virtual void didFail(const ResourceError&) OVERRIDE; |
| 160 virtual void didFailRedirectCheck(); | 160 virtual void didFailRedirectCheck() OVERRIDE; |
| 161 | 161 |
| 162 AtomicString responseMIMEType() const; | 162 AtomicString responseMIMEType() const; |
| 163 bool responseIsXML() const; | 163 bool responseIsXML() const; |
| 164 | 164 |
| 165 bool areMethodAndURLValidForSend(); | 165 bool areMethodAndURLValidForSend(); |
| 166 | 166 |
| 167 bool initSend(ExceptionState&); | 167 bool initSend(ExceptionState&); |
| 168 void sendBytesData(const void*, size_t, ExceptionState&); | 168 void sendBytesData(const void*, size_t, ExceptionState&); |
| 169 | 169 |
| 170 const AtomicString& getRequestHeader(const AtomicString& name) const; | 170 const AtomicString& getRequestHeader(const AtomicString& name) const; |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 261 | 261 |
| 262 // An enum corresponding to the allowed string values for the responseType a
ttribute. | 262 // An enum corresponding to the allowed string values for the responseType a
ttribute. |
| 263 ResponseTypeCode m_responseTypeCode; | 263 ResponseTypeCode m_responseTypeCode; |
| 264 AsyncMethodRunner<XMLHttpRequest> m_dropProtectionRunner; | 264 AsyncMethodRunner<XMLHttpRequest> m_dropProtectionRunner; |
| 265 RefPtr<SecurityOrigin> m_securityOrigin; | 265 RefPtr<SecurityOrigin> m_securityOrigin; |
| 266 }; | 266 }; |
| 267 | 267 |
| 268 } // namespace WebCore | 268 } // namespace WebCore |
| 269 | 269 |
| 270 #endif // XMLHttpRequest_h | 270 #endif // XMLHttpRequest_h |
| OLD | NEW |