Index: public/platform/WebCryptoAlgorithmParams.h |
diff --git a/public/platform/WebDeviceMotionData.h b/public/platform/WebCryptoAlgorithmParams.h |
similarity index 54% |
copy from public/platform/WebDeviceMotionData.h |
copy to public/platform/WebCryptoAlgorithmParams.h |
index 140d8f21ff8c1bb94251428551452a6de463fa02..eea3ab7eb18059e4cf4d589db5fbf28515eb3b9c 100644 |
--- a/public/platform/WebDeviceMotionData.h |
+++ b/public/platform/WebCryptoAlgorithmParams.h |
@@ -28,55 +28,65 @@ |
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
*/ |
-#ifndef WebDeviceMotionData_h |
-#define WebDeviceMotionData_h |
+#ifndef WebCryptoAlgorithmParams_h |
+#define WebCryptoAlgorithmParams_h |
#include "WebCommon.h" |
+#include "WebCryptoAlgorithm.h" |
+#include "WebVector.h" |
namespace WebKit { |
-#pragma pack(push, 1) |
+// NOTE: For documentation on the meaning of each of the parameters see the |
+// Web crypto spec: |
+// |
+// http://www.w3.org/TR/WebCryptoAPI |
+// |
+// The parameters in the spec have the same name, minus the "WebCrypto" prefix. |
-class WebDeviceMotionData { |
+class WebCryptoAlgorithmParams { |
public: |
- WEBKIT_EXPORT WebDeviceMotionData(); |
- ~WebDeviceMotionData() { } |
+ WebCryptoAlgorithmParams(WebCryptoAlgorithmParamsType type) |
+ : m_type(type) |
+ { |
+ } |
- double accelerationX; |
- double accelerationY; |
- double accelerationZ; |
+ virtual ~WebCryptoAlgorithmParams() { } |
- double accelerationIncludingGravityX; |
- double accelerationIncludingGravityY; |
- double accelerationIncludingGravityZ; |
+ WebCryptoAlgorithmParamsType type() const { return m_type; } |
- double rotationRateAlpha; |
- double rotationRateBeta; |
- double rotationRateGamma; |
- |
- double interval; |
- |
- bool hasAccelerationX : 1; |
- bool hasAccelerationY : 1; |
- bool hasAccelerationZ : 1; |
+private: |
+ WebCryptoAlgorithmParamsType m_type; |
+}; |
- bool hasAccelerationIncludingGravityX : 1; |
- bool hasAccelerationIncludingGravityY : 1; |
- bool hasAccelerationIncludingGravityZ : 1; |
+class WebCryptoAesCbcParams : public WebCryptoAlgorithmParams { |
+public: |
+ WebCryptoAesCbcParams(unsigned char* iv, size_t ivSize) |
+ : WebCryptoAlgorithmParams(WebCryptoAlgorithmParamsTypeAesCbcParams) |
+ , m_iv(iv, ivSize) |
+ { |
+ } |
- bool hasRotationRateAlpha : 1; |
- bool hasRotationRateBeta : 1; |
- bool hasRotationRateGamma : 1; |
+ const WebVector<unsigned char>& iv() const { return m_iv; } |
- bool allAvailableSensorsAreActive : 1; |
+private: |
+ const WebVector<unsigned char> m_iv; |
}; |
-#if WEBKIT_IMPLEMENTATION |
-COMPILE_ASSERT(sizeof(WebDeviceMotionData) == (10 * sizeof(double) + 2 * sizeof(char)), WebDeviceMotionData_has_wrong_size); |
-#endif |
+class WebCryptoAesKeyGenParams : public WebCryptoAlgorithmParams { |
+public: |
+ WebCryptoAesKeyGenParams(unsigned short length) |
+ : WebCryptoAlgorithmParams(WebCryptoAlgorithmParamsTypeAesKeyGenParams) |
+ , m_length(length) |
+ { |
+ } |
+ |
+ unsigned short length() const { return m_length; } |
-#pragma pack(pop) |
+private: |
+ const unsigned short m_length; |
+}; |
} // namespace WebKit |
-#endif // WebDeviceMotionData_h |
+#endif |