| Index: Source/modules/crypto/KeyOperation.h
|
| diff --git a/Source/modules/crypto/SubtleCrypto.h b/Source/modules/crypto/KeyOperation.h
|
| similarity index 63%
|
| copy from Source/modules/crypto/SubtleCrypto.h
|
| copy to Source/modules/crypto/KeyOperation.h
|
| index 3df45a197d05977e28b5400d8cbc27464cdfb46e..50c3ba635d2940e71c4c0111dde3f8053b1d62de 100644
|
| --- a/Source/modules/crypto/SubtleCrypto.h
|
| +++ b/Source/modules/crypto/KeyOperation.h
|
| @@ -28,34 +28,54 @@
|
| * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
| */
|
|
|
| -#ifndef SubtleCrypto_h
|
| -#define SubtleCrypto_h
|
| +#ifndef KeyOperation_h
|
| +#define KeyOperation_h
|
|
|
| -#include "bindings/v8/ScriptWrappable.h"
|
| +#include "bindings/v8/ScriptObject.h"
|
| #include "wtf/Forward.h"
|
| #include "wtf/PassRefPtr.h"
|
| -#include "wtf/RefCounted.h"
|
| +#include "wtf/RefPtr.h"
|
| +#include "wtf/ThreadSafeRefCounted.h"
|
|
|
| -namespace WebCore {
|
| +namespace WebKit {
|
| +class WebCryptoKeyOperation;
|
| +class WebCryptoKey;
|
| +}
|
|
|
| -class CryptoOperation;
|
| -class Dictionary;
|
| +namespace WebCore {
|
|
|
| typedef int ExceptionCode;
|
| +class ScriptPromiseResolver;
|
| +
|
| +// todo: m_exceptionCode
|
| +// create the promise resolver.
|
|
|
| -class SubtleCrypto : public ScriptWrappable, public RefCounted<SubtleCrypto> {
|
| +class KeyOperation : public ThreadSafeRefCounted<KeyOperation> {
|
| public:
|
| - static PassRefPtr<SubtleCrypto> create() { return adoptRef(new SubtleCrypto()); }
|
| + KeyOperation();
|
| + ~KeyOperation();
|
|
|
| - PassRefPtr<CryptoOperation> encrypt(const Dictionary&, ExceptionCode&);
|
| - PassRefPtr<CryptoOperation> decrypt(const Dictionary&, ExceptionCode&);
|
| - PassRefPtr<CryptoOperation> sign(const Dictionary&, ExceptionCode&);
|
| - // Note that this is not named "verify" because when compiling on Mac that expands to a macro and breaks.
|
| - PassRefPtr<CryptoOperation> verifySignature(const Dictionary&, ExceptionCode&);
|
| - PassRefPtr<CryptoOperation> digest(const Dictionary&, ExceptionCode&);
|
| + // Implementation of WebKit::WebCryptoKeyOperationResult.
|
| + void initializationFailed();
|
| + void initializationSucceeded(WebKit::WebCryptoKeyOperation*);
|
| + void completeWithError();
|
| + void completeWithKey(const WebKit::WebCryptoKey&);
|
| +
|
| + ScriptObject returnValue(ExceptionCode&);
|
|
|
| private:
|
| - SubtleCrypto();
|
| + enum State {
|
| + Initializing,
|
| + InProgress,
|
| + Done,
|
| + };
|
| +
|
| + ScriptPromiseResolver* promiseResolver();
|
| +
|
| + State m_state;
|
| + WebKit::WebCryptoKeyOperation* m_impl;
|
| + ExceptionCode m_exceptionCode;
|
| + RefPtr<ScriptPromiseResolver> m_promiseResolver;
|
| };
|
|
|
| } // namespace WebCore
|
|
|