Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(285)

Side by Side Diff: Source/modules/serviceworkers/HeaderMap.h

Issue 304053003: ServiceWorker: support Request.{url,method,origin,headers} [blink] (1/3) (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Add test for Request. Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 HeaderMap_h 5 #ifndef HeaderMap_h
6 #define HeaderMap_h 6 #define HeaderMap_h
7 7
8 #include "bindings/v8/ScriptWrappable.h" 8 #include "bindings/v8/ScriptWrappable.h"
9 #include "wtf/Forward.h" 9 #include "wtf/Forward.h"
10 #include "wtf/HashMap.h" 10 #include "wtf/HashMap.h"
11 #include "wtf/RefCounted.h" 11 #include "wtf/RefCounted.h"
12 #include "wtf/text/StringHash.h" 12 #include "wtf/text/StringHash.h"
13 13
14 namespace WebCore { 14 namespace WebCore {
15 15
16 class HeaderMapForEachCallback; 16 class HeaderMapForEachCallback;
17 class ScriptValue; 17 class ScriptValue;
18 18
19 class HeaderMap FINAL : public ScriptWrappable, public RefCounted<HeaderMap> { 19 class HeaderMap FINAL : public ScriptWrappable, public RefCounted<HeaderMap> {
20 public: 20 public:
21 static PassRefPtr<HeaderMap> create(); 21 static PassRefPtr<HeaderMap> create();
22 static PassRefPtr<HeaderMap> create(const HashMap<String, String>& headers);
22 23
23 // HeaderMap.idl implementation. 24 // HeaderMap.idl implementation.
24 unsigned long size() const; 25 unsigned long size() const;
25 void clear(); 26 void clear();
26 bool remove(const String& key); 27 bool remove(const String& key);
27 String get(const String& key); 28 String get(const String& key);
28 bool has(const String& key); 29 bool has(const String& key);
29 void set(const String& key, const String& value); 30 void set(const String& key, const String& value);
30 void forEach(PassOwnPtr<HeaderMapForEachCallback>, ScriptValue&); 31 void forEach(PassOwnPtr<HeaderMapForEachCallback>, ScriptValue&);
31 void forEach(PassOwnPtr<HeaderMapForEachCallback>); 32 void forEach(PassOwnPtr<HeaderMapForEachCallback>);
32 33
33 const HashMap<String, String>& headerMap() const { return m_headers; } 34 const HashMap<String, String>& headerMap() const { return m_headers; }
34 35
35 private: 36 private:
36 HeaderMap(); 37 HeaderMap();
38 explicit HeaderMap(const HashMap<String, String>& headers);
37 void forEachInternal(PassOwnPtr<HeaderMapForEachCallback>, ScriptValue* this Arg); 39 void forEachInternal(PassOwnPtr<HeaderMapForEachCallback>, ScriptValue* this Arg);
38 40
39 // FIXME: this doesn't preserve ordering while ES6 Map type requires it. 41 // FIXME: this doesn't preserve ordering while ES6 Map type requires it.
40 HashMap<String, String> m_headers; 42 HashMap<String, String> m_headers;
41 }; 43 };
42 44
43 } // namespace WebCore 45 } // namespace WebCore
44 46
45 #endif // HeaderMap_h 47 #endif // HeaderMap_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698