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 Headers_h | 5 #ifndef Headers_h |
6 #define Headers_h | 6 #define Headers_h |
7 | 7 |
8 #include "bindings/core/v8/Iterable.h" | 8 #include "bindings/core/v8/Iterable.h" |
9 #include "bindings/core/v8/ScriptState.h" | 9 #include "bindings/core/v8/ScriptState.h" |
10 #include "bindings/core/v8/ScriptWrappable.h" | 10 #include "bindings/core/v8/ScriptWrappable.h" |
11 #include "modules/ModulesExport.h" | 11 #include "modules/ModulesExport.h" |
12 #include "modules/fetch/FetchHeaderList.h" | 12 #include "modules/fetch/FetchHeaderList.h" |
13 #include "wtf/Forward.h" | 13 #include "wtf/Forward.h" |
14 | 14 |
15 namespace blink { | 15 namespace blink { |
16 | 16 |
| 17 class ByteStringSequenceSequenceOrDictionaryOrHeaders; |
17 class Dictionary; | 18 class Dictionary; |
18 class ExceptionState; | 19 class ExceptionState; |
19 | 20 |
20 // http://fetch.spec.whatwg.org/#headers-class | 21 // http://fetch.spec.whatwg.org/#headers-class |
21 class MODULES_EXPORT Headers final : public GarbageCollected<Headers>, | 22 class MODULES_EXPORT Headers final : public GarbageCollected<Headers>, |
22 public ScriptWrappable, | 23 public ScriptWrappable, |
23 public PairIterable<String, String> { | 24 public PairIterable<String, String> { |
24 DEFINE_WRAPPERTYPEINFO(); | 25 DEFINE_WRAPPERTYPEINFO(); |
25 | 26 |
26 public: | 27 public: |
27 enum Guard { | 28 enum Guard { |
28 ImmutableGuard, | 29 ImmutableGuard, |
29 RequestGuard, | 30 RequestGuard, |
30 RequestNoCORSGuard, | 31 RequestNoCORSGuard, |
31 ResponseGuard, | 32 ResponseGuard, |
32 NoneGuard | 33 NoneGuard |
33 }; | 34 }; |
34 | 35 |
35 static Headers* create(); | |
36 static Headers* create(ExceptionState&); | 36 static Headers* create(ExceptionState&); |
37 static Headers* create(const Headers*, ExceptionState&); | 37 static Headers* create(const ByteStringSequenceSequenceOrDictionaryOrHeaders&, |
38 static Headers* create(const Vector<Vector<String>>&, ExceptionState&); | 38 ExceptionState&); |
39 static Headers* create(const Dictionary&, ExceptionState&); | |
40 | 39 |
41 // Shares the FetchHeaderList. Called when creating a Request or Response. | 40 // Shares the FetchHeaderList. Called when creating a Request or Response. |
42 static Headers* create(FetchHeaderList*); | 41 static Headers* create(FetchHeaderList*); |
43 | 42 |
44 Headers* clone() const; | 43 Headers* clone() const; |
45 | 44 |
46 // Headers.idl implementation. | 45 // Headers.idl implementation. |
47 void append(const String& name, const String& value, ExceptionState&); | 46 void append(const String& name, const String& value, ExceptionState&); |
48 void remove(const String& key, ExceptionState&); | 47 void remove(const String& key, ExceptionState&); |
49 String get(const String& key, ExceptionState&); | 48 String get(const String& key, ExceptionState&); |
(...skipping 19 matching lines...) Expand all Loading... |
69 | 68 |
70 Member<FetchHeaderList> m_headerList; | 69 Member<FetchHeaderList> m_headerList; |
71 Guard m_guard; | 70 Guard m_guard; |
72 | 71 |
73 IterationSource* startIteration(ScriptState*, ExceptionState&) override; | 72 IterationSource* startIteration(ScriptState*, ExceptionState&) override; |
74 }; | 73 }; |
75 | 74 |
76 } // namespace blink | 75 } // namespace blink |
77 | 76 |
78 #endif // Headers_h | 77 #endif // Headers_h |
OLD | NEW |