summaryrefslogtreecommitdiffstats
path: root/WebCore/xml/XMLHttpRequest.h
diff options
context:
space:
mode:
authorSteve Block <steveblock@google.com>2011-05-06 11:45:16 +0100
committerSteve Block <steveblock@google.com>2011-05-12 13:44:10 +0100
commitcad810f21b803229eb11403f9209855525a25d57 (patch)
tree29a6fd0279be608e0fe9ffe9841f722f0f4e4269 /WebCore/xml/XMLHttpRequest.h
parent121b0cf4517156d0ac5111caf9830c51b69bae8f (diff)
downloadexternal_webkit-cad810f21b803229eb11403f9209855525a25d57.zip
external_webkit-cad810f21b803229eb11403f9209855525a25d57.tar.gz
external_webkit-cad810f21b803229eb11403f9209855525a25d57.tar.bz2
Merge WebKit at r75315: Initial merge by git.
Change-Id: I570314b346ce101c935ed22a626b48c2af266b84
Diffstat (limited to 'WebCore/xml/XMLHttpRequest.h')
-rw-r--r--WebCore/xml/XMLHttpRequest.h237
1 files changed, 0 insertions, 237 deletions
diff --git a/WebCore/xml/XMLHttpRequest.h b/WebCore/xml/XMLHttpRequest.h
deleted file mode 100644
index bc6815d..0000000
--- a/WebCore/xml/XMLHttpRequest.h
+++ /dev/null
@@ -1,237 +0,0 @@
-/*
- * Copyright (C) 2003, 2006, 2008 Apple Inc. All rights reserved.
- * Copyright (C) 2005, 2006 Alexey Proskuryakov <ap@nypop.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef XMLHttpRequest_h
-#define XMLHttpRequest_h
-
-#include "ActiveDOMObject.h"
-#include "EventListener.h"
-#include "EventNames.h"
-#include "EventTarget.h"
-#include "FormData.h"
-#include "ResourceResponse.h"
-#include "ThreadableLoaderClient.h"
-#include "XMLHttpRequestProgressEventThrottle.h"
-#include <wtf/OwnPtr.h>
-#include <wtf/text/AtomicStringHash.h>
-#include <wtf/text/StringBuilder.h>
-
-namespace WebCore {
-
-class ArrayBuffer;
-class Blob;
-class Document;
-class DOMFormData;
-class ResourceRequest;
-class SharedBuffer;
-class TextResourceDecoder;
-class ThreadableLoader;
-
-class XMLHttpRequest : public RefCounted<XMLHttpRequest>, public EventTarget, private ThreadableLoaderClient, public ActiveDOMObject {
-public:
- static PassRefPtr<XMLHttpRequest> create(ScriptExecutionContext* context) { return adoptRef(new XMLHttpRequest(context)); }
- ~XMLHttpRequest();
-
- // These exact numeric values are important because JS expects them.
- enum State {
- UNSENT = 0,
- OPENED = 1,
- HEADERS_RECEIVED = 2,
- LOADING = 3,
- DONE = 4
- };
-
- enum ResponseTypeCode {
- ResponseTypeDefault,
- ResponseTypeText,
- ResponseTypeDocument,
- ResponseTypeBlob,
- ResponseTypeArrayBuffer
- };
-
- virtual XMLHttpRequest* toXMLHttpRequest() { return this; }
-
- virtual void contextDestroyed();
- virtual bool canSuspend() const;
- virtual void suspend(ReasonForSuspension);
- virtual void resume();
- virtual void stop();
-
- virtual ScriptExecutionContext* scriptExecutionContext() const;
-
- const KURL& url() const { return m_url; }
- String statusText(ExceptionCode&) const;
- int status(ExceptionCode&) const;
- State readyState() const;
- bool withCredentials() const { return m_includeCredentials; }
- void setWithCredentials(bool, ExceptionCode&);
-#if ENABLE(XHR_RESPONSE_BLOB)
- bool asBlob() const { return responseTypeCode() == ResponseTypeBlob; }
- void setAsBlob(bool, ExceptionCode&);
-#endif
- void open(const String& method, const KURL&, ExceptionCode&);
- void open(const String& method, const KURL&, bool async, ExceptionCode&);
- void open(const String& method, const KURL&, bool async, const String& user, ExceptionCode&);
- void open(const String& method, const KURL&, bool async, const String& user, const String& password, ExceptionCode&);
- void send(ExceptionCode&);
- void send(Document*, ExceptionCode&);
- void send(const String&, ExceptionCode&);
- void send(Blob*, ExceptionCode&);
- void send(DOMFormData*, ExceptionCode&);
-#if ENABLE(3D_CANVAS) || ENABLE(BLOB)
- void send(ArrayBuffer*, ExceptionCode&);
-#endif
- void abort();
- void setRequestHeader(const AtomicString& name, const String& value, ExceptionCode&);
- void overrideMimeType(const String& override);
- String getAllResponseHeaders(ExceptionCode&) const;
- String getResponseHeader(const AtomicString& name, ExceptionCode&) const;
- String responseText(ExceptionCode&);
- Document* responseXML(ExceptionCode&);
- Document* optionalResponseXML() const { return m_responseXML.get(); }
-#if ENABLE(XHR_RESPONSE_BLOB)
- Blob* responseBlob(ExceptionCode&) const;
- Blob* optionalResponseBlob() const { return m_responseBlob.get(); }
-#endif
-
- void setResponseType(const String&, ExceptionCode&);
- String responseType();
- ResponseTypeCode responseTypeCode() const { return m_responseTypeCode; }
-
-#if ENABLE(3D_CANVAS) || ENABLE(BLOB)
- // response attribute has custom getter.
- ArrayBuffer* responseArrayBuffer(ExceptionCode&);
- ArrayBuffer* optionalResponseArrayBuffer() const { return m_responseArrayBuffer.get(); }
-#endif
-
- void setLastSendLineNumber(unsigned lineNumber) { m_lastSendLineNumber = lineNumber; }
- void setLastSendURL(const String& url) { m_lastSendURL = url; }
-
- XMLHttpRequestUpload* upload();
- XMLHttpRequestUpload* optionalUpload() const { return m_upload.get(); }
-
- DEFINE_ATTRIBUTE_EVENT_LISTENER(readystatechange);
- DEFINE_ATTRIBUTE_EVENT_LISTENER(abort);
- DEFINE_ATTRIBUTE_EVENT_LISTENER(error);
- DEFINE_ATTRIBUTE_EVENT_LISTENER(load);
- DEFINE_ATTRIBUTE_EVENT_LISTENER(loadstart);
- DEFINE_ATTRIBUTE_EVENT_LISTENER(progress);
-
- using RefCounted<XMLHttpRequest>::ref;
- using RefCounted<XMLHttpRequest>::deref;
-
-private:
- XMLHttpRequest(ScriptExecutionContext*);
-
- virtual void refEventTarget() { ref(); }
- virtual void derefEventTarget() { deref(); }
- virtual EventTargetData* eventTargetData();
- virtual EventTargetData* ensureEventTargetData();
-
- Document* document() const;
-
-#if ENABLE(DASHBOARD_SUPPORT)
- bool usesDashboardBackwardCompatibilityMode() const;
-#endif
-
- virtual void didSendData(unsigned long long bytesSent, unsigned long long totalBytesToBeSent);
- virtual void didReceiveResponse(const ResourceResponse&);
- virtual void didReceiveData(const char* data, int lengthReceived);
- virtual void didFinishLoading(unsigned long identifier);
- virtual void didFail(const ResourceError&);
- virtual void didFailRedirectCheck();
- virtual void didReceiveAuthenticationCancellation(const ResourceResponse&);
-
- String responseMIMEType() const;
- bool responseIsXML() const;
-
- bool initSend(ExceptionCode&);
-
- String getRequestHeader(const AtomicString& name) const;
- void setRequestHeaderInternal(const AtomicString& name, const String& value);
- bool isSafeRequestHeader(const String&) const;
-
- void changeState(State newState);
- void callReadyStateChangeListener();
- void dropProtection();
- void internalAbort();
- void clearResponse();
- void clearRequest();
-
- void createRequest(ExceptionCode&);
-
- void genericError();
- void networkError();
- void abortError();
-
- RefPtr<XMLHttpRequestUpload> m_upload;
-
- KURL m_url;
- String m_method;
- HTTPHeaderMap m_requestHeaders;
- RefPtr<FormData> m_requestEntityBody;
- String m_mimeTypeOverride;
- bool m_async;
- bool m_includeCredentials;
-#if ENABLE(XHR_RESPONSE_BLOB)
- RefPtr<Blob> m_responseBlob;
-#endif
-
- RefPtr<ThreadableLoader> m_loader;
- State m_state;
-
- ResourceResponse m_response;
- String m_responseEncoding;
-
- RefPtr<TextResourceDecoder> m_decoder;
-
- StringBuilder m_responseBuilder;
- mutable bool m_createdDocument;
- mutable RefPtr<Document> m_responseXML;
-
-#if ENABLE(3D_CANVAS) || ENABLE(BLOB)
- RefPtr<SharedBuffer> m_binaryResponseBuilder;
- mutable RefPtr<ArrayBuffer> m_responseArrayBuffer;
-#endif
-
- bool m_error;
-
- bool m_uploadEventsAllowed;
- bool m_uploadComplete;
-
- bool m_sameOriginRequest;
-
- // Used for onprogress tracking
- long long m_receivedLength;
-
- unsigned m_lastSendLineNumber;
- String m_lastSendURL;
- ExceptionCode m_exceptionCode;
-
- EventTargetData m_eventTargetData;
-
- XMLHttpRequestProgressEventThrottle m_progressEventThrottle;
-
- // An enum corresponding to the allowed string values for the responseType attribute.
- ResponseTypeCode m_responseTypeCode;
-};
-
-} // namespace WebCore
-
-#endif // XMLHttpRequest_h