Index: public/platform/WebCryptoAlgorithm.h |
diff --git a/public/platform/WebRTCConfiguration.h b/public/platform/WebCryptoAlgorithm.h |
similarity index 50% |
copy from public/platform/WebRTCConfiguration.h |
copy to public/platform/WebCryptoAlgorithm.h |
index e641ba7aa17ad43bc9ffe231bd09ec3094bf9a56..7703614a1a945719a40981b3a147bb4aec2a9892 100644 |
--- a/public/platform/WebRTCConfiguration.h |
+++ b/public/platform/WebCryptoAlgorithm.h |
@@ -1,5 +1,5 @@ |
/* |
- * Copyright (C) 2012 Google Inc. All rights reserved. |
+ * Copyright (C) 2013 Google Inc. All rights reserved. |
* |
* Redistribution and use in source and binary forms, with or without |
* modification, are permitted provided that the following conditions are |
@@ -28,80 +28,79 @@ |
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
*/ |
-#ifndef WebRTCConfiguration_h |
-#define WebRTCConfiguration_h |
+#ifndef WebCryptoAlgorithm_h |
+#define WebCryptoAlgorithm_h |
#include "WebCommon.h" |
-#include "WebNonCopyable.h" |
#include "WebPrivatePtr.h" |
-#include "WebVector.h" |
-namespace WebCore { |
-class RTCIceServer; |
-class RTCConfiguration; |
-} |
+#if WEBKIT_IMPLEMENTATION |
+#include "wtf/PassOwnPtr.h" |
+#endif |
namespace WebKit { |
-class WebString; |
-class WebURL; |
- |
-class WebRTCICEServer { |
-public: |
- WebRTCICEServer() { } |
- WebRTCICEServer(const WebRTCICEServer& other) { assign(other); } |
- ~WebRTCICEServer() { reset(); } |
- WebRTCICEServer& operator=(const WebRTCICEServer& other) |
- { |
- assign(other); |
- return *this; |
- } |
+enum WebCryptoAlgorithmId { |
+ WebCryptoAlgorithmIdAesCbc, |
+ WebCryptoAlgorithmIdSha1, |
+ WebCryptoAlgorithmIdSha224, |
+ WebCryptoAlgorithmIdSha256, |
+ WebCryptoAlgorithmIdSha384, |
+ WebCryptoAlgorithmIdSha512, |
+#if WEBKIT_IMPLEMENTATION |
+ NumberOfWebCryptoAlgorithmId, |
+#endif |
+}; |
- WEBKIT_EXPORT void assign(const WebRTCICEServer&); |
+enum WebCryptoAlgorithmParamsType { |
+ WebCryptoAlgorithmParamsTypeNone, |
+ WebCryptoAlgorithmParamsTypeAesCbcParams, |
+ WebCryptoAlgorithmParamsTypeAesKeyGenParams, |
+}; |
- WEBKIT_EXPORT void reset(); |
- bool isNull() const { return m_private.isNull(); } |
+class WebCryptoAesCbcParams; |
+class WebCryptoAesKeyGenParams; |
- WEBKIT_EXPORT WebURL uri() const; |
- WEBKIT_EXPORT WebString username() const; |
- WEBKIT_EXPORT WebString credential() const; |
+class WebCryptoAlgorithmParams; |
+class WebCryptoAlgorithmPrivate; |
+// The WebCryptoAlgorithm represents a normalized algorithm and its parameters. |
+// * Immutable |
+// * Threadsafe |
+// * Copiable (cheaply) |
+class WebCryptoAlgorithm { |
+public: |
#if WEBKIT_IMPLEMENTATION |
- WebRTCICEServer(const WTF::PassRefPtr<WebCore::RTCIceServer>&); |
+ WebCryptoAlgorithm() { } |
+ WebCryptoAlgorithm(WebCryptoAlgorithmId, const char*, PassOwnPtr<WebCryptoAlgorithmParams>); |
#endif |
-private: |
- WebPrivatePtr<WebCore::RTCIceServer> m_private; |
-}; |
- |
-class WebRTCConfiguration { |
-public: |
- WebRTCConfiguration() { } |
- WebRTCConfiguration(const WebRTCConfiguration& other) { assign(other); } |
- ~WebRTCConfiguration() { reset(); } |
+ ~WebCryptoAlgorithm() { reset(); } |
- WebRTCConfiguration& operator=(const WebRTCConfiguration& other) |
+ WebCryptoAlgorithm(const WebCryptoAlgorithm& other) { assign(other); } |
+ WebCryptoAlgorithm& operator=(const WebCryptoAlgorithm& other) |
{ |
assign(other); |
return *this; |
} |
- WEBKIT_EXPORT void assign(const WebRTCConfiguration&); |
- |
- WEBKIT_EXPORT void reset(); |
- bool isNull() const { return m_private.isNull(); } |
+ WEBKIT_EXPORT WebCryptoAlgorithmId algorithmId() const; |
+ WEBKIT_EXPORT const char* algorithmName() const; |
- WEBKIT_EXPORT size_t numberOfServers() const; |
- WEBKIT_EXPORT WebRTCICEServer server(size_t index) const; |
+ WEBKIT_EXPORT WebCryptoAlgorithmParamsType paramsType() const; |
-#if WEBKIT_IMPLEMENTATION |
- WebRTCConfiguration(const WTF::PassRefPtr<WebCore::RTCConfiguration>&); |
-#endif |
+ // Retrieves the type-specific parameters. The algorithm contains at most 1 |
+ // type of parameters. Retrieving an invalid parameter will return 0. |
+ WebCryptoAesCbcParams* aesCbcParams() const; |
+ WebCryptoAesKeyGenParams* aesKeyGenParams() const; |
private: |
- WebPrivatePtr<WebCore::RTCConfiguration> m_private; |
+ WEBKIT_EXPORT void assign(const WebCryptoAlgorithm& other); |
+ WEBKIT_EXPORT void reset(); |
+ |
+ WebPrivatePtr<WebCryptoAlgorithmPrivate> m_private; |
}; |
} // namespace WebKit |
-#endif // WebRTCConfiguration_h |
+#endif |