Chromium Code Reviews| 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 15 matching lines...) Expand all Loading... | |
| 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 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 #ifndef CryptoKey_h | 31 #ifndef CryptoKey_h |
| 32 #define CryptoKey_h | 32 #define CryptoKey_h |
| 33 | 33 |
| 34 #include "bindings/v8/ScriptWrappable.h" | 34 #include "bindings/v8/ScriptWrappable.h" |
| 35 #include "modules/crypto/NormalizeAlgorithm.h" | 35 #include "modules/crypto/NormalizeAlgorithm.h" |
| 36 #include "platform/heap/Handle.h" | |
|
sof
2014/06/26 19:56:51
It'd be good if you could leave this in.
eroman
2014/06/27 21:52:19
Done. However what is the motivation for doing so,
sof
2014/06/28 06:03:35
The class derives from GarbageCollectedFinalized<>
eroman
2014/06/30 19:57:59
Ah thanks for pointing that out!
| |
| 37 #include "public/platform/WebCryptoAlgorithm.h" | 36 #include "public/platform/WebCryptoAlgorithm.h" |
| 38 #include "public/platform/WebCryptoKey.h" | 37 #include "public/platform/WebCryptoKey.h" |
| 39 #include "wtf/Forward.h" | 38 #include "wtf/Forward.h" |
| 40 #include "wtf/RefCounted.h" | 39 #include "wtf/RefCounted.h" |
| 41 #include "wtf/text/WTFString.h" | 40 #include "wtf/text/WTFString.h" |
| 42 | 41 |
| 43 namespace WebCore { | 42 namespace WebCore { |
| 44 | 43 |
| 45 class CryptoResult; | 44 class CryptoResult; |
| 46 class KeyAlgorithm; | 45 class KeyAlgorithm; |
| 47 | 46 |
| 48 class CryptoKey : public GarbageCollectedFinalized<CryptoKey>, public ScriptWrap pable { | 47 class CryptoKey : public GarbageCollectedFinalized<CryptoKey>, public ScriptWrap pable { |
| 49 public: | 48 public: |
| 50 static CryptoKey* create(const blink::WebCryptoKey& key) | 49 static CryptoKey* create(const blink::WebCryptoKey& key) |
| 51 { | 50 { |
| 52 return new CryptoKey(key); | 51 return new CryptoKey(key); |
| 53 } | 52 } |
| 54 | 53 |
| 55 ~CryptoKey(); | 54 ~CryptoKey(); |
| 56 | 55 |
| 57 String type() const; | 56 String type() const; |
| 58 bool extractable() const; | 57 bool extractable() const; |
| 59 KeyAlgorithm* algorithm(); | |
| 60 Vector<String> usages() const; | 58 Vector<String> usages() const; |
| 61 | 59 |
| 62 const blink::WebCryptoKey& key() const { return m_key; } | 60 const blink::WebCryptoKey& key() const { return m_key; } |
| 63 | 61 |
| 64 // If the key cannot be used with the indicated algorithm, returns false | 62 // If the key cannot be used with the indicated algorithm, returns false |
| 65 // and completes the CryptoResult with an error. | 63 // and completes the CryptoResult with an error. |
| 66 bool canBeUsedForAlgorithm(const blink::WebCryptoAlgorithm&, blink::WebCrypt oOperation, CryptoResult*) const; | 64 bool canBeUsedForAlgorithm(const blink::WebCryptoAlgorithm&, blink::WebCrypt oOperation, CryptoResult*) const; |
| 67 | 65 |
| 68 // On failure, these return false and complete the CryptoResult with an erro r. | 66 // On failure, these return false and complete the CryptoResult with an erro r. |
| 69 static bool parseFormat(const String&, blink::WebCryptoKeyFormat&, CryptoRes ult*); | 67 static bool parseFormat(const String&, blink::WebCryptoKeyFormat&, CryptoRes ult*); |
| 70 static bool parseUsageMask(const Vector<String>&, blink::WebCryptoKeyUsageMa sk&, CryptoResult*); | 68 static bool parseUsageMask(const Vector<String>&, blink::WebCryptoKeyUsageMa sk&, CryptoResult*); |
| 71 | 69 |
| 72 void trace(Visitor*); | 70 void trace(Visitor*) { } |
| 73 | 71 |
| 74 protected: | 72 protected: |
| 75 explicit CryptoKey(const blink::WebCryptoKey&); | 73 explicit CryptoKey(const blink::WebCryptoKey&); |
| 76 | 74 |
| 77 const blink::WebCryptoKey m_key; | 75 const blink::WebCryptoKey m_key; |
| 78 Member<KeyAlgorithm> m_algorithm; | |
| 79 }; | 76 }; |
| 80 | 77 |
| 81 } // namespace WebCore | 78 } // namespace WebCore |
| 82 | 79 |
| 83 #endif | 80 #endif |
| OLD | NEW |