| 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 20 matching lines...) Expand all Loading... |
| 31 #ifndef WebCrypto_h | 31 #ifndef WebCrypto_h |
| 32 #define WebCrypto_h | 32 #define WebCrypto_h |
| 33 | 33 |
| 34 #include "WebCommon.h" | 34 #include "WebCommon.h" |
| 35 #include "WebCryptoAlgorithm.h" | 35 #include "WebCryptoAlgorithm.h" |
| 36 #include "WebCryptoKey.h" | 36 #include "WebCryptoKey.h" |
| 37 #include "WebPrivatePtr.h" | 37 #include "WebPrivatePtr.h" |
| 38 #include "WebString.h" | 38 #include "WebString.h" |
| 39 #include "WebVector.h" | 39 #include "WebVector.h" |
| 40 | 40 |
| 41 namespace blink { class CryptoResult; } | |
| 42 | |
| 43 #if INSIDE_BLINK | 41 #if INSIDE_BLINK |
| 44 namespace WTF { template <typename T> class PassRefPtr; } | 42 namespace WTF { template <typename T> class PassRefPtr; } |
| 45 #endif | 43 #endif |
| 46 | 44 |
| 47 namespace blink { | 45 namespace blink { |
| 48 | 46 |
| 47 class CryptoResult; |
| 49 class WebArrayBuffer; | 48 class WebArrayBuffer; |
| 50 class WebString; | 49 class WebString; |
| 51 | 50 |
| 52 enum WebCryptoErrorType { | 51 enum WebCryptoErrorType { |
| 53 WebCryptoErrorTypeType, | 52 WebCryptoErrorTypeType, |
| 54 WebCryptoErrorTypeNotSupported, | 53 WebCryptoErrorTypeNotSupported, |
| 55 WebCryptoErrorTypeSyntax, | 54 WebCryptoErrorTypeSyntax, |
| 56 WebCryptoErrorTypeInvalidState, | 55 WebCryptoErrorTypeInvalidState, |
| 57 WebCryptoErrorTypeInvalidAccess, | 56 WebCryptoErrorTypeInvalidAccess, |
| 58 WebCryptoErrorTypeUnknown, | 57 WebCryptoErrorTypeUnknown, |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 93 BLINK_PLATFORM_EXPORT void completeWithJson(const char* utf8Data, unsigned l
ength); | 92 BLINK_PLATFORM_EXPORT void completeWithJson(const char* utf8Data, unsigned l
ength); |
| 94 BLINK_PLATFORM_EXPORT void completeWithBoolean(bool); | 93 BLINK_PLATFORM_EXPORT void completeWithBoolean(bool); |
| 95 BLINK_PLATFORM_EXPORT void completeWithKey(const WebCryptoKey&); | 94 BLINK_PLATFORM_EXPORT void completeWithKey(const WebCryptoKey&); |
| 96 BLINK_PLATFORM_EXPORT void completeWithKeyPair(const WebCryptoKey& publicKey
, const WebCryptoKey& privateKey); | 95 BLINK_PLATFORM_EXPORT void completeWithKeyPair(const WebCryptoKey& publicKey
, const WebCryptoKey& privateKey); |
| 97 | 96 |
| 98 // Returns true if the underlying operation was cancelled. | 97 // Returns true if the underlying operation was cancelled. |
| 99 // This method can be called from any thread. | 98 // This method can be called from any thread. |
| 100 BLINK_PLATFORM_EXPORT bool cancelled() const; | 99 BLINK_PLATFORM_EXPORT bool cancelled() const; |
| 101 | 100 |
| 102 #if INSIDE_BLINK | 101 #if INSIDE_BLINK |
| 103 BLINK_PLATFORM_EXPORT explicit WebCryptoResult(const WTF::PassRefPtr<blink::
CryptoResult>&); | 102 BLINK_PLATFORM_EXPORT explicit WebCryptoResult(const WTF::PassRefPtr<CryptoR
esult>&); |
| 104 #endif | 103 #endif |
| 105 | 104 |
| 106 private: | 105 private: |
| 107 BLINK_PLATFORM_EXPORT void reset(); | 106 BLINK_PLATFORM_EXPORT void reset(); |
| 108 BLINK_PLATFORM_EXPORT void assign(const WebCryptoResult&); | 107 BLINK_PLATFORM_EXPORT void assign(const WebCryptoResult&); |
| 109 | 108 |
| 110 WebPrivatePtr<blink::CryptoResult> m_impl; | 109 WebPrivatePtr<CryptoResult> m_impl; |
| 111 }; | 110 }; |
| 112 | 111 |
| 113 class WebCryptoDigestor { | 112 class WebCryptoDigestor { |
| 114 public: | 113 public: |
| 115 virtual ~WebCryptoDigestor() { } | 114 virtual ~WebCryptoDigestor() { } |
| 116 | 115 |
| 117 // consume() will return |true| on the successful addition of data to the | 116 // consume() will return |true| on the successful addition of data to the |
| 118 // partially generated digest. It will return |false| when that fails. After | 117 // partially generated digest. It will return |false| when that fails. After |
| 119 // a return of |false|, consume() should not be called again (nor should | 118 // a return of |false|, consume() should not be called again (nor should |
| 120 // finish() be called). | 119 // finish() be called). |
| (...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 274 // Returns true on success. | 273 // Returns true on success. |
| 275 virtual bool serializeKeyForClone(const WebCryptoKey&, WebVector<unsigned ch
ar>&) { return false; } | 274 virtual bool serializeKeyForClone(const WebCryptoKey&, WebVector<unsigned ch
ar>&) { return false; } |
| 276 | 275 |
| 277 protected: | 276 protected: |
| 278 virtual ~WebCrypto() { } | 277 virtual ~WebCrypto() { } |
| 279 }; | 278 }; |
| 280 | 279 |
| 281 } // namespace blink | 280 } // namespace blink |
| 282 | 281 |
| 283 #endif | 282 #endif |
| OLD | NEW |