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

Unified Diff: content/child/webcrypto/algorithm_dispatch.cc

Issue 794873002: Refactor: Remove switch statements on key format from algorithm_dispatch.cc (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | content/child/webcrypto/algorithm_implementation.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/child/webcrypto/algorithm_dispatch.cc
diff --git a/content/child/webcrypto/algorithm_dispatch.cc b/content/child/webcrypto/algorithm_dispatch.cc
index 253dc311a4d4df5412d4bd7d2b29c5d0dbce92bc..1a0b247e8e13d518e578896aa7eadf571f29ea8a 100644
--- a/content/child/webcrypto/algorithm_dispatch.cc
+++ b/content/child/webcrypto/algorithm_dispatch.cc
@@ -58,18 +58,7 @@ Status ExportKeyDontCheckExtractability(blink::WebCryptoKeyFormat format,
if (status.IsError())
return status;
- switch (format) {
- case blink::WebCryptoKeyFormatRaw:
- return impl->ExportKeyRaw(key, buffer);
- case blink::WebCryptoKeyFormatSpki:
- return impl->ExportKeySpki(key, buffer);
- case blink::WebCryptoKeyFormatPkcs8:
- return impl->ExportKeyPkcs8(key, buffer);
- case blink::WebCryptoKeyFormatJwk:
- return impl->ExportKeyJwk(key, buffer);
- default:
- return Status::ErrorUnsupported();
- }
+ return impl->ExportKey(format, key, buffer);
}
} // namespace
@@ -148,19 +137,7 @@ Status ImportKey(blink::WebCryptoKeyFormat format,
if (status.IsError())
return status;
- switch (format) {
- case blink::WebCryptoKeyFormatRaw:
- return impl->ImportKeyRaw(key_data, algorithm, extractable, usages, key);
- case blink::WebCryptoKeyFormatSpki:
- return impl->ImportKeySpki(key_data, algorithm, extractable, usages, key);
- case blink::WebCryptoKeyFormatPkcs8:
- return impl->ImportKeyPkcs8(key_data, algorithm, extractable, usages,
- key);
- case blink::WebCryptoKeyFormatJwk:
- return impl->ImportKeyJwk(key_data, algorithm, extractable, usages, key);
- default:
- return Status::ErrorUnsupported();
- }
+ return impl->ImportKey(format, key_data, algorithm, extractable, usages, key);
}
Status ExportKey(blink::WebCryptoKeyFormat format,
« no previous file with comments | « no previous file | content/child/webcrypto/algorithm_implementation.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698