| Index: Source/modules/crypto/CrossThreadCryptoResult.cpp
|
| diff --git a/Source/platform/CryptoResult.h b/Source/modules/crypto/CrossThreadCryptoResult.cpp
|
| similarity index 61%
|
| copy from Source/platform/CryptoResult.h
|
| copy to Source/modules/crypto/CrossThreadCryptoResult.cpp
|
| index af8032bc57997e4bd35febe1d797d841d1682a14..013c619d0d264229910f098c621e755803ec0879 100644
|
| --- a/Source/platform/CryptoResult.h
|
| +++ b/Source/modules/crypto/CrossThreadCryptoResult.cpp
|
| @@ -28,31 +28,40 @@
|
| * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
| */
|
|
|
| -#ifndef CryptoResult_h
|
| -#define CryptoResult_h
|
| +#include "config.h"
|
| +#include "modules/crypto/CrossThreadCryptoResult.h"
|
|
|
| +#include "core/dom/DOMException.h"
|
| #include "public/platform/WebCrypto.h"
|
| -#include "wtf/ThreadSafeRefCounted.h"
|
|
|
| namespace WebCore {
|
|
|
| -// Receives notification of completion of the crypto operation.
|
| -class CryptoResult : public ThreadSafeRefCounted<CryptoResult> {
|
| -public:
|
| - virtual ~CryptoResult() { }
|
| -
|
| - virtual void completeWithError(blink::WebCryptoErrorType, const blink::WebString&) = 0;
|
| - virtual void completeWithBuffer(const blink::WebArrayBuffer&) = 0;
|
| - virtual void completeWithBoolean(bool) = 0;
|
| - virtual void completeWithKey(const blink::WebCryptoKey&) = 0;
|
| - virtual void completeWithKeyPair(const blink::WebCryptoKey& publicKey, const blink::WebCryptoKey& privateKey) = 0;
|
| -
|
| - blink::WebCryptoResult result()
|
| - {
|
| - return blink::WebCryptoResult(this);
|
| +ExceptionCode webCryptoErrorToExceptionCode(blink::WebCryptoErrorType errorType)
|
| +{
|
| + switch (errorType) {
|
| + case blink::WebCryptoErrorTypeNotSupported:
|
| + return NotSupportedError;
|
| + case blink::WebCryptoErrorTypeSyntax:
|
| + return SyntaxError;
|
| + case blink::WebCryptoErrorTypeInvalidState:
|
| + return InvalidStateError;
|
| + case blink::WebCryptoErrorTypeInvalidAccess:
|
| + return InvalidAccessError;
|
| + case blink::WebCryptoErrorTypeUnknown:
|
| + return UnknownError;
|
| + case blink::WebCryptoErrorTypeData:
|
| + return DataError;
|
| + case blink::WebCryptoErrorTypeOperation:
|
| + return OperationError;
|
| + case blink::WebCryptoErrorTypeType:
|
| + // FIXME: This should construct a TypeError instead. For now do
|
| + // something to facilitate refactor, but this will need to be
|
| + // revisited.
|
| + return DataError;
|
| }
|
| -};
|
|
|
| -} // namespace WebCore
|
| + ASSERT_NOT_REACHED();
|
| + return 0;
|
| +}
|
|
|
| -#endif
|
| +} // namespace WebCore
|
|
|