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 FetchHeaderList_h | 5 #ifndef FetchHeaderList_h |
6 #define FetchHeaderList_h | 6 #define FetchHeaderList_h |
7 | 7 |
8 #include "modules/ModulesExport.h" | 8 #include "modules/ModulesExport.h" |
9 #include "platform/heap/Handle.h" | 9 #include "platform/heap/Handle.h" |
| 10 #include "wtf/OwnPtr.h" |
10 #include "wtf/PassRefPtr.h" | 11 #include "wtf/PassRefPtr.h" |
11 #include "wtf/Vector.h" | 12 #include "wtf/Vector.h" |
12 #include "wtf/text/WTFString.h" | 13 #include "wtf/text/WTFString.h" |
13 #include <memory> | |
14 #include <utility> | 14 #include <utility> |
15 | 15 |
16 namespace blink { | 16 namespace blink { |
17 | 17 |
18 class Header; | 18 class Header; |
19 | 19 |
20 // http://fetch.spec.whatwg.org/#terminology-headers | 20 // http://fetch.spec.whatwg.org/#terminology-headers |
21 class MODULES_EXPORT FetchHeaderList final : public GarbageCollectedFinalized<Fe
tchHeaderList> { | 21 class MODULES_EXPORT FetchHeaderList final : public GarbageCollectedFinalized<Fe
tchHeaderList> { |
22 public: | 22 public: |
23 typedef std::pair<String, String> Header; | 23 typedef std::pair<String, String> Header; |
24 static FetchHeaderList* create(); | 24 static FetchHeaderList* create(); |
25 FetchHeaderList* clone(); | 25 FetchHeaderList* clone(); |
26 | 26 |
27 ~FetchHeaderList(); | 27 ~FetchHeaderList(); |
28 void append(const String&, const String&); | 28 void append(const String&, const String&); |
29 void set(const String&, const String&); | 29 void set(const String&, const String&); |
30 // FIXME: Implement parse() | 30 // FIXME: Implement parse() |
31 String extractMIMEType() const; | 31 String extractMIMEType() const; |
32 | 32 |
33 size_t size() const; | 33 size_t size() const; |
34 void remove(const String&); | 34 void remove(const String&); |
35 bool get(const String&, String&) const; | 35 bool get(const String&, String&) const; |
36 void getAll(const String&, Vector<String>&) const; | 36 void getAll(const String&, Vector<String>&) const; |
37 bool has(const String&) const; | 37 bool has(const String&) const; |
38 void clearList(); | 38 void clearList(); |
39 | 39 |
40 bool containsNonSimpleHeader() const; | 40 bool containsNonSimpleHeader() const; |
41 | 41 |
42 const Vector<std::unique_ptr<Header>>& list() const { return m_headerList; } | 42 const Vector<OwnPtr<Header>>& list() const { return m_headerList; } |
43 const Header& entry(size_t index) const { return *(m_headerList[index].get()
); } | 43 const Header& entry(size_t index) const { return *(m_headerList[index].get()
); } |
44 | 44 |
45 static bool isValidHeaderName(const String&); | 45 static bool isValidHeaderName(const String&); |
46 static bool isValidHeaderValue(const String&); | 46 static bool isValidHeaderValue(const String&); |
47 | 47 |
48 DEFINE_INLINE_TRACE() { } | 48 DEFINE_INLINE_TRACE() { } |
49 | 49 |
50 private: | 50 private: |
51 FetchHeaderList(); | 51 FetchHeaderList(); |
52 Vector<std::unique_ptr<Header>> m_headerList; | 52 Vector<OwnPtr<Header>> m_headerList; |
53 }; | 53 }; |
54 | 54 |
55 } // namespace blink | 55 } // namespace blink |
56 | 56 |
57 #endif // FetchHeaderList_h | 57 #endif // FetchHeaderList_h |
OLD | NEW |