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

Side by Side Diff: third_party/WebKit/Source/platform/exported/WebCryptoKeyAlgorithm.cpp

Issue 2494333002: Replace wrapUnique(new T(args)) by makeUnique<T>(args) in Blink (Closed)
Patch Set: Drop redundant WTF:: Created 4 years, 1 month 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) 2014 Google Inc. All rights reserved. 2 * Copyright (C) 2014 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 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 } 66 }
67 67
68 WebCryptoKeyAlgorithm WebCryptoKeyAlgorithm::createAes( 68 WebCryptoKeyAlgorithm WebCryptoKeyAlgorithm::createAes(
69 WebCryptoAlgorithmId id, 69 WebCryptoAlgorithmId id,
70 unsigned short keyLengthBits) { 70 unsigned short keyLengthBits) {
71 // FIXME: Verify that id is an AES algorithm. 71 // FIXME: Verify that id is an AES algorithm.
72 // FIXME: Move this somewhere more general. 72 // FIXME: Move this somewhere more general.
73 if (keyLengthBits != 128 && keyLengthBits != 192 && keyLengthBits != 256) 73 if (keyLengthBits != 128 && keyLengthBits != 192 && keyLengthBits != 256)
74 return WebCryptoKeyAlgorithm(); 74 return WebCryptoKeyAlgorithm();
75 return WebCryptoKeyAlgorithm( 75 return WebCryptoKeyAlgorithm(
76 id, wrapUnique(new WebCryptoAesKeyAlgorithmParams(keyLengthBits))); 76 id, makeUnique<WebCryptoAesKeyAlgorithmParams>(keyLengthBits));
77 } 77 }
78 78
79 WebCryptoKeyAlgorithm WebCryptoKeyAlgorithm::createHmac( 79 WebCryptoKeyAlgorithm WebCryptoKeyAlgorithm::createHmac(
80 WebCryptoAlgorithmId hash, 80 WebCryptoAlgorithmId hash,
81 unsigned keyLengthBits) { 81 unsigned keyLengthBits) {
82 if (!WebCryptoAlgorithm::isHash(hash)) 82 if (!WebCryptoAlgorithm::isHash(hash))
83 return WebCryptoKeyAlgorithm(); 83 return WebCryptoKeyAlgorithm();
84 return WebCryptoKeyAlgorithm(WebCryptoAlgorithmIdHmac, 84 return WebCryptoKeyAlgorithm(WebCryptoAlgorithmIdHmac,
85 wrapUnique(new WebCryptoHmacKeyAlgorithmParams( 85 wrapUnique(new WebCryptoHmacKeyAlgorithmParams(
86 createHash(hash), keyLengthBits))); 86 createHash(hash), keyLengthBits)));
(...skipping 11 matching lines...) Expand all
98 return WebCryptoKeyAlgorithm( 98 return WebCryptoKeyAlgorithm(
99 id, wrapUnique(new WebCryptoRsaHashedKeyAlgorithmParams( 99 id, wrapUnique(new WebCryptoRsaHashedKeyAlgorithmParams(
100 modulusLengthBits, publicExponent, publicExponentSize, 100 modulusLengthBits, publicExponent, publicExponentSize,
101 createHash(hash)))); 101 createHash(hash))));
102 } 102 }
103 103
104 WebCryptoKeyAlgorithm WebCryptoKeyAlgorithm::createEc( 104 WebCryptoKeyAlgorithm WebCryptoKeyAlgorithm::createEc(
105 WebCryptoAlgorithmId id, 105 WebCryptoAlgorithmId id,
106 WebCryptoNamedCurve namedCurve) { 106 WebCryptoNamedCurve namedCurve) {
107 return WebCryptoKeyAlgorithm( 107 return WebCryptoKeyAlgorithm(
108 id, wrapUnique(new WebCryptoEcKeyAlgorithmParams(namedCurve))); 108 id, makeUnique<WebCryptoEcKeyAlgorithmParams>(namedCurve));
109 } 109 }
110 110
111 WebCryptoKeyAlgorithm WebCryptoKeyAlgorithm::createWithoutParams( 111 WebCryptoKeyAlgorithm WebCryptoKeyAlgorithm::createWithoutParams(
112 WebCryptoAlgorithmId id) { 112 WebCryptoAlgorithmId id) {
113 if (!WebCryptoAlgorithm::isKdf(id)) 113 if (!WebCryptoAlgorithm::isKdf(id))
114 return WebCryptoKeyAlgorithm(); 114 return WebCryptoKeyAlgorithm();
115 return WebCryptoKeyAlgorithm(id, nullptr); 115 return WebCryptoKeyAlgorithm(id, nullptr);
116 } 116 }
117 117
118 bool WebCryptoKeyAlgorithm::isNull() const { 118 bool WebCryptoKeyAlgorithm::isNull() const {
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
173 173
174 void WebCryptoKeyAlgorithm::assign(const WebCryptoKeyAlgorithm& other) { 174 void WebCryptoKeyAlgorithm::assign(const WebCryptoKeyAlgorithm& other) {
175 m_private = other.m_private; 175 m_private = other.m_private;
176 } 176 }
177 177
178 void WebCryptoKeyAlgorithm::reset() { 178 void WebCryptoKeyAlgorithm::reset() {
179 m_private.reset(); 179 m_private.reset();
180 } 180 }
181 181
182 } // namespace blink 182 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/platform/exported/WebCredential.cpp ('k') | third_party/WebKit/Source/platform/fonts/FontCache.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698