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

Side by Side Diff: content/renderer/webcrypto/crypto_data.h

Issue 155623005: Refactor to share more code between OpenSSL and NSS implementations. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix for openssl Created 6 years, 10 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 | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright (c) 2014 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_CRYPTO_DATA_
6 #define CONTENT_RENDERER_WEBCRYPTO_CRYPTO_DATA_
7
8 #include <string>
9 #include <vector>
10
11 #include "base/basictypes.h"
12 #include "content/common/content_export.h"
13
14 namespace blink {
15 class WebArrayBuffer;
16 }
17
18 namespace content {
19
20 namespace webcrypto {
21
22 // Helper to pass around a range of immutable bytes. This is conceptually
23 // similar to StringPiece, but for crypto byte data.
Ryan Sleevi 2014/02/07 01:19:21 base::StringPiece
eroman 2014/02/07 21:15:57 Done.
24 //
25 // The data used at construction is NOT owned, and should remain valid as long
26 // as the CryptoData is being used.
27 class CONTENT_EXPORT CryptoData {
28 public:
29 // Constructs empty data.
30 CryptoData();
31
32 CryptoData(const unsigned char* bytes, unsigned int byte_length);
33
34 // Allow implicit conversions for convenience.
35 CryptoData(const std::vector<unsigned char>& bytes);
36 CryptoData(const std::string& bytes);
37 CryptoData(const blink::WebArrayBuffer& buffer);
Ryan Sleevi 2014/02/07 01:19:21 style guide says: boo http://google-styleguide.go
eroman 2014/02/07 21:15:57 I am aware of the style guide, however I was model
38
39 const unsigned char* bytes() const { return bytes_; }
40 unsigned int byte_length() const { return byte_length_; }
41
42 private:
43 const unsigned char* bytes_;
44 const unsigned int byte_length_;
45
46 // Copying would not be safe, since the data is not owned.
47 DISALLOW_COPY_AND_ASSIGN(CryptoData);
Ryan Sleevi 2014/02/07 01:19:21 This comment doesn't make any sense. Just because
eroman 2014/02/07 21:15:57 Copies are dangerous, since they encourage develop
Ryan Sleevi 2014/02/07 21:18:49 I still don't believe this does anything to reduce
48 };
49
50 } // namespace webcrypto
51
52 } // namespace content
53
54 #endif // CONTENT_RENDERER_WEBCRYPTO_CRYPTO_DATA_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698