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

Unified Diff: Source/core/platform/chromium/support/WebCrypto.cpp

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/core/core.gypi ('k') | Source/modules/crypto/CryptoOperation.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/platform/chromium/support/WebCrypto.cpp
diff --git a/Source/core/platform/chromium/support/WebCryptoKey.cpp b/Source/core/platform/chromium/support/WebCrypto.cpp
similarity index 50%
copy from Source/core/platform/chromium/support/WebCryptoKey.cpp
copy to Source/core/platform/chromium/support/WebCrypto.cpp
index 64e3b9ce780ce1694b281ef794069759387ce928..73e8a29abb3b72207ab05fdf1fbff87c4d5f7edd 100644
--- a/Source/core/platform/chromium/support/WebCryptoKey.cpp
+++ b/Source/core/platform/chromium/support/WebCrypto.cpp
@@ -29,72 +29,88 @@
*/
#include "config.h"
-#include "public/platform/WebCryptoKey.h"
-
-#include "public/platform/WebCryptoAlgorithm.h"
-#include "wtf/OwnPtr.h"
-#include "wtf/ThreadSafeRefCounted.h"
+#include "public/platform/WebCrypto.h"
namespace WebKit {
-class WebCryptoKeyPrivate : public ThreadSafeRefCounted<WebCryptoKeyPrivate> {
-public:
- WebCryptoKeyPrivate(PassOwnPtr<WebCryptoKeyHandle> handle, WebCryptoKeyType type, bool extractable, const WebCryptoAlgorithm& algorithm, WebCryptoKeyUsageMask usages)
- : handle(handle)
- , type(type)
- , extractable(extractable)
- , algorithm(algorithm)
- , usages(usages)
- {
- }
-
- const OwnPtr<WebCryptoKeyHandle> handle;
- const WebCryptoKeyType type;
- const bool extractable;
- const WebCryptoAlgorithm algorithm;
- const WebCryptoKeyUsageMask usages;
-};
-
-WebCryptoKey WebCryptoKey::create(WebCryptoKeyHandle* handle, WebCryptoKeyType type, bool extractable, const WebCryptoAlgorithm& algorithm, WebCryptoKeyUsageMask usages)
+// FIXME: Assert that these methods are called from the right thread.
+
+void WebCryptoOperationResult::initializationFailed()
+{
+ m_impl->initializationFailed();
+ reset();
+}
+
+void WebCryptoOperationResult::initializationSucceeded(WebCryptoOperation* op)
+{
+ m_impl->initializationSucceeded(op);
+ reset();
+}
+
+void WebCryptoOperationResult::completeWithError()
+{
+ m_impl->completeWithError();
+ reset();
+}
+
+void WebCryptoOperationResult::completeWithArrayBuffer(const WebArrayBuffer& buffer)
+{
+ m_impl->completeWithArrayBuffer(buffer);
+ reset();
+}
+
+void WebCryptoOperationResult::reset()
+{
+ m_impl.reset();
+}
+
+void WebCryptoOperationResult::assign(const WebCryptoOperationResult& o)
+{
+ m_impl = o.m_impl;
+}
+
+void WebCryptoOperationResult::assign(WebCryptoOperationResultPrivate* impl)
{
- WebCryptoKey key;
- key.m_private = adoptRef(new WebCryptoKeyPrivate(adoptPtr(handle), type, extractable, algorithm, usages));
- return key;
+ m_impl = impl;
}
-WebCryptoKeyHandle* WebCryptoKey::handle() const
+void WebCryptoKeyOperationResult::initializationFailed()
{
- return m_private->handle.get();
+ m_impl->initializationFailed();
+ reset();
}
-WebCryptoKeyType WebCryptoKey::type() const
+void WebCryptoKeyOperationResult::initializationSucceeded(WebCryptoKeyOperation* op)
{
- return m_private->type;
+ m_impl->initializationSucceeded(op);
+ reset();
}
-bool WebCryptoKey::extractable() const
+void WebCryptoKeyOperationResult::completeWithError()
{
- return m_private->extractable;
+ m_impl->completeWithError();
+ reset();
}
-const WebCryptoAlgorithm& WebCryptoKey::algorithm() const
+void WebCryptoKeyOperationResult::completeWithKey(const WebCryptoKey& key)
{
- return m_private->algorithm;
+ m_impl->completeWithKey(key);
+ reset();
}
-WebCryptoKeyUsageMask WebCryptoKey::usages() const
+void WebCryptoKeyOperationResult::reset()
{
- return m_private->usages;
+ m_impl.reset();
}
-void WebCryptoKey::assign(const WebCryptoKey& other)
+void WebCryptoKeyOperationResult::assign(const WebCryptoKeyOperationResult& o)
{
- m_private = other.m_private;
+ m_impl = o.m_impl;
}
-void WebCryptoKey::reset()
+void WebCryptoKeyOperationResult::assign(WebCryptoKeyOperationResultPrivate* impl)
{
- m_private.reset();
+ m_impl = impl;
}
} // namespace WebKit
« no previous file with comments | « Source/core/core.gypi ('k') | Source/modules/crypto/CryptoOperation.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698