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 #include "modules/push_messaging/PushMessageData.h" | 5 #include "modules/push_messaging/PushMessageData.h" |
6 | 6 |
7 #include "bindings/core/v8/ExceptionState.h" | 7 #include "bindings/core/v8/ExceptionState.h" |
8 #include "bindings/core/v8/ScriptState.h" | 8 #include "bindings/core/v8/ScriptState.h" |
9 #include "bindings/core/v8/V8Binding.h" | 9 #include "bindings/core/v8/V8Binding.h" |
10 #include "bindings/modules/v8/UnionTypesModules.h" | 10 #include "bindings/modules/v8/UnionTypesModules.h" |
(...skipping 24 matching lines...) Expand all Loading... |
35 | 35 |
36 return new PushMessageData(static_cast<const char*>(buffer->data()), buf
fer->byteLength()); | 36 return new PushMessageData(static_cast<const char*>(buffer->data()), buf
fer->byteLength()); |
37 } | 37 } |
38 | 38 |
39 if (messageData.isUSVString()) { | 39 if (messageData.isUSVString()) { |
40 CString encodedString = UTF8Encoding().encode(messageData.getAsUSVString
(), WTF::EntitiesForUnencodables); | 40 CString encodedString = UTF8Encoding().encode(messageData.getAsUSVString
(), WTF::EntitiesForUnencodables); |
41 return new PushMessageData(encodedString.data(), encodedString.length())
; | 41 return new PushMessageData(encodedString.data(), encodedString.length())
; |
42 } | 42 } |
43 | 43 |
44 ASSERT(messageData.isNull()); | 44 ASSERT(messageData.isNull()); |
45 return new PushMessageData(); | 45 return nullptr; |
46 } | |
47 | |
48 PushMessageData::PushMessageData() | |
49 { | |
50 } | 46 } |
51 | 47 |
52 PushMessageData::PushMessageData(const char* data, unsigned bytesSize) | 48 PushMessageData::PushMessageData(const char* data, unsigned bytesSize) |
53 { | 49 { |
54 m_data.append(data, bytesSize); | 50 m_data.append(data, bytesSize); |
55 } | 51 } |
56 | 52 |
57 PushMessageData::~PushMessageData() | 53 PushMessageData::~PushMessageData() |
58 { | 54 { |
59 } | 55 } |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
95 String PushMessageData::text() const | 91 String PushMessageData::text() const |
96 { | 92 { |
97 return UTF8Encoding().decode(m_data.data(), m_data.size()); | 93 return UTF8Encoding().decode(m_data.data(), m_data.size()); |
98 } | 94 } |
99 | 95 |
100 DEFINE_TRACE(PushMessageData) | 96 DEFINE_TRACE(PushMessageData) |
101 { | 97 { |
102 } | 98 } |
103 | 99 |
104 } // namespace blink | 100 } // namespace blink |
OLD | NEW |