| Index: Source/modules/serviceworkers/FetchResponseData.h
|
| diff --git a/Source/modules/serviceworkers/FetchResponseData.h b/Source/modules/serviceworkers/FetchResponseData.h
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..5aa588a95f90247d289b66c1d1a61e1af1b56e7c
|
| --- /dev/null
|
| +++ b/Source/modules/serviceworkers/FetchResponseData.h
|
| @@ -0,0 +1,66 @@
|
| +// Copyright 2014 The Chromium Authors. All rights reserved.
|
| +// Use of this source code is governed by a BSD-style license that can be
|
| +// found in the LICENSE file.
|
| +
|
| +#ifndef FetchResponseData_h
|
| +#define FetchResponseData_h
|
| +
|
| +#include "platform/weborigin/KURL.h"
|
| +#include "wtf/PassRefPtr.h"
|
| +#include "wtf/RefCounted.h"
|
| +#include "wtf/text/AtomicString.h"
|
| +
|
| +namespace blink { class WebServiceWorkerResponse; }
|
| +
|
| +namespace WebCore {
|
| +
|
| +class BlobDataHandle;
|
| +class FetchHeaderList;
|
| +
|
| +class FetchResponseData : public RefCounted<FetchResponseData> {
|
| + WTF_MAKE_NONCOPYABLE(FetchResponseData);
|
| +public:
|
| + // "A response has an associated type which is one of basic, CORS, default,
|
| + // error, and opaque. Unless stated otherwise, it is default."
|
| + enum Type { BasicType, CORSType, DefaultType, ErrorType, OpaqueType };
|
| + // "A response can have an associated termination reason which is one of
|
| + // end-user abort, fatal, and timeout."
|
| + enum TerminationReason { EndUserAbortTermination, FatalTermination, TimeoutTermination };
|
| +
|
| + static PassRefPtr<FetchResponseData> create();
|
| + static PassRefPtr<FetchResponseData> createNetworkErrorResponse();
|
| +
|
| + PassRefPtr<FetchResponseData> createBasicFilteredResponse();
|
| + PassRefPtr<FetchResponseData> createCORSFilteredResponse();
|
| + PassRefPtr<FetchResponseData> createOpaqueFilteredResponse();
|
| +
|
| + Type type() const { return m_type; }
|
| + const KURL& url() const { return m_url; }
|
| + unsigned short status() const { return m_status; }
|
| + AtomicString statusMessage() const { return m_statusMessage; }
|
| + FetchHeaderList* headerList() const { return m_headerList.get(); }
|
| + PassRefPtr<BlobDataHandle> blobDataHandle() const { return m_blobDataHandle; }
|
| +
|
| + void setURL(const KURL& url) { m_url = url; }
|
| + void setStatus(unsigned short status) { m_status = status; }
|
| + void setStatusMessage(AtomicString statusMessage) { m_statusMessage = statusMessage; }
|
| + void setBlobDataHandle(PassRefPtr<BlobDataHandle> blobDataHandle) { m_blobDataHandle = blobDataHandle; }
|
| +
|
| + void populateWebServiceWorkerResponse(blink::WebServiceWorkerResponse&);
|
| +
|
| +private:
|
| + FetchResponseData(Type, unsigned short, AtomicString);
|
| +
|
| + Type m_type;
|
| + OwnPtr<TerminationReason> m_terminationReason;
|
| + KURL m_url;
|
| + unsigned short m_status;
|
| + AtomicString m_statusMessage;
|
| + RefPtr<FetchHeaderList> m_headerList;
|
| + RefPtr<BlobDataHandle> m_blobDataHandle;
|
| + RefPtr<FetchResponseData> m_internalResponse;
|
| +};
|
| +
|
| +} // namespace WebCore
|
| +
|
| +#endif // FetchResponseData_h
|
|
|