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 PushMessageData_h | 5 #ifndef PushMessageData_h |
6 #define PushMessageData_h | 6 #define PushMessageData_h |
7 | 7 |
8 #include "bindings/core/v8/ScriptValue.h" | 8 #include "bindings/core/v8/ScriptValue.h" |
9 #include "bindings/core/v8/ScriptWrappable.h" | 9 #include "bindings/core/v8/ScriptWrappable.h" |
10 #include "modules/ModulesExport.h" | 10 #include "modules/ModulesExport.h" |
11 #include "platform/heap/Handle.h" | 11 #include "platform/heap/Handle.h" |
| 12 #include "wtf/Vector.h" |
12 #include "wtf/text/WTFString.h" | 13 #include "wtf/text/WTFString.h" |
13 | 14 |
14 namespace blink { | 15 namespace blink { |
15 | 16 |
| 17 class ArrayBufferOrArrayBufferViewOrUSVString; |
16 class Blob; | 18 class Blob; |
17 class DOMArrayBuffer; | 19 class DOMArrayBuffer; |
18 class ExceptionState; | 20 class ExceptionState; |
19 class ScriptState; | 21 class ScriptState; |
20 | 22 |
21 class MODULES_EXPORT PushMessageData final : public GarbageCollectedFinalized<Pu
shMessageData>, public ScriptWrappable { | 23 class MODULES_EXPORT PushMessageData final : public GarbageCollectedFinalized<Pu
shMessageData>, public ScriptWrappable { |
22 DEFINE_WRAPPERTYPEINFO(); | 24 DEFINE_WRAPPERTYPEINFO(); |
23 | 25 |
24 public: | 26 public: |
25 static PushMessageData* create() | 27 static PushMessageData* create() |
26 { | 28 { |
27 return new PushMessageData(); | 29 return new PushMessageData(); |
28 } | 30 } |
29 | 31 static PushMessageData* create(const String& data); |
30 static PushMessageData* create(const String& messageData) | 32 static PushMessageData* create(const ArrayBufferOrArrayBufferViewOrUSVString
& data); |
31 { | |
32 return new PushMessageData(messageData); | |
33 } | |
34 | 33 |
35 virtual ~PushMessageData(); | 34 virtual ~PushMessageData(); |
36 | 35 |
37 PassRefPtr<DOMArrayBuffer> arrayBuffer() const; | 36 PassRefPtr<DOMArrayBuffer> arrayBuffer() const; |
38 Blob* blob() const; | 37 Blob* blob() const; |
39 ScriptValue json(ScriptState*, ExceptionState&) const; | 38 ScriptValue json(ScriptState*, ExceptionState&) const; |
40 const String& text() const; | 39 String text() const; |
41 | 40 |
42 DECLARE_TRACE(); | 41 DECLARE_TRACE(); |
43 | 42 |
44 private: | 43 private: |
45 PushMessageData(); | 44 PushMessageData(); |
46 explicit PushMessageData(const String& messageData); | 45 PushMessageData(const char* data, unsigned bytesSize); |
47 | 46 |
48 String m_messageData; | 47 Vector<char> m_data; |
49 }; | 48 }; |
50 | 49 |
51 } // namespace blink | 50 } // namespace blink |
52 | 51 |
53 #endif // PushMessageData_h | 52 #endif // PushMessageData_h |
OLD | NEW |