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

Side by Side Diff: public/platform/WebCrypto.h

Issue 23338006: Cleanup: remove WebCryptoResultPrivate from blink API. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Remove extra newline Created 7 years, 3 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
« no previous file with comments | « Source/modules/modules.gypi ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 17 matching lines...) Expand all
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 */ 29 */
30 30
31 #ifndef WebCrypto_h 31 #ifndef WebCrypto_h
32 #define WebCrypto_h 32 #define WebCrypto_h
33 33
34 #include "WebCommon.h" 34 #include "WebCommon.h"
35 #include "WebCryptoKey.h" 35 #include "WebCryptoKey.h"
36 #include "WebPrivatePtr.h" 36 #include "WebPrivatePtr.h"
37 37
38 namespace WebCore { class CryptoResult; }
39
40 #if WEBKIT_IMPLEMENTATION
41 namespace WTF { template <typename T> class PassRefPtr; }
42 #endif
43
38 namespace WebKit { 44 namespace WebKit {
39 45
40 class WebArrayBuffer; 46 class WebArrayBuffer;
41 class WebCryptoOperation; 47 class WebCryptoOperation;
42 48
43 class WebCryptoResultPrivate {
44 public:
45 virtual void ref() = 0;
46 virtual void deref() = 0;
47
48 virtual void completeWithError() = 0;
49 virtual void completeWithBuffer(const WebArrayBuffer&) = 0;
50 virtual void completeWithBoolean(bool) = 0;
51 virtual void completeWithKey(const WebCryptoKey&) = 0;
52
53 protected:
54 virtual ~WebCryptoResultPrivate() { }
55 };
56
57 class WebCryptoResult { 49 class WebCryptoResult {
58 public: 50 public:
59 explicit WebCryptoResult(WebCryptoResultPrivate* impl)
60 {
61 assign(impl);
62 }
63
64 WebCryptoResult(const WebCryptoResult& o) 51 WebCryptoResult(const WebCryptoResult& o)
65 { 52 {
66 assign(o); 53 assign(o);
67 } 54 }
68 55
69 ~WebCryptoResult() 56 ~WebCryptoResult()
70 { 57 {
71 reset(); 58 reset();
72 } 59 }
73 60
74 WebCryptoResult& operator=(const WebCryptoResult& o) 61 WebCryptoResult& operator=(const WebCryptoResult& o)
75 { 62 {
76 assign(o); 63 assign(o);
77 return *this; 64 return *this;
78 } 65 }
79 66
80 WEBKIT_EXPORT void completeWithError(); 67 WEBKIT_EXPORT void completeWithError();
81 WEBKIT_EXPORT void completeWithBuffer(const WebArrayBuffer&); 68 WEBKIT_EXPORT void completeWithBuffer(const WebArrayBuffer&);
82 WEBKIT_EXPORT void completeWithBuffer(const void*, size_t); 69 WEBKIT_EXPORT void completeWithBuffer(const void*, size_t);
83 WEBKIT_EXPORT void completeWithBoolean(bool); 70 WEBKIT_EXPORT void completeWithBoolean(bool);
84 WEBKIT_EXPORT void completeWithKey(const WebCryptoKey&); 71 WEBKIT_EXPORT void completeWithKey(const WebCryptoKey&);
85 72
73 #if WEBKIT_IMPLEMENTATION
74 explicit WebCryptoResult(const WTF::PassRefPtr<WebCore::CryptoResult>&);
75 #endif
76
86 private: 77 private:
87 WEBKIT_EXPORT void reset(); 78 WEBKIT_EXPORT void reset();
88 WEBKIT_EXPORT void assign(const WebCryptoResult&); 79 WEBKIT_EXPORT void assign(const WebCryptoResult&);
89 WEBKIT_EXPORT void assign(WebCryptoResultPrivate*);
90 80
91 WebPrivatePtr<WebCryptoResultPrivate> m_impl; 81 WebPrivatePtr<WebCore::CryptoResult> m_impl;
92 }; 82 };
93 83
94 class WebCrypto { 84 class WebCrypto {
95 public: 85 public:
96 // FIXME: Deprecated, delete once chromium side is updated. 86 // FIXME: Deprecated, delete once chromium side is updated.
97 virtual WebCryptoOperation* digest(const WebCryptoAlgorithm&) { WEBKIT_ASSER T_NOT_REACHED(); return 0; } 87 virtual WebCryptoOperation* digest(const WebCryptoAlgorithm&) { WEBKIT_ASSER T_NOT_REACHED(); return 0; }
98 88
99 // Starts a one-shot cryptographic operation which can complete either 89 // Starts a one-shot cryptographic operation which can complete either
100 // synchronously, or asynchronously. 90 // synchronously, or asynchronously.
101 // 91 //
102 // Let the WebCryptoResult be called "result". 92 // Let the WebCryptoResult be called "result".
103 // 93 //
104 // The result should be set exactly once, from the same thread which 94 // The result should be set exactly once, from the same thread which
105 // initiated the operation. 95 // initiated the operation.
106 virtual void encrypt(const WebCryptoAlgorithm&, const WebCryptoKey&, const u nsigned char* data, size_t data_size, WebCryptoResult) { WEBKIT_ASSERT_NOT_REACH ED(); } 96 virtual void encrypt(const WebCryptoAlgorithm&, const WebCryptoKey&, const u nsigned char* data, size_t data_size, WebCryptoResult) { WEBKIT_ASSERT_NOT_REACH ED(); }
107 virtual void decrypt(const WebCryptoAlgorithm&, const WebCryptoKey&, const u nsigned char* data, size_t data_size, WebCryptoResult) { WEBKIT_ASSERT_NOT_REACH ED(); } 97 virtual void decrypt(const WebCryptoAlgorithm&, const WebCryptoKey&, const u nsigned char* data, size_t data_size, WebCryptoResult) { WEBKIT_ASSERT_NOT_REACH ED(); }
108 virtual void sign(const WebCryptoAlgorithm&, const WebCryptoKey&, const unsi gned char* data, size_t data_size, WebCryptoResult) { WEBKIT_ASSERT_NOT_REACHED( ); } 98 virtual void sign(const WebCryptoAlgorithm&, const WebCryptoKey&, const unsi gned char* data, size_t data_size, WebCryptoResult) { WEBKIT_ASSERT_NOT_REACHED( ); }
109 virtual void verifySignature(const WebCryptoAlgorithm&, const WebCryptoKey&, const unsigned char* signature, size_t signature_size, const unsigned char* dat a, size_t data_size, WebCryptoResult) { WEBKIT_ASSERT_NOT_REACHED(); } 99 virtual void verifySignature(const WebCryptoAlgorithm&, const WebCryptoKey&, const unsigned char* signature, size_t signature_size, const unsigned char* dat a, size_t data_size, WebCryptoResult) { WEBKIT_ASSERT_NOT_REACHED(); }
110 virtual void digest(const WebCryptoAlgorithm&, const unsigned char* data, si ze_t data_size, WebCryptoResult) { WEBKIT_ASSERT_NOT_REACHED(); } 100 virtual void digest(const WebCryptoAlgorithm&, const unsigned char* data, si ze_t data_size, WebCryptoResult) { WEBKIT_ASSERT_NOT_REACHED(); }
111 virtual void generateKey(const WebCryptoAlgorithm&, bool extractable, WebCry ptoKeyUsageMask, WebCryptoResult) { WEBKIT_ASSERT_NOT_REACHED(); } 101 virtual void generateKey(const WebCryptoAlgorithm&, bool extractable, WebCry ptoKeyUsageMask, WebCryptoResult) { WEBKIT_ASSERT_NOT_REACHED(); }
112 virtual void importKey(WebCryptoKeyFormat, const unsigned char* keyData, siz e_t keyDataSize, const WebCryptoAlgorithm&, bool extractable, WebCryptoKeyUsageM ask, WebCryptoResult) { WEBKIT_ASSERT_NOT_REACHED(); } 102 virtual void importKey(WebCryptoKeyFormat, const unsigned char* keyData, siz e_t keyDataSize, const WebCryptoAlgorithm&, bool extractable, WebCryptoKeyUsageM ask, WebCryptoResult) { WEBKIT_ASSERT_NOT_REACHED(); }
113 103
114 protected: 104 protected:
115 virtual ~WebCrypto() { } 105 virtual ~WebCrypto() { }
116 }; 106 };
117 107
118 } // namespace WebKit 108 } // namespace WebKit
119 109
120 #endif 110 #endif
OLDNEW
« no previous file with comments | « Source/modules/modules.gypi ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698