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 10 matching lines...) Expand all Loading... |
21 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | 21 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | 22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | 23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
29 */ | 29 */ |
30 | 30 |
31 #ifndef WebDeviceMotionData_h | 31 #ifndef WebCryptoAlgorithmParams_h |
32 #define WebDeviceMotionData_h | 32 #define WebCryptoAlgorithmParams_h |
33 | 33 |
34 #include "WebCommon.h" | 34 #include "WebCommon.h" |
| 35 #include "WebCryptoAlgorithm.h" |
| 36 #include "WebVector.h" |
35 | 37 |
36 namespace WebKit { | 38 namespace WebKit { |
37 | 39 |
38 #pragma pack(push, 1) | 40 // NOTE: For documentation on the meaning of each of the parameters see the |
| 41 // Web crypto spec: |
| 42 // |
| 43 // http://www.w3.org/TR/WebCryptoAPI |
| 44 // |
| 45 // The parameters in the spec have the same name, minus the "WebCrypto" pr
efix. |
39 | 46 |
40 class WebDeviceMotionData { | 47 class WebCryptoAlgorithmParams { |
41 public: | 48 public: |
42 WEBKIT_EXPORT WebDeviceMotionData(); | 49 WebCryptoAlgorithmParams(WebCryptoAlgorithmParamsType type) |
43 ~WebDeviceMotionData() { } | 50 : m_type(type) |
| 51 { |
| 52 } |
44 | 53 |
45 double accelerationX; | 54 virtual ~WebCryptoAlgorithmParams() { } |
46 double accelerationY; | |
47 double accelerationZ; | |
48 | 55 |
49 double accelerationIncludingGravityX; | 56 WebCryptoAlgorithmParamsType type() const { return m_type; } |
50 double accelerationIncludingGravityY; | |
51 double accelerationIncludingGravityZ; | |
52 | 57 |
53 double rotationRateAlpha; | 58 private: |
54 double rotationRateBeta; | 59 WebCryptoAlgorithmParamsType m_type; |
55 double rotationRateGamma; | |
56 | |
57 double interval; | |
58 | |
59 bool hasAccelerationX : 1; | |
60 bool hasAccelerationY : 1; | |
61 bool hasAccelerationZ : 1; | |
62 | |
63 bool hasAccelerationIncludingGravityX : 1; | |
64 bool hasAccelerationIncludingGravityY : 1; | |
65 bool hasAccelerationIncludingGravityZ : 1; | |
66 | |
67 bool hasRotationRateAlpha : 1; | |
68 bool hasRotationRateBeta : 1; | |
69 bool hasRotationRateGamma : 1; | |
70 | |
71 bool allAvailableSensorsAreActive : 1; | |
72 }; | 60 }; |
73 | 61 |
74 #if WEBKIT_IMPLEMENTATION | 62 class WebCryptoAesCbcParams : public WebCryptoAlgorithmParams { |
75 COMPILE_ASSERT(sizeof(WebDeviceMotionData) == (10 * sizeof(double) + 2 * sizeof(
char)), WebDeviceMotionData_has_wrong_size); | 63 public: |
76 #endif | 64 WebCryptoAesCbcParams(unsigned char* iv, size_t ivSize) |
| 65 : WebCryptoAlgorithmParams(WebCryptoAlgorithmParamsTypeAesCbcParams) |
| 66 , m_iv(iv, ivSize) |
| 67 { |
| 68 } |
77 | 69 |
78 #pragma pack(pop) | 70 const WebVector<unsigned char>& iv() const { return m_iv; } |
| 71 |
| 72 private: |
| 73 const WebVector<unsigned char> m_iv; |
| 74 }; |
| 75 |
| 76 class WebCryptoAesKeyGenParams : public WebCryptoAlgorithmParams { |
| 77 public: |
| 78 WebCryptoAesKeyGenParams(unsigned short length) |
| 79 : WebCryptoAlgorithmParams(WebCryptoAlgorithmParamsTypeAesKeyGenParams) |
| 80 , m_length(length) |
| 81 { |
| 82 } |
| 83 |
| 84 unsigned short length() const { return m_length; } |
| 85 |
| 86 private: |
| 87 const unsigned short m_length; |
| 88 }; |
79 | 89 |
80 } // namespace WebKit | 90 } // namespace WebKit |
81 | 91 |
82 #endif // WebDeviceMotionData_h | 92 #endif |
OLD | NEW |