| 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 <v8.h> |
| 8 #include <memory> |
| 7 #include "bindings/core/v8/ExceptionState.h" | 9 #include "bindings/core/v8/ExceptionState.h" |
| 8 #include "bindings/core/v8/ScriptState.h" | 10 #include "bindings/core/v8/ScriptState.h" |
| 9 #include "bindings/core/v8/V8Binding.h" | 11 #include "bindings/core/v8/V8Binding.h" |
| 10 #include "bindings/modules/v8/ArrayBufferOrArrayBufferViewOrUSVString.h" | 12 #include "bindings/modules/v8/ArrayBufferOrArrayBufferViewOrUSVString.h" |
| 11 #include "core/dom/DOMArrayBuffer.h" | 13 #include "core/dom/DOMArrayBuffer.h" |
| 12 #include "core/fileapi/Blob.h" | 14 #include "core/fileapi/Blob.h" |
| 13 #include "platform/blob/BlobData.h" | 15 #include "platform/blob/BlobData.h" |
| 14 #include "wtf/Assertions.h" | 16 #include "wtf/Assertions.h" |
| 15 #include "wtf/text/TextEncoding.h" | 17 #include "wtf/text/TextEncoding.h" |
| 16 #include <memory> | |
| 17 #include <v8.h> | |
| 18 | 18 |
| 19 namespace blink { | 19 namespace blink { |
| 20 | 20 |
| 21 PushMessageData* PushMessageData::create(const String& messageString) { | 21 PushMessageData* PushMessageData::create(const String& messageString) { |
| 22 // The standard supports both an empty but valid message and a null message. | 22 // The standard supports both an empty but valid message and a null message. |
| 23 // In case the message is explicitly null, return a null pointer which will | 23 // In case the message is explicitly null, return a null pointer which will |
| 24 // be set in the PushEvent. | 24 // be set in the PushEvent. |
| 25 if (messageString.isNull()) | 25 if (messageString.isNull()) |
| 26 return nullptr; | 26 return nullptr; |
| 27 return PushMessageData::create( | 27 return PushMessageData::create( |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 return ScriptValue(scriptState, parsed); | 81 return ScriptValue(scriptState, parsed); |
| 82 } | 82 } |
| 83 | 83 |
| 84 String PushMessageData::text() const { | 84 String PushMessageData::text() const { |
| 85 return UTF8Encoding().decode(m_data.data(), m_data.size()); | 85 return UTF8Encoding().decode(m_data.data(), m_data.size()); |
| 86 } | 86 } |
| 87 | 87 |
| 88 DEFINE_TRACE(PushMessageData) {} | 88 DEFINE_TRACE(PushMessageData) {} |
| 89 | 89 |
| 90 } // namespace blink | 90 } // namespace blink |
| OLD | NEW |