Index: content/renderer/webcrypto_digest.h |
diff --git a/content/renderer/webcrypto_digest.h b/content/renderer/webcrypto_digest.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..b0142a5e5fb18abb22636d0037696bbd8b5e06d0 |
--- /dev/null |
+++ b/content/renderer/webcrypto_digest.h |
@@ -0,0 +1,46 @@ |
+// Copyright (c) 2013 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#ifndef CONTENT_RENDERER_WEBCRYPTO_DIGEST_H_ |
+#define CONTENT_RENDERER_WEBCRYPTO_DIGEST_H_ |
+ |
+#include "base/compiler_specific.h" |
+ |
+#include "third_party/WebKit/public/platform/WebCrypto.h" |
+#include "third_party/WebKit/public/platform/WebCryptoAlgorithm.h" |
+ |
+#if defined(USE_NSS) |
+typedef struct HASHContextStr HASHContext; |
+#endif |
+ |
+namespace content { |
+ |
+class WebCryptoDigest : public WebKit::WebCryptoOperation { |
+ public: |
+ explicit WebCryptoDigest(const WebKit::WebCryptoOperationResult& result); |
+ virtual ~WebCryptoDigest(); |
+ |
+ bool Initialize(const WebKit::WebCryptoAlgorithm& algorithm); |
+ |
+ // Feeds data to the digest operation. |
+ // - |bytes| may be 0 if |size| is 0 |
+ // - |bytes| is valid only until process() returns |
+ // - process() will not be called after abort() or finish() |
+ virtual void process(const unsigned char* bytes, size_t size); |
jamesr
2013/08/09 20:04:55
add a documenting what these override. for example
Bryan Eyler
2013/08/13 18:22:21
Done.
|
+ // Cancels the in-process digest operation. |
+ virtual void abort(); |
+ // Indicates that there is no more data to receive. |
+ virtual void finish(); |
+ |
+ private: |
+ WebKit::WebCryptoOperationResult result_; |
+ |
+#if defined(USE_NSS) |
+ HASHContext* context_; |
+#endif |
+}; |
+ |
+} // namespace content |
+ |
+#endif // CONTENT_RENDERER_WEBCRYPTO_DIGEST_H_ |