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

Side by Side Diff: content/child/webcrypto/status.cc

Issue 689883002: Throw a SyntaxError when importing keys with invalid usages (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 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 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/child/webcrypto/status.h" 5 #include "content/child/webcrypto/status.h"
6 6
7 namespace content { 7 namespace content {
8 8
9 namespace webcrypto { 9 namespace webcrypto {
10 10
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after
231 return Status(blink::WebCryptoErrorTypeInvalidAccess, 231 return Status(blink::WebCryptoErrorTypeInvalidAccess,
232 "They key is not extractable"); 232 "They key is not extractable");
233 } 233 }
234 234
235 Status Status::ErrorGenerateKeyLength() { 235 Status Status::ErrorGenerateKeyLength() {
236 return Status(blink::WebCryptoErrorTypeData, 236 return Status(blink::WebCryptoErrorTypeData,
237 "Invalid key length: it is either zero or not a multiple of 8 " 237 "Invalid key length: it is either zero or not a multiple of 8 "
238 "bits"); 238 "bits");
239 } 239 }
240 240
241 Status Status::ErrorCreateKeyBadUsages() { 241 Status Status::SyntaxError() {
242 return Status(blink::WebCryptoErrorTypeData, 242 return Status(blink::WebCryptoErrorTypeSyntax,
eroman 2014/10/30 19:03:30 The formatting is not correct. Run "git cl format"
243 "Cannot create a key using the specified key usages."); 243 "");
244 } 244 }
245 245
246 Status Status::SyntaxError(const std::string& parameter) {
247 return Status(blink::WebCryptoErrorTypeSyntax,
248 "Parameter '" +parameter + "' was missing or out-of-range.");
eroman 2014/10/30 19:03:30 The formatting is incorrect. Run "git cl format" t
249 }
246 Status::Status(blink::WebCryptoErrorType error_type, 250 Status::Status(blink::WebCryptoErrorType error_type,
247 const std::string& error_details_utf8) 251 const std::string& error_details_utf8)
248 : type_(TYPE_ERROR), 252 : type_(TYPE_ERROR),
249 error_type_(error_type), 253 error_type_(error_type),
250 error_details_(error_details_utf8) { 254 error_details_(error_details_utf8) {
251 } 255 }
252 256
253 Status::Status(Type type) : type_(type) { 257 Status::Status(Type type) : type_(type) {
254 } 258 }
255 259
256 } // namespace webcrypto 260 } // namespace webcrypto
257 261
258 } // namespace content 262 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698