Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(20)

Side by Side Diff: content/renderer/webcrypto_digest.h

Issue 19757011: WebCrypto: Implement digest() using NSS (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: More documentation of interfaces, use of scoped_ptr for better memory management. Created 7 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « content/content_tests.gypi ('k') | content/renderer/webcrypto_digest_nss.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(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_
OLDNEW
« no previous file with comments | « content/content_tests.gypi ('k') | content/renderer/webcrypto_digest_nss.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698