| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef Body_h | 5 #ifndef Body_h |
| 6 #define Body_h | 6 #define Body_h |
| 7 | 7 |
| 8 #include "bindings/core/v8/ScriptPromise.h" | 8 #include "bindings/core/v8/ScriptPromise.h" |
| 9 #include "bindings/core/v8/ScriptValue.h" | 9 #include "bindings/core/v8/ScriptValue.h" |
| 10 #include "core/dom/ContextLifecycleObserver.h" | 10 #include "core/dom/ContextLifecycleObserver.h" |
| (...skipping 22 matching lines...) Expand all Loading... |
| 33 public ContextClient { | 33 public ContextClient { |
| 34 WTF_MAKE_NONCOPYABLE(Body); | 34 WTF_MAKE_NONCOPYABLE(Body); |
| 35 DEFINE_WRAPPERTYPEINFO(); | 35 DEFINE_WRAPPERTYPEINFO(); |
| 36 USING_GARBAGE_COLLECTED_MIXIN(Body); | 36 USING_GARBAGE_COLLECTED_MIXIN(Body); |
| 37 | 37 |
| 38 public: | 38 public: |
| 39 explicit Body(ExecutionContext*); | 39 explicit Body(ExecutionContext*); |
| 40 | 40 |
| 41 ScriptPromise arrayBuffer(ScriptState*); | 41 ScriptPromise arrayBuffer(ScriptState*); |
| 42 ScriptPromise blob(ScriptState*); | 42 ScriptPromise blob(ScriptState*); |
| 43 ScriptPromise FormData(ScriptState*); | 43 ScriptPromise formData(ScriptState*); |
| 44 ScriptPromise json(ScriptState*); | 44 ScriptPromise json(ScriptState*); |
| 45 ScriptPromise text(ScriptState*); | 45 ScriptPromise text(ScriptState*); |
| 46 ScriptValue body(ScriptState*); | 46 ScriptValue body(ScriptState*); |
| 47 virtual BodyStreamBuffer* BodyBuffer() = 0; | 47 virtual BodyStreamBuffer* BodyBuffer() = 0; |
| 48 virtual const BodyStreamBuffer* BodyBuffer() const = 0; | 48 virtual const BodyStreamBuffer* BodyBuffer() const = 0; |
| 49 | 49 |
| 50 virtual bool bodyUsed(); | 50 virtual bool bodyUsed(); |
| 51 bool IsBodyLocked(); | 51 bool IsBodyLocked(); |
| 52 | 52 |
| 53 // ScriptWrappable override. | 53 // ScriptWrappable override. |
| 54 bool HasPendingActivity() const override; | 54 bool HasPendingActivity() const override; |
| 55 | 55 |
| 56 DEFINE_INLINE_VIRTUAL_TRACE() { ContextClient::Trace(visitor); } | 56 DEFINE_INLINE_VIRTUAL_TRACE() { ContextClient::Trace(visitor); } |
| 57 | 57 |
| 58 private: | 58 private: |
| 59 // TODO(e_hakkinen): Fix |MimeType()| to always contain parameters and |
| 60 // remove |ContentType()|. |
| 61 virtual String ContentType() const = 0; |
| 59 virtual String MimeType() const = 0; | 62 virtual String MimeType() const = 0; |
| 60 | 63 |
| 61 // Body consumption algorithms will reject with a TypeError in a number of | 64 // Body consumption algorithms will reject with a TypeError in a number of |
| 62 // error conditions. This method wraps those up into one call which returns | 65 // error conditions. This method wraps those up into one call which returns |
| 63 // an empty ScriptPromise if the consumption may proceed, and a | 66 // an empty ScriptPromise if the consumption may proceed, and a |
| 64 // ScriptPromise rejected with a TypeError if it ought to be blocked. | 67 // ScriptPromise rejected with a TypeError if it ought to be blocked. |
| 65 ScriptPromise RejectInvalidConsumption(ScriptState*); | 68 ScriptPromise RejectInvalidConsumption(ScriptState*); |
| 66 }; | 69 }; |
| 67 | 70 |
| 68 } // namespace blink | 71 } // namespace blink |
| 69 | 72 |
| 70 #endif // Body_h | 73 #endif // Body_h |
| OLD | NEW |