| 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 "bindings/modules/v8/ScriptValueSerializerForModules.h" | 5 #include "bindings/modules/v8/ScriptValueSerializerForModules.h" |
| 6 | 6 |
| 7 #include "bindings/core/v8/SerializationTag.h" | 7 #include "bindings/core/v8/SerializationTag.h" |
| 8 #include "bindings/core/v8/V8Binding.h" | 8 #include "bindings/core/v8/V8Binding.h" |
| 9 #include "bindings/modules/v8/V8CryptoKey.h" | 9 #include "bindings/modules/v8/V8CryptoKey.h" |
| 10 #include "bindings/modules/v8/V8DOMFileSystem.h" | 10 #include "bindings/modules/v8/V8DOMFileSystem.h" |
| 11 #include "bindings/modules/v8/V8RTCCertificate.h" | 11 #include "bindings/modules/v8/V8RTCCertificate.h" |
| 12 #include "modules/filesystem/DOMFileSystem.h" | 12 #include "modules/filesystem/DOMFileSystem.h" |
| 13 #include "modules/mediastream/RTCCertificate.h" | 13 #include "modules/mediastream/RTCCertificate.h" |
| 14 #include "public/platform/Platform.h" | 14 #include "public/platform/Platform.h" |
| 15 #include "public/platform/WebRTCCertificate.h" | 15 #include "public/platform/WebRTCCertificate.h" |
| 16 #include "public/platform/WebRTCCertificateGenerator.h" | 16 #include "public/platform/WebRTCCertificateGenerator.h" |
| 17 #include "wtf/PtrUtil.h" | |
| 18 #include <memory> | |
| 19 | 17 |
| 20 namespace blink { | 18 namespace blink { |
| 21 | 19 |
| 22 enum CryptoKeyAlgorithmTag { | 20 enum CryptoKeyAlgorithmTag { |
| 23 AesCbcTag = 1, | 21 AesCbcTag = 1, |
| 24 HmacTag = 2, | 22 HmacTag = 2, |
| 25 RsaSsaPkcs1v1_5Tag = 3, | 23 RsaSsaPkcs1v1_5Tag = 3, |
| 26 // ID 4 was used by RsaEs, while still behind experimental flag. | 24 // ID 4 was used by RsaEs, while still behind experimental flag. |
| 27 Sha1Tag = 5, | 25 Sha1Tag = 5, |
| 28 Sha256Tag = 6, | 26 Sha256Tag = 6, |
| (...skipping 409 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 438 | 436 |
| 439 bool SerializedScriptValueReaderForModules::readRTCCertificate(v8::Local<v8::Val
ue>* value) | 437 bool SerializedScriptValueReaderForModules::readRTCCertificate(v8::Local<v8::Val
ue>* value) |
| 440 { | 438 { |
| 441 String pemPrivateKey; | 439 String pemPrivateKey; |
| 442 if (!readWebCoreString(&pemPrivateKey)) | 440 if (!readWebCoreString(&pemPrivateKey)) |
| 443 return false; | 441 return false; |
| 444 String pemCertificate; | 442 String pemCertificate; |
| 445 if (!readWebCoreString(&pemCertificate)) | 443 if (!readWebCoreString(&pemCertificate)) |
| 446 return false; | 444 return false; |
| 447 | 445 |
| 448 std::unique_ptr<WebRTCCertificateGenerator> certificateGenerator = wrapUniqu
e( | 446 OwnPtr<WebRTCCertificateGenerator> certificateGenerator = adoptPtr( |
| 449 Platform::current()->createRTCCertificateGenerator()); | 447 Platform::current()->createRTCCertificateGenerator()); |
| 450 | 448 |
| 451 std::unique_ptr<WebRTCCertificate> certificate( | 449 std::unique_ptr<WebRTCCertificate> certificate( |
| 452 certificateGenerator->fromPEM( | 450 certificateGenerator->fromPEM( |
| 453 pemPrivateKey.utf8().data(), | 451 pemPrivateKey.utf8().data(), |
| 454 pemCertificate.utf8().data())); | 452 pemCertificate.utf8().data())); |
| 455 RTCCertificate* jsCertificate = new RTCCertificate(std::move(certificate)); | 453 RTCCertificate* jsCertificate = new RTCCertificate(std::move(certificate)); |
| 456 | 454 |
| 457 *value = toV8(jsCertificate, getScriptState()->context()->Global(), isolate(
)); | 455 *value = toV8(jsCertificate, getScriptState()->context()->Global(), isolate(
)); |
| 458 return !value->IsEmpty(); | 456 return !value->IsEmpty(); |
| (...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 681 : ScriptValueDeserializer(reader, messagePorts, arrayBufferContents, imageBi
tmapContents) | 679 : ScriptValueDeserializer(reader, messagePorts, arrayBufferContents, imageBi
tmapContents) |
| 682 { | 680 { |
| 683 } | 681 } |
| 684 | 682 |
| 685 bool ScriptValueDeserializerForModules::read(v8::Local<v8::Value>* value) | 683 bool ScriptValueDeserializerForModules::read(v8::Local<v8::Value>* value) |
| 686 { | 684 { |
| 687 return toSerializedScriptValueReaderForModules(reader()).read(value, *this); | 685 return toSerializedScriptValueReaderForModules(reader()).read(value, *this); |
| 688 } | 686 } |
| 689 | 687 |
| 690 } // namespace blink | 688 } // namespace blink |
| OLD | NEW |