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 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
68 class WebCryptoAlgorithmPrivate; | 68 class WebCryptoAlgorithmPrivate; |
69 | 69 |
70 // The WebCryptoAlgorithm represents a normalized algorithm and its parameters. | 70 // The WebCryptoAlgorithm represents a normalized algorithm and its parameters. |
71 // * Immutable | 71 // * Immutable |
72 // * Threadsafe | 72 // * Threadsafe |
73 // * Copiable (cheaply) | 73 // * Copiable (cheaply) |
74 class WebCryptoAlgorithm { | 74 class WebCryptoAlgorithm { |
75 public: | 75 public: |
76 #if WEBKIT_IMPLEMENTATION | 76 #if WEBKIT_IMPLEMENTATION |
77 WebCryptoAlgorithm() { } | 77 WebCryptoAlgorithm() { } |
78 WebCryptoAlgorithm(WebCryptoAlgorithmId, const char*, PassOwnPtr<WebCryptoAl gorithmParams>); | 78 WebCryptoAlgorithm(WebCryptoAlgorithmId, const char* name, PassOwnPtr<WebCry ptoAlgorithmParams>); |
79 #else | |
80 WebCryptoAlgorithm(WebCryptoAlgorithmId id, const char* name, WebCryptoAlgor ithmParams* params) | |
81 { | |
82 assign(id, name, params); | |
83 } | |
abarth-chromium
2013/07/31 00:46:51
It's not at all obvious that this constructor take
eroman
2013/07/31 01:49:26
Good idea. Done
| |
79 #endif | 84 #endif |
80 | 85 |
81 ~WebCryptoAlgorithm() { reset(); } | 86 ~WebCryptoAlgorithm() { reset(); } |
82 | 87 |
83 WebCryptoAlgorithm(const WebCryptoAlgorithm& other) { assign(other); } | 88 WebCryptoAlgorithm(const WebCryptoAlgorithm& other) { assign(other); } |
84 WebCryptoAlgorithm& operator=(const WebCryptoAlgorithm& other) | 89 WebCryptoAlgorithm& operator=(const WebCryptoAlgorithm& other) |
85 { | 90 { |
86 assign(other); | 91 assign(other); |
87 return *this; | 92 return *this; |
88 } | 93 } |
89 | 94 |
90 WEBKIT_EXPORT WebCryptoAlgorithmId id() const; | 95 WEBKIT_EXPORT WebCryptoAlgorithmId id() const; |
91 WEBKIT_EXPORT const char* name() const; | 96 WEBKIT_EXPORT const char* name() const; |
92 | 97 |
93 WEBKIT_EXPORT WebCryptoAlgorithmParamsType paramsType() const; | 98 WEBKIT_EXPORT WebCryptoAlgorithmParamsType paramsType() const; |
94 | 99 |
95 // Retrieves the type-specific parameters. The algorithm contains at most 1 | 100 // Retrieves the type-specific parameters. The algorithm contains at most 1 |
96 // type of parameters. Retrieving an invalid parameter will return 0. | 101 // type of parameters. Retrieving an invalid parameter will return 0. |
97 WEBKIT_EXPORT WebCryptoAesCbcParams* aesCbcParams() const; | 102 WEBKIT_EXPORT WebCryptoAesCbcParams* aesCbcParams() const; |
98 WEBKIT_EXPORT WebCryptoAesKeyGenParams* aesKeyGenParams() const; | 103 WEBKIT_EXPORT WebCryptoAesKeyGenParams* aesKeyGenParams() const; |
99 WEBKIT_EXPORT WebCryptoHmacParams* hmacParams() const; | 104 WEBKIT_EXPORT WebCryptoHmacParams* hmacParams() const; |
100 | 105 |
101 private: | 106 private: |
102 WEBKIT_EXPORT void assign(const WebCryptoAlgorithm& other); | 107 WEBKIT_EXPORT void assign(const WebCryptoAlgorithm& other); |
108 WEBKIT_EXPORT void assign(WebCryptoAlgorithmId, const char* name, WebCryptoA lgorithmParams*); | |
103 WEBKIT_EXPORT void reset(); | 109 WEBKIT_EXPORT void reset(); |
104 | 110 |
105 WebPrivatePtr<WebCryptoAlgorithmPrivate> m_private; | 111 WebPrivatePtr<WebCryptoAlgorithmPrivate> m_private; |
106 }; | 112 }; |
107 | 113 |
108 } // namespace WebKit | 114 } // namespace WebKit |
109 | 115 |
110 #endif | 116 #endif |
OLD | NEW |