Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1857)

Unified Diff: Source/modules/crypto/KeyOperation.h

Issue 19885002: WebCrypto: Add interfaces for importKey(). (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebase and rename Interface --> Private Created 7 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/modules/crypto/Key.idl ('k') | Source/modules/crypto/KeyOperation.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/modules/crypto/KeyOperation.h
diff --git a/Source/modules/crypto/SubtleCrypto.h b/Source/modules/crypto/KeyOperation.h
similarity index 58%
copy from Source/modules/crypto/SubtleCrypto.h
copy to Source/modules/crypto/KeyOperation.h
index d3cf99000b662102e872e99d272109f189f1da90..404248a7651d7423f0f6509a65f085075c40407f 100644
--- a/Source/modules/crypto/SubtleCrypto.h
+++ b/Source/modules/crypto/KeyOperation.h
@@ -28,33 +28,59 @@
* 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 "public/platform/WebCrypto.h"
#include "wtf/Forward.h"
#include "wtf/PassRefPtr.h"
-#include "wtf/RefCounted.h"
+#include "wtf/RefPtr.h"
+#include "wtf/ThreadSafeRefCounted.h"
+
+namespace WebKit {
+class WebCryptoKeyOperation;
+class WebCryptoKey;
+}
namespace WebCore {
-class CryptoOperation;
-class Dictionary;
class ExceptionState;
+class ScriptPromiseResolver;
+
+typedef int ExceptionCode;
-class SubtleCrypto : public ScriptWrappable, public RefCounted<SubtleCrypto> {
+class KeyOperation : public WebKit::WebCryptoKeyOperationResultPrivate, public ThreadSafeRefCounted<KeyOperation> {
public:
- static PassRefPtr<SubtleCrypto> create() { return adoptRef(new SubtleCrypto()); }
+ static PassRefPtr<KeyOperation> create();
+
+ ~KeyOperation();
+
+ // Implementation of WebCryptoKeyOperationResultPrivate.
+ virtual void initializationFailed() OVERRIDE;
+ virtual void initializationSucceeded(WebKit::WebCryptoKeyOperation*) OVERRIDE;
+ virtual void completeWithError() OVERRIDE;
+ virtual void completeWithKey(const WebKit::WebCryptoKey&) OVERRIDE;
+ virtual void ref() OVERRIDE;
+ virtual void deref() OVERRIDE;
- PassRefPtr<CryptoOperation> encrypt(const Dictionary&, ExceptionState&);
- PassRefPtr<CryptoOperation> decrypt(const Dictionary&, ExceptionState&);
- PassRefPtr<CryptoOperation> sign(const Dictionary&, ExceptionState&);
- // Note that this is not named "verify" because when compiling on Mac that expands to a macro and breaks.
- PassRefPtr<CryptoOperation> verifySignature(const Dictionary&, ExceptionState&);
- PassRefPtr<CryptoOperation> digest(const Dictionary&, ExceptionState&);
+ ScriptObject returnValue(ExceptionState&);
private:
- SubtleCrypto();
+ enum State {
+ Initializing,
+ InProgress,
+ Done,
+ };
+
+ KeyOperation();
+
+ ScriptPromiseResolver* promiseResolver();
+
+ State m_state;
+ WebKit::WebCryptoKeyOperation* m_impl;
+ ExceptionCode m_initializationError;
+ RefPtr<ScriptPromiseResolver> m_promiseResolver;
};
} // namespace WebCore
« no previous file with comments | « Source/modules/crypto/Key.idl ('k') | Source/modules/crypto/KeyOperation.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698