| OLD | NEW | 
|    1 /* |    1 /* | 
|    2  * Copyright (C) 2013 Google Inc. All rights reserved. |    2  * Copyright (C) 2013 Google Inc. All rights reserved. | 
|    3  * |    3  * | 
|    4  * Redistribution and use in source and binary forms, with or without |    4  * Redistribution and use in source and binary forms, with or without | 
|    5  * modification, are permitted provided that the following conditions are |    5  * modification, are permitted provided that the following conditions are | 
|    6  * met: |    6  * met: | 
|    7  * |    7  * | 
|    8  *     * Redistributions of source code must retain the above copyright |    8  *     * Redistributions of source code must retain the above copyright | 
|    9  * notice, this list of conditions and the following disclaimer. |    9  * notice, this list of conditions and the following disclaimer. | 
|   10  *     * Redistributions in binary form must reproduce the above |   10  *     * Redistributions in binary form must reproduce the above | 
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|   82     // |   82     // | 
|   83     //   - Blink calls cryptoOperation->abort() |   83     //   - Blink calls cryptoOperation->abort() | 
|   84     //   OR |   84     //   OR | 
|   85     //   - Embedder calls result.completeWithXXX() |   85     //   - Embedder calls result.completeWithXXX() | 
|   86     // |   86     // | 
|   87     // Once the cryptoOperation is no longer "in progress" the embedder is |   87     // Once the cryptoOperation is no longer "in progress" the embedder is | 
|   88     // responsible for freeing the cryptoOperation. |   88     // responsible for freeing the cryptoOperation. | 
|   89     virtual void encrypt(const WebCryptoAlgorithm&, const WebCryptoKey&, WebCryp
     toOperationResult&) { WEBKIT_ASSERT_NOT_REACHED(); } |   89     virtual void encrypt(const WebCryptoAlgorithm&, const WebCryptoKey&, WebCryp
     toOperationResult&) { WEBKIT_ASSERT_NOT_REACHED(); } | 
|   90     virtual void decrypt(const WebCryptoAlgorithm&, const WebCryptoKey&, WebCryp
     toOperationResult&) { WEBKIT_ASSERT_NOT_REACHED(); } |   90     virtual void decrypt(const WebCryptoAlgorithm&, const WebCryptoKey&, WebCryp
     toOperationResult&) { WEBKIT_ASSERT_NOT_REACHED(); } | 
|   91     virtual void sign(const WebCryptoAlgorithm&, const WebCryptoKey&, WebCryptoO
     perationResult&) { WEBKIT_ASSERT_NOT_REACHED(); } |   91     virtual void sign(const WebCryptoAlgorithm&, const WebCryptoKey&, WebCryptoO
     perationResult&) { WEBKIT_ASSERT_NOT_REACHED(); } | 
 |   92     virtual void verifySignature(const WebCryptoAlgorithm&, const WebCryptoKey&,
      const unsigned char* signature, size_t, WebCryptoOperationResult&) { WEBKIT_ASS
     ERT_NOT_REACHED(); } | 
|   92     virtual void digest(const WebCryptoAlgorithm&, WebCryptoOperationResult&) { 
     WEBKIT_ASSERT_NOT_REACHED(); } |   93     virtual void digest(const WebCryptoAlgorithm&, WebCryptoOperationResult&) { 
     WEBKIT_ASSERT_NOT_REACHED(); } | 
|   93  |   94  | 
|   94     // The following methods begin an asynchronous single-part key operation. |   95     // The following methods begin an asynchronous single-part key operation. | 
|   95     // |   96     // | 
|   96     // Let the WebCryptoKeyOperationResult& be called "result". |   97     // Let the WebCryptoKeyOperationResult& be called "result". | 
|   97     // |   98     // | 
|   98     // Before returning, implementations can either: |   99     // Before returning, implementations can either: | 
|   99     // |  100     // | 
|  100     // (a) Synchronously fail initialization by calling: |  101     // (a) Synchronously fail initialization by calling: | 
|  101     //     result.initializationFailed(errorDetails) |  102     //     result.initializationFailed(errorDetails) | 
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  148  |  149  | 
|  149 // Can be implemented by embedder for unit-testing. |  150 // Can be implemented by embedder for unit-testing. | 
|  150 class WebCryptoOperationResultPrivate { |  151 class WebCryptoOperationResultPrivate { | 
|  151 public: |  152 public: | 
|  152     virtual ~WebCryptoOperationResultPrivate() { } |  153     virtual ~WebCryptoOperationResultPrivate() { } | 
|  153  |  154  | 
|  154     virtual void initializationFailed() = 0; |  155     virtual void initializationFailed() = 0; | 
|  155     virtual void initializationSucceeded(WebCryptoOperation*) = 0; |  156     virtual void initializationSucceeded(WebCryptoOperation*) = 0; | 
|  156     virtual void completeWithError() = 0; |  157     virtual void completeWithError() = 0; | 
|  157     virtual void completeWithArrayBuffer(const WebArrayBuffer&) = 0; |  158     virtual void completeWithArrayBuffer(const WebArrayBuffer&) = 0; | 
 |  159     virtual void completeWithBoolean(bool) = 0; | 
|  158  |  160  | 
|  159     virtual void ref() = 0; |  161     virtual void ref() = 0; | 
|  160     virtual void deref() = 0; |  162     virtual void deref() = 0; | 
|  161 }; |  163 }; | 
|  162  |  164  | 
|  163 // FIXME: Add error types. |  165 // FIXME: Add error types. | 
|  164 class WebCryptoOperationResult { |  166 class WebCryptoOperationResult { | 
|  165 public: |  167 public: | 
|  166     explicit WebCryptoOperationResult(WebCryptoOperationResultPrivate* impl) |  168     explicit WebCryptoOperationResult(WebCryptoOperationResultPrivate* impl) | 
|  167     { |  169     { | 
| (...skipping 10 matching lines...) Expand all  Loading... | 
|  178     WebCryptoOperationResult& operator=(const WebCryptoOperationResult& o) |  180     WebCryptoOperationResult& operator=(const WebCryptoOperationResult& o) | 
|  179     { |  181     { | 
|  180         assign(o); |  182         assign(o); | 
|  181         return *this; |  183         return *this; | 
|  182     } |  184     } | 
|  183  |  185  | 
|  184     WEBKIT_EXPORT void initializationFailed(); |  186     WEBKIT_EXPORT void initializationFailed(); | 
|  185     WEBKIT_EXPORT void initializationSucceeded(WebCryptoOperation*); |  187     WEBKIT_EXPORT void initializationSucceeded(WebCryptoOperation*); | 
|  186     WEBKIT_EXPORT void completeWithError(); |  188     WEBKIT_EXPORT void completeWithError(); | 
|  187     WEBKIT_EXPORT void completeWithArrayBuffer(const WebArrayBuffer&); |  189     WEBKIT_EXPORT void completeWithArrayBuffer(const WebArrayBuffer&); | 
 |  190     WEBKIT_EXPORT void completeWithBoolean(bool); | 
|  188  |  191  | 
|  189 private: |  192 private: | 
|  190     WEBKIT_EXPORT void reset(); |  193     WEBKIT_EXPORT void reset(); | 
|  191     WEBKIT_EXPORT void assign(const WebCryptoOperationResult&); |  194     WEBKIT_EXPORT void assign(const WebCryptoOperationResult&); | 
|  192     WEBKIT_EXPORT void assign(WebCryptoOperationResultPrivate*); |  195     WEBKIT_EXPORT void assign(WebCryptoOperationResultPrivate*); | 
|  193  |  196  | 
|  194     WebPrivatePtr<WebCryptoOperationResultPrivate> m_impl; |  197     WebPrivatePtr<WebCryptoOperationResultPrivate> m_impl; | 
|  195 }; |  198 }; | 
|  196  |  199  | 
|  197 class WebCryptoKeyOperation { |  200 class WebCryptoKeyOperation { | 
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  248     WEBKIT_EXPORT void reset(); |  251     WEBKIT_EXPORT void reset(); | 
|  249     WEBKIT_EXPORT void assign(const WebCryptoKeyOperationResult&); |  252     WEBKIT_EXPORT void assign(const WebCryptoKeyOperationResult&); | 
|  250     WEBKIT_EXPORT void assign(WebCryptoKeyOperationResultPrivate*); |  253     WEBKIT_EXPORT void assign(WebCryptoKeyOperationResultPrivate*); | 
|  251  |  254  | 
|  252     WebPrivatePtr<WebCryptoKeyOperationResultPrivate> m_impl; |  255     WebPrivatePtr<WebCryptoKeyOperationResultPrivate> m_impl; | 
|  253 }; |  256 }; | 
|  254  |  257  | 
|  255 } // namespace WebKit |  258 } // namespace WebKit | 
|  256  |  259  | 
|  257 #endif |  260 #endif | 
| OLD | NEW |