OLD | NEW |
(Empty) | |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef FetchFormDataConsumerHandle_h |
| 6 #define FetchFormDataConsumerHandle_h |
| 7 |
| 8 #include "modules/ModulesExport.h" |
| 9 #include "modules/fetch/FetchBlobDataConsumerHandle.h" |
| 10 #include "modules/fetch/FetchDataConsumerHandle.h" |
| 11 #include "wtf/Forward.h" |
| 12 #include "wtf/PassOwnPtr.h" |
| 13 #include "wtf/PassRefPtr.h" |
| 14 #include "wtf/RefPtr.h" |
| 15 |
| 16 namespace blink { |
| 17 |
| 18 class DOMArrayBuffer; |
| 19 class ExecutionContext; |
| 20 class FormData; |
| 21 |
| 22 // FetchFormDataConsumerHandle is a handle made from a FormData. It provides |
| 23 // drainAsFormData in the associated Reader. |
| 24 class MODULES_EXPORT FetchFormDataConsumerHandle final : public FetchDataConsume
rHandle { |
| 25 WTF_MAKE_NONCOPYABLE(FetchFormDataConsumerHandle); |
| 26 public: |
| 27 static PassOwnPtr<FetchDataConsumerHandle> create(const String& body) { retu
rn adoptPtr(new FetchFormDataConsumerHandle(body)); } |
| 28 static PassOwnPtr<FetchDataConsumerHandle> create(PassRefPtr<DOMArrayBuffer>
body) { return adoptPtr(new FetchFormDataConsumerHandle(body)); } |
| 29 static PassOwnPtr<FetchDataConsumerHandle> create(ExecutionContext* executio
nContext, PassRefPtr<FormData> body) { return adoptPtr(new FetchFormDataConsumer
Handle(executionContext, body)); } |
| 30 // Use FetchBlobDataConsumerHandle for blobs. |
| 31 |
| 32 ~FetchFormDataConsumerHandle() override; |
| 33 |
| 34 static PassOwnPtr<FetchDataConsumerHandle> createForTest(ExecutionContext* e
xecutionContext, |
| 35 PassRefPtr<FormData> body, |
| 36 FetchBlobDataConsumerHandle::LoaderFactory* loaderFactory) |
| 37 { |
| 38 return adoptPtr(new FetchFormDataConsumerHandle(executionContext, body,
loaderFactory)); |
| 39 } |
| 40 |
| 41 private: |
| 42 class Context; |
| 43 class ReaderImpl; |
| 44 explicit FetchFormDataConsumerHandle(const String& body); |
| 45 explicit FetchFormDataConsumerHandle(const PassRefPtr<DOMArrayBuffer> body); |
| 46 FetchFormDataConsumerHandle(ExecutionContext*, const PassRefPtr<FormData> bo
dy, FetchBlobDataConsumerHandle::LoaderFactory* = nullptr); |
| 47 |
| 48 Reader* obtainReaderInternal(Client*) override; |
| 49 |
| 50 const char* debugName() const override { return "FetchFormDataConsumerHandle
"; } |
| 51 |
| 52 RefPtr<Context> m_context; |
| 53 }; |
| 54 |
| 55 } // namespace blink |
| 56 |
| 57 #endif // FetchFormDataConsumerHandle_h |
OLD | NEW |