| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/serialization/V8ScriptValueDeserializerForModules.
h" | 5 #include "bindings/modules/v8/serialization/V8ScriptValueDeserializerForModules.
h" |
| 6 | 6 |
| 7 #include "bindings/modules/v8/serialization/WebCryptoSubTags.h" | 7 #include "bindings/modules/v8/serialization/WebCryptoSubTags.h" |
| 8 #include "modules/crypto/CryptoKey.h" | 8 #include "modules/crypto/CryptoKey.h" |
| 9 #include "modules/filesystem/DOMFileSystem.h" | 9 #include "modules/filesystem/FileSystem.h" |
| 10 #include "modules/peerconnection/RTCCertificate.h" | 10 #include "modules/peerconnection/RTCCertificate.h" |
| 11 #include "platform/FileSystemType.h" | 11 #include "platform/FileSystemType.h" |
| 12 #include "public/platform/Platform.h" | 12 #include "public/platform/Platform.h" |
| 13 #include "public/platform/WebCrypto.h" | 13 #include "public/platform/WebCrypto.h" |
| 14 #include "public/platform/WebCryptoKeyAlgorithm.h" | 14 #include "public/platform/WebCryptoKeyAlgorithm.h" |
| 15 #include "public/platform/WebRTCCertificateGenerator.h" | 15 #include "public/platform/WebRTCCertificateGenerator.h" |
| 16 | 16 |
| 17 namespace blink { | 17 namespace blink { |
| 18 | 18 |
| 19 ScriptWrappable* V8ScriptValueDeserializerForModules::readDOMObject( | 19 ScriptWrappable* V8ScriptValueDeserializerForModules::readDOMObject( |
| 20 SerializationTag tag) { | 20 SerializationTag tag) { |
| 21 // Give the core/ implementation a chance to try first. | 21 // Give the core/ implementation a chance to try first. |
| 22 // If it didn't recognize the kind of wrapper, try the modules types. | 22 // If it didn't recognize the kind of wrapper, try the modules types. |
| 23 if (ScriptWrappable* wrappable = | 23 if (ScriptWrappable* wrappable = |
| 24 V8ScriptValueDeserializer::readDOMObject(tag)) | 24 V8ScriptValueDeserializer::readDOMObject(tag)) |
| 25 return wrappable; | 25 return wrappable; |
| 26 | 26 |
| 27 switch (tag) { | 27 switch (tag) { |
| 28 case CryptoKeyTag: | 28 case CryptoKeyTag: |
| 29 return readCryptoKey(); | 29 return readCryptoKey(); |
| 30 case DOMFileSystemTag: { | 30 case FileSystemTag: { |
| 31 uint32_t rawType; | 31 uint32_t rawType; |
| 32 String name; | 32 String name; |
| 33 String rootURL; | 33 String rootURL; |
| 34 if (!readUint32(&rawType) || rawType > FileSystemTypeLast || | 34 if (!readUint32(&rawType) || rawType > FileSystemTypeLast || |
| 35 !readUTF8String(&name) || !readUTF8String(&rootURL)) | 35 !readUTF8String(&name) || !readUTF8String(&rootURL)) |
| 36 return nullptr; | 36 return nullptr; |
| 37 return DOMFileSystem::create(getScriptState()->getExecutionContext(), | 37 return FileSystem::create(getScriptState()->getExecutionContext(), name, |
| 38 name, static_cast<FileSystemType>(rawType), | 38 static_cast<FileSystemType>(rawType), |
| 39 KURL(ParsedURLString, rootURL)); | 39 KURL(ParsedURLString, rootURL)); |
| 40 } | 40 } |
| 41 case RTCCertificateTag: { | 41 case RTCCertificateTag: { |
| 42 String pemPrivateKey; | 42 String pemPrivateKey; |
| 43 String pemCertificate; | 43 String pemCertificate; |
| 44 if (!readUTF8String(&pemPrivateKey) || !readUTF8String(&pemCertificate)) | 44 if (!readUTF8String(&pemPrivateKey) || !readUTF8String(&pemCertificate)) |
| 45 return nullptr; | 45 return nullptr; |
| 46 std::unique_ptr<WebRTCCertificateGenerator> certificateGenerator( | 46 std::unique_ptr<WebRTCCertificateGenerator> certificateGenerator( |
| 47 Platform::current()->createRTCCertificateGenerator()); | 47 Platform::current()->createRTCCertificateGenerator()); |
| 48 std::unique_ptr<WebRTCCertificate> certificate = | 48 std::unique_ptr<WebRTCCertificate> certificate = |
| 49 certificateGenerator->fromPEM(pemPrivateKey, pemCertificate); | 49 certificateGenerator->fromPEM(pemPrivateKey, pemCertificate); |
| (...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 275 WebCryptoKey key = WebCryptoKey::createNull(); | 275 WebCryptoKey key = WebCryptoKey::createNull(); |
| 276 if (!Platform::current()->crypto()->deserializeKeyForClone( | 276 if (!Platform::current()->crypto()->deserializeKeyForClone( |
| 277 algorithm, keyType, extractable, usages, | 277 algorithm, keyType, extractable, usages, |
| 278 reinterpret_cast<const unsigned char*>(keyData), keyDataLength, key)) | 278 reinterpret_cast<const unsigned char*>(keyData), keyDataLength, key)) |
| 279 return nullptr; | 279 return nullptr; |
| 280 | 280 |
| 281 return CryptoKey::create(key); | 281 return CryptoKey::create(key); |
| 282 } | 282 } |
| 283 | 283 |
| 284 } // namespace blink | 284 } // namespace blink |
| OLD | NEW |