OLD | NEW |
| (Empty) |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef HeaderMap_h | |
6 #define HeaderMap_h | |
7 | |
8 #include "bindings/core/v8/ScriptWrappable.h" | |
9 #include "wtf/Forward.h" | |
10 #include "wtf/HashMap.h" | |
11 #include "wtf/RefCounted.h" | |
12 #include "wtf/text/StringHash.h" | |
13 | |
14 namespace WebCore { | |
15 | |
16 class HeaderMapForEachCallback; | |
17 class ScriptValue; | |
18 | |
19 class HeaderMap FINAL : public ScriptWrappable, public RefCounted<HeaderMap> { | |
20 public: | |
21 static PassRefPtr<HeaderMap> create(); | |
22 static PassRefPtr<HeaderMap> create(const HashMap<String, String>& headers); | |
23 | |
24 // HeaderMap.idl implementation. | |
25 unsigned long size() const; | |
26 void clear(); | |
27 bool remove(const String& key); | |
28 String get(const String& key); | |
29 bool has(const String& key); | |
30 void set(const String& key, const String& value); | |
31 void forEach(PassOwnPtr<HeaderMapForEachCallback>, ScriptValue&); | |
32 void forEach(PassOwnPtr<HeaderMapForEachCallback>); | |
33 | |
34 const HashMap<String, String>& headerMap() const { return m_headers; } | |
35 | |
36 private: | |
37 HeaderMap(); | |
38 explicit HeaderMap(const HashMap<String, String>& headers); | |
39 void forEachInternal(PassOwnPtr<HeaderMapForEachCallback>, ScriptValue* this
Arg); | |
40 | |
41 // FIXME: this doesn't preserve ordering while ES6 Map type requires it. | |
42 HashMap<String, String> m_headers; | |
43 }; | |
44 | |
45 } // namespace WebCore | |
46 | |
47 #endif // HeaderMap_h | |
OLD | NEW |