Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef CONTENT_RENDERER_WEBCRYPTO_DIGEST_H_ | |
| 6 #define CONTENT_RENDERER_WEBCRYPTO_DIGEST_H_ | |
| 7 | |
| 8 #include "base/compiler_specific.h" | |
| 9 #include "base/memory/scoped_ptr.h" | |
| 10 | |
| 11 #include "third_party/WebKit/public/platform/WebCrypto.h" | |
| 12 #include "third_party/WebKit/public/platform/WebCryptoAlgorithm.h" | |
| 13 | |
| 14 #if defined(USE_NSS) | |
| 15 typedef struct HASHContextStr HASHContext; | |
| 16 #endif | |
| 17 | |
| 18 namespace content { | |
| 19 | |
| 20 class WebCryptoDigest : public WebKit::WebCryptoOperation { | |
| 21 public: | |
| 22 explicit WebCryptoDigest(const WebKit::WebCryptoOperationResult& result); | |
| 23 virtual ~WebCryptoDigest(); | |
| 24 | |
| 25 bool Initialize(const WebKit::WebCryptoAlgorithm& algorithm); | |
| 26 | |
| 27 // WebKit::WebCryptoOperation implementation | |
| 28 // | |
| 29 // Feeds data to the digest operation. | |
| 30 // - |bytes| may be 0 if |size| is 0 | |
| 31 // - |bytes| is valid only until process() returns | |
| 32 // - process() will not be called after abort() or finish() | |
| 33 virtual void process(const unsigned char* bytes, size_t size); | |
| 34 // Cancels the in-process digest operation. | |
| 35 virtual void abort(); | |
| 36 // Indicates that there is no more data to receive. | |
| 37 virtual void finish(); | |
| 38 | |
| 39 private: | |
| 40 WebKit::WebCryptoOperationResult result_; | |
| 41 | |
| 42 #if defined(USE_NSS) | |
| 43 struct HASHDeleter { | |
| 44 void operator()(void* ptr) const; | |
| 45 }; | |
| 46 scoped_ptr<HASHContext, HASHDeleter> context_; | |
|
Ryan Sleevi
2013/08/13 18:58:16
style: You should just be able to forward declare
Bryan Eyler
2013/08/13 23:24:12
I get compile-time errors if I try to forward-decl
Ryan Sleevi
2013/08/13 23:24:47
Yes
Bryan Eyler
2013/08/13 23:34:08
Done.
| |
| 47 #endif | |
| 48 }; | |
| 49 | |
| 50 } // namespace content | |
| 51 | |
| 52 #endif // CONTENT_RENDERER_WEBCRYPTO_DIGEST_H_ | |
| OLD | NEW |