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

Side by Side Diff: Source/modules/crypto/SubtleCrypto.cpp

Issue 19724003: Revert "Transition modules/** to use ExceptionState" (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 5 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/crypto/SubtleCrypto.h ('k') | Source/modules/encryptedmedia/MediaKeySession.h » ('j') | 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 13 matching lines...) Expand all
24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
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 #include "config.h" 31 #include "config.h"
32 #include "modules/crypto/SubtleCrypto.h" 32 #include "modules/crypto/SubtleCrypto.h"
33 33
34 #include "bindings/v8/ExceptionState.h" 34 #include "core/dom/ExceptionCode.h"
35 #include "modules/crypto/CryptoOperation.h" 35 #include "modules/crypto/CryptoOperation.h"
36 #include "modules/crypto/NormalizeAlgorithm.h" 36 #include "modules/crypto/NormalizeAlgorithm.h"
37 #include "public/platform/WebArrayBuffer.h" // FIXME: temporary 37 #include "public/platform/WebArrayBuffer.h" // FIXME: temporary
38 #include "public/platform/WebCrypto.h" 38 #include "public/platform/WebCrypto.h"
39 #include "wtf/ArrayBuffer.h" 39 #include "wtf/ArrayBuffer.h"
40 #include "wtf/ArrayBufferView.h" 40 #include "wtf/ArrayBufferView.h"
41 #include "wtf/SHA1.h" // FIXME: temporary 41 #include "wtf/SHA1.h" // FIXME: temporary
42 42
43 43
44 namespace WebCore { 44 namespace WebCore {
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 }; 90 };
91 //------------------------------------------------------------------------------ 91 //------------------------------------------------------------------------------
92 92
93 } // namespace 93 } // namespace
94 94
95 SubtleCrypto::SubtleCrypto() 95 SubtleCrypto::SubtleCrypto()
96 { 96 {
97 ScriptWrappable::init(this); 97 ScriptWrappable::init(this);
98 } 98 }
99 99
100 PassRefPtr<CryptoOperation> SubtleCrypto::encrypt(const Dictionary& rawAlgorithm , ExceptionState& es) 100 PassRefPtr<CryptoOperation> SubtleCrypto::encrypt(const Dictionary& rawAlgorithm , ExceptionCode& ec)
101 { 101 {
102 WebKit::WebCryptoAlgorithm algorithm; 102 WebKit::WebCryptoAlgorithm algorithm;
103 if (!normalizeAlgorithm(rawAlgorithm, Encrypt, algorithm, es)) 103 if (!normalizeAlgorithm(rawAlgorithm, Encrypt, algorithm, ec))
104 return 0; 104 return 0;
105 return CryptoOperation::create(algorithm, new DummyOperation); 105 return CryptoOperation::create(algorithm, new DummyOperation);
106 } 106 }
107 107
108 PassRefPtr<CryptoOperation> SubtleCrypto::decrypt(const Dictionary& rawAlgorithm , ExceptionState& es) 108 PassRefPtr<CryptoOperation> SubtleCrypto::decrypt(const Dictionary& rawAlgorithm , ExceptionCode& ec)
109 { 109 {
110 WebKit::WebCryptoAlgorithm algorithm; 110 WebKit::WebCryptoAlgorithm algorithm;
111 if (!normalizeAlgorithm(rawAlgorithm, Decrypt, algorithm, es)) 111 if (!normalizeAlgorithm(rawAlgorithm, Decrypt, algorithm, ec))
112 return 0; 112 return 0;
113 return CryptoOperation::create(algorithm, new DummyOperation); 113 return CryptoOperation::create(algorithm, new DummyOperation);
114 } 114 }
115 115
116 PassRefPtr<CryptoOperation> SubtleCrypto::sign(const Dictionary& rawAlgorithm, E xceptionState& es) 116 PassRefPtr<CryptoOperation> SubtleCrypto::sign(const Dictionary& rawAlgorithm, E xceptionCode& ec)
117 { 117 {
118 WebKit::WebCryptoAlgorithm algorithm; 118 WebKit::WebCryptoAlgorithm algorithm;
119 if (!normalizeAlgorithm(rawAlgorithm, Sign, algorithm, es)) 119 if (!normalizeAlgorithm(rawAlgorithm, Sign, algorithm, ec))
120 return 0; 120 return 0;
121 return CryptoOperation::create(algorithm, new DummyOperation); 121 return CryptoOperation::create(algorithm, new DummyOperation);
122 } 122 }
123 123
124 PassRefPtr<CryptoOperation> SubtleCrypto::verifySignature(const Dictionary& rawA lgorithm, ExceptionState& es) 124 PassRefPtr<CryptoOperation> SubtleCrypto::verifySignature(const Dictionary& rawA lgorithm, ExceptionCode& ec)
125 { 125 {
126 WebKit::WebCryptoAlgorithm algorithm; 126 WebKit::WebCryptoAlgorithm algorithm;
127 if (!normalizeAlgorithm(rawAlgorithm, Verify, algorithm, es)) 127 if (!normalizeAlgorithm(rawAlgorithm, Verify, algorithm, ec))
128 return 0; 128 return 0;
129 return CryptoOperation::create(algorithm, new DummyOperation); 129 return CryptoOperation::create(algorithm, new DummyOperation);
130 } 130 }
131 131
132 PassRefPtr<CryptoOperation> SubtleCrypto::digest(const Dictionary& rawAlgorithm, ExceptionState& es) 132 PassRefPtr<CryptoOperation> SubtleCrypto::digest(const Dictionary& rawAlgorithm, ExceptionCode& ec)
133 { 133 {
134 WebKit::WebCryptoAlgorithm algorithm; 134 WebKit::WebCryptoAlgorithm algorithm;
135 if (!normalizeAlgorithm(rawAlgorithm, Digest, algorithm, es)) 135 if (!normalizeAlgorithm(rawAlgorithm, Digest, algorithm, ec))
136 return 0; 136 return 0;
137 137
138 // FIXME: Create the WebCryptoImplementation by calling out to 138 // FIXME: Create the WebCryptoImplementation by calling out to
139 // Platform::crypto() instead. 139 // Platform::crypto() instead.
140 WebKit::WebCryptoOperation* operationImpl = algorithm.id() == WebKit::WebCry ptoAlgorithmIdSha1 ? new MockSha1Operation : new DummyOperation; 140 WebKit::WebCryptoOperation* operationImpl = algorithm.id() == WebKit::WebCry ptoAlgorithmIdSha1 ? new MockSha1Operation : new DummyOperation;
141 141
142 return CryptoOperation::create(algorithm, operationImpl); 142 return CryptoOperation::create(algorithm, operationImpl);
143 } 143 }
144 144
145 } // namespace WebCore 145 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/modules/crypto/SubtleCrypto.h ('k') | Source/modules/encryptedmedia/MediaKeySession.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698