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

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

Issue 99083002: WIP: Migrate generated bindings to new ExceptionState constructor. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rebase. Created 7 years 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
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 14 matching lines...) Expand all
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/NormalizeAlgorithm.h" 32 #include "modules/crypto/NormalizeAlgorithm.h"
33 33
34 #include "bindings/v8/Dictionary.h" 34 #include "bindings/v8/Dictionary.h"
35 #include "bindings/v8/ExceptionMessages.h"
36 #include "bindings/v8/ExceptionState.h" 35 #include "bindings/v8/ExceptionState.h"
37 #include "core/dom/ExceptionCode.h" 36 #include "core/dom/ExceptionCode.h"
38 #include "platform/NotImplemented.h" 37 #include "platform/NotImplemented.h"
39 #include "public/platform/WebCryptoAlgorithmParams.h" 38 #include "public/platform/WebCryptoAlgorithmParams.h"
40 #include "wtf/ArrayBuffer.h" 39 #include "wtf/ArrayBuffer.h"
41 #include "wtf/ArrayBufferView.h" 40 #include "wtf/ArrayBufferView.h"
42 #include "wtf/HashMap.h" 41 #include "wtf/HashMap.h"
43 #include "wtf/MathExtras.h" 42 #include "wtf/MathExtras.h"
44 #include "wtf/Uint8Array.h" 43 #include "wtf/Uint8Array.h"
45 #include "wtf/Vector.h" 44 #include "wtf/Vector.h"
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after
219 for (size_t i = 0; i < m_messages.size(); ++i) 218 for (size_t i = 0; i < m_messages.size(); ++i)
220 length += strlen(m_messages[i]); 219 length += strlen(m_messages[i]);
221 result.reserveCapacity(length); 220 result.reserveCapacity(length);
222 221
223 for (size_t i = 0; i < m_messages.size(); ++i) { 222 for (size_t i = 0; i < m_messages.size(); ++i) {
224 if (i) 223 if (i)
225 result.append(Separator, strlen(Separator)); 224 result.append(Separator, strlen(Separator));
226 result.append(m_messages[i], strlen(m_messages[i])); 225 result.append(m_messages[i], strlen(m_messages[i]));
227 } 226 }
228 227
229 return ExceptionMessages::failedToExecute(algorithmOperationToName(m_op) , "SubtleCrypto", result.toString()); 228 return result.toString();
230 } 229 }
231 230
232 String toString(const char* message) const 231 String toString(const char* message) const
233 { 232 {
234 ExceptionContext stack(*this); 233 ExceptionContext stack(*this);
235 stack.add(message); 234 stack.add(message);
236 return stack.toString(); 235 return stack.toString();
237 } 236 }
238 237
239 String toString(const char* message1, const char* message2) const 238 String toString(const char* message1, const char* message2) const
(...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after
537 bool normalizeAlgorithm(const Dictionary& raw, AlgorithmOperation op, blink::Web CryptoAlgorithm& algorithm, ExceptionState& exceptionState) 536 bool normalizeAlgorithm(const Dictionary& raw, AlgorithmOperation op, blink::Web CryptoAlgorithm& algorithm, ExceptionState& exceptionState)
538 { 537 {
539 return normalizeAlgorithm(raw, op, algorithm, ExceptionContext(op), exceptio nState); 538 return normalizeAlgorithm(raw, op, algorithm, ExceptionContext(op), exceptio nState);
540 } 539 }
541 540
542 const char* algorithmIdToName(blink::WebCryptoAlgorithmId id) 541 const char* algorithmIdToName(blink::WebCryptoAlgorithmId id)
543 { 542 {
544 return AlgorithmRegistry::instance().lookupAlgorithmById(id)->algorithmName; 543 return AlgorithmRegistry::instance().lookupAlgorithmById(id)->algorithmName;
545 } 544 }
546 545
547 const char* algorithmOperationToName(AlgorithmOperation op)
548 {
549 switch (op) {
550 case Encrypt:
551 return "encrypt";
552 case Decrypt:
553 return "decrypt";
554 case Sign:
555 return "sign";
556 case Verify:
557 return "verify";
558 case Digest:
559 return "digest";
560 case GenerateKey:
561 return "generateKey";
562 case ImportKey:
563 return "importKey";
564 case DeriveKey:
565 return "deriveKey";
566 case WrapKey:
567 return "wrapKey";
568 case UnwrapKey:
569 return "unwrapKey";
570 case NumberOfAlgorithmOperations:
571 ASSERT_NOT_REACHED();
572 return "unknown";
573 };
574 ASSERT_NOT_REACHED();
575 return "unknown";
576 }
577
578 } // namespace WebCore 546 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/modules/crypto/NormalizeAlgorithm.h ('k') | Source/modules/filesystem/DirectoryReaderSync.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698