OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 17 matching lines...) Expand all Loading... |
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
29 */ | 29 */ |
30 | 30 |
31 #include "modules/crypto/SubtleCrypto.h" | 31 #include "modules/crypto/SubtleCrypto.h" |
32 | 32 |
33 #include "bindings/core/v8/Dictionary.h" | 33 #include "bindings/core/v8/Dictionary.h" |
34 #include "core/dom/DOMArrayBuffer.h" | 34 #include "core/dom/DOMArrayBuffer.h" |
35 #include "core/dom/DOMArrayBufferView.h" | 35 #include "core/dom/DOMArrayBufferView.h" |
36 #include "core/dom/DOMArrayPiece.h" | 36 #include "core/dom/DOMArrayPiece.h" |
37 #include "core/dom/ExecutionContext.h" | 37 #include "core/dom/ExecutionContext.h" |
38 #include "core/frame/UseCounter.h" | 38 #include "core/frame/Deprecation.h" |
39 #include "modules/crypto/CryptoHistograms.h" | 39 #include "modules/crypto/CryptoHistograms.h" |
40 #include "modules/crypto/CryptoKey.h" | 40 #include "modules/crypto/CryptoKey.h" |
41 #include "modules/crypto/CryptoResultImpl.h" | 41 #include "modules/crypto/CryptoResultImpl.h" |
42 #include "modules/crypto/NormalizeAlgorithm.h" | 42 #include "modules/crypto/NormalizeAlgorithm.h" |
43 #include "platform/json/JSONValues.h" | 43 #include "platform/json/JSONValues.h" |
44 #include "public/platform/Platform.h" | 44 #include "public/platform/Platform.h" |
45 #include "public/platform/WebCrypto.h" | 45 #include "public/platform/WebCrypto.h" |
46 #include "public/platform/WebCryptoAlgorithm.h" | 46 #include "public/platform/WebCryptoAlgorithm.h" |
47 | 47 |
48 namespace blink { | 48 namespace blink { |
(...skipping 11 matching lines...) Expand all Loading... |
60 | 60 |
61 static bool canAccessWebCrypto(ScriptState* scriptState, CryptoResult* result) { | 61 static bool canAccessWebCrypto(ScriptState* scriptState, CryptoResult* result) { |
62 String errorMessage; | 62 String errorMessage; |
63 if (!scriptState->getExecutionContext()->isSecureContext( | 63 if (!scriptState->getExecutionContext()->isSecureContext( |
64 errorMessage, ExecutionContext::WebCryptoSecureContextCheck)) { | 64 errorMessage, ExecutionContext::WebCryptoSecureContextCheck)) { |
65 result->completeWithError(WebCryptoErrorTypeNotSupported, errorMessage); | 65 result->completeWithError(WebCryptoErrorTypeNotSupported, errorMessage); |
66 return false; | 66 return false; |
67 } | 67 } |
68 | 68 |
69 if (!scriptState->getExecutionContext()->isSecureContext()) { | 69 if (!scriptState->getExecutionContext()->isSecureContext()) { |
70 UseCounter::count( | 70 Deprecation::countDeprecation( |
71 scriptState->getExecutionContext(), | 71 scriptState->getExecutionContext(), |
72 UseCounter::SubtleCryptoOnlyStrictSecureContextCheckFailed); | 72 UseCounter::SubtleCryptoOnlyStrictSecureContextCheckFailed); |
73 } | 73 } |
74 | 74 |
75 return true; | 75 return true; |
76 } | 76 } |
77 | 77 |
78 static bool copyStringProperty(const char* property, | 78 static bool copyStringProperty(const char* property, |
79 const Dictionary& source, | 79 const Dictionary& source, |
80 JSONObject* destination) { | 80 JSONObject* destination) { |
(...skipping 691 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
772 normalizedAlgorithm, baseKey->key()); | 772 normalizedAlgorithm, baseKey->key()); |
773 histogramAlgorithm(scriptState->getExecutionContext(), | 773 histogramAlgorithm(scriptState->getExecutionContext(), |
774 normalizedDerivedKeyAlgorithm); | 774 normalizedDerivedKeyAlgorithm); |
775 Platform::current()->crypto()->deriveKey( | 775 Platform::current()->crypto()->deriveKey( |
776 normalizedAlgorithm, baseKey->key(), normalizedDerivedKeyAlgorithm, | 776 normalizedAlgorithm, baseKey->key(), normalizedDerivedKeyAlgorithm, |
777 keyLengthAlgorithm, extractable, keyUsages, result->result()); | 777 keyLengthAlgorithm, extractable, keyUsages, result->result()); |
778 return promise; | 778 return promise; |
779 } | 779 } |
780 | 780 |
781 } // namespace blink | 781 } // namespace blink |
OLD | NEW |