| 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/Optional.h" |
| 8 #include "bindings/core/v8/ScriptWrappable.h" | 9 #include "bindings/core/v8/ScriptWrappable.h" |
| 9 #include "modules/serviceworkers/FetchHeaderList.h" | 10 #include "modules/serviceworkers/FetchHeaderList.h" |
| 10 #include "wtf/Forward.h" | 11 #include "wtf/Forward.h" |
| 11 #include "wtf/PassOwnPtr.h" | 12 #include "wtf/PassOwnPtr.h" |
| 12 #include "wtf/RefCounted.h" | 13 #include "wtf/RefCounted.h" |
| 13 | 14 |
| 14 namespace blink { | 15 namespace blink { |
| 15 | 16 |
| 16 class Dictionary; | 17 class Dictionary; |
| 17 class ExceptionState; | 18 class ExceptionState; |
| (...skipping 17 matching lines...) Expand all Loading... |
| 35 PassRefPtrWillBeRawPtr<Headers> createCopy() const; | 36 PassRefPtrWillBeRawPtr<Headers> createCopy() const; |
| 36 | 37 |
| 37 // Headers.idl implementation. | 38 // Headers.idl implementation. |
| 38 void append(const String& name, const String& value, ExceptionState&); | 39 void append(const String& name, const String& value, ExceptionState&); |
| 39 void remove(const String& key, ExceptionState&); | 40 void remove(const String& key, ExceptionState&); |
| 40 String get(const String& key, ExceptionState&); | 41 String get(const String& key, ExceptionState&); |
| 41 Vector<String> getAll(const String& key, ExceptionState&); | 42 Vector<String> getAll(const String& key, ExceptionState&); |
| 42 bool has(const String& key, ExceptionState&); | 43 bool has(const String& key, ExceptionState&); |
| 43 void set(const String& key, const String& value, ExceptionState&); | 44 void set(const String& key, const String& value, ExceptionState&); |
| 44 unsigned long size() const; | 45 unsigned long size() const; |
| 45 void forEach(PassOwnPtr<HeadersForEachCallback>, ScriptValue&); | 46 void forEach(PassOwnPtr<HeadersForEachCallback>, const Optional<ScriptValue>
&); |
| 46 void forEach(PassOwnPtr<HeadersForEachCallback>); | |
| 47 | 47 |
| 48 void setGuard(Guard guard) { m_guard = guard; } | 48 void setGuard(Guard guard) { m_guard = guard; } |
| 49 Guard guard() const { return m_guard; } | 49 Guard guard() const { return m_guard; } |
| 50 | 50 |
| 51 // These methods should only be called when size() would return 0. | 51 // These methods should only be called when size() would return 0. |
| 52 void fillWith(const Headers*, ExceptionState&); | 52 void fillWith(const Headers*, ExceptionState&); |
| 53 void fillWith(const Dictionary&, ExceptionState&); | 53 void fillWith(const Dictionary&, ExceptionState&); |
| 54 | 54 |
| 55 void trace(Visitor*); | 55 void trace(Visitor*); |
| 56 | 56 |
| 57 private: | 57 private: |
| 58 Headers(); | 58 Headers(); |
| 59 // Shares the FetchHeaderList. Called when creating a Request or Response. | 59 // Shares the FetchHeaderList. Called when creating a Request or Response. |
| 60 explicit Headers(FetchHeaderList*); | 60 explicit Headers(FetchHeaderList*); |
| 61 void forEachInternal(PassOwnPtr<HeadersForEachCallback>, ScriptValue*); | |
| 62 | 61 |
| 63 RefPtrWillBeMember<FetchHeaderList> m_headerList; | 62 RefPtrWillBeMember<FetchHeaderList> m_headerList; |
| 64 Guard m_guard; | 63 Guard m_guard; |
| 65 }; | 64 }; |
| 66 | 65 |
| 67 } // namespace blink | 66 } // namespace blink |
| 68 | 67 |
| 69 #endif // Headers_h | 68 #endif // Headers_h |
| OLD | NEW |