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