Upstream version 10.39.225.0
[platform/framework/web/crosswalk.git] / src / third_party / WebKit / Source / modules / crypto / SubtleCrypto.h
index 313d8ee..d624a69 100644 (file)
 #ifndef SubtleCrypto_h
 #define SubtleCrypto_h
 
-#include "bindings/v8/ScriptPromise.h"
-#include "bindings/v8/ScriptWrappable.h"
+#include "bindings/core/v8/ScriptPromise.h"
+#include "bindings/core/v8/ScriptWrappable.h"
+#include "platform/heap/Handle.h"
+#include "wtf/ArrayPiece.h"
 #include "wtf/Forward.h"
-#include "wtf/PassRefPtr.h"
-#include "wtf/RefCounted.h"
 
-namespace WebCore {
+namespace blink {
 
+class CryptoKey;
 class Dictionary;
-class ExceptionState;
-class Key;
 
-class SubtleCrypto : public ScriptWrappable, public RefCounted<SubtleCrypto> {
+class SubtleCrypto FINAL : public GarbageCollected<SubtleCrypto>, public ScriptWrappable {
+    DEFINE_WRAPPERTYPEINFO();
 public:
-    static PassRefPtr<SubtleCrypto> create() { return adoptRef(new SubtleCrypto()); }
+    static SubtleCrypto* create()
+    {
+        return new SubtleCrypto();
+    }
 
-    ScriptPromise encrypt(const Dictionary&, Key*, ArrayBufferView* data, ExceptionState&);
-    ScriptPromise decrypt(const Dictionary&, Key*, ArrayBufferView* data, ExceptionState&);
-    ScriptPromise sign(const Dictionary&, Key*, ArrayBufferView* data, ExceptionState&);
+    ScriptPromise encrypt(ScriptState*, const Dictionary&, CryptoKey*, const ArrayPiece&);
+    ScriptPromise decrypt(ScriptState*, const Dictionary&, CryptoKey*, const ArrayPiece&);
+    ScriptPromise sign(ScriptState*, const Dictionary&, CryptoKey*, const ArrayPiece&);
     // Note that this is not named "verify" because when compiling on Mac that expands to a macro and breaks.
-    ScriptPromise verifySignature(const Dictionary&, Key*, ArrayBufferView* signature, ArrayBufferView* data, ExceptionState&);
-    ScriptPromise digest(const Dictionary&, ArrayBufferView* data, ExceptionState&);
+    ScriptPromise verifySignature(ScriptState*, const Dictionary&, CryptoKey*, const ArrayPiece& signature, const ArrayPiece& data);
+    ScriptPromise digest(ScriptState*, const Dictionary&, const ArrayPiece& data);
 
-    ScriptPromise generateKey(const Dictionary&, bool extractable, const Vector<String>& keyUsages, ExceptionState&);
-    ScriptPromise importKey(const String&, ArrayBufferView*, const Dictionary&, bool extractable, const Vector<String>& keyUsages, ExceptionState&);
-    ScriptPromise exportKey(const String&, Key*, ExceptionState&);
+    ScriptPromise generateKey(ScriptState*, const Dictionary&, bool extractable, const Vector<String>& keyUsages);
+    ScriptPromise importKey(ScriptState*, const String&, const ArrayPiece&, const Dictionary&, bool extractable, const Vector<String>& keyUsages);
+    ScriptPromise importKey(ScriptState*, const String&, const Dictionary&, const Dictionary&, bool extractable, const Vector<String>& keyUsages);
+    ScriptPromise exportKey(ScriptState*, const String&, CryptoKey*);
 
-    ScriptPromise wrapKey(const String&, Key*, Key*, const Dictionary&, ExceptionState&);
-    ScriptPromise unwrapKey(const String&, ArrayBufferView*, Key*, const Dictionary&, const Dictionary&, bool, const Vector<String>&, ExceptionState&);
+    ScriptPromise wrapKey(ScriptState*, const String&, CryptoKey*, CryptoKey*, const Dictionary&);
+    ScriptPromise unwrapKey(ScriptState*, const String&, const ArrayPiece&, CryptoKey*, const Dictionary&, const Dictionary&, bool, const Vector<String>&);
+
+    void trace(Visitor*) { }
 
 private:
     SubtleCrypto();
 };
 
-} // namespace WebCore
+} // namespace blink
 
-#endif
+#endif // SubtleCrypto_h