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