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

Unified Diff: Source/modules/crypto/Key.cpp

Issue 61773005: Rename WebKit namespace to blink (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/modules/crypto/Key.h ('k') | Source/modules/crypto/KeyPair.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/modules/crypto/Key.cpp
diff --git a/Source/modules/crypto/Key.cpp b/Source/modules/crypto/Key.cpp
index 7f6ae98ec4a51f9a119d570b7a7b4969abe254c6..e8080950df1cca5104422095cbd392f226f89359 100644
--- a/Source/modules/crypto/Key.cpp
+++ b/Source/modules/crypto/Key.cpp
@@ -40,14 +40,14 @@ namespace WebCore {
namespace {
-const char* keyTypeToString(WebKit::WebCryptoKeyType type)
+const char* keyTypeToString(blink::WebCryptoKeyType type)
{
switch (type) {
- case WebKit::WebCryptoKeyTypeSecret:
+ case blink::WebCryptoKeyTypeSecret:
return "secret";
- case WebKit::WebCryptoKeyTypePublic:
+ case blink::WebCryptoKeyTypePublic:
return "public";
- case WebKit::WebCryptoKeyTypePrivate:
+ case blink::WebCryptoKeyTypePrivate:
return "private";
}
ASSERT_NOT_REACHED();
@@ -55,23 +55,23 @@ const char* keyTypeToString(WebKit::WebCryptoKeyType type)
}
struct KeyUsageMapping {
- WebKit::WebCryptoKeyUsage value;
+ blink::WebCryptoKeyUsage value;
const char* const name;
};
const KeyUsageMapping keyUsageMappings[] = {
- { WebKit::WebCryptoKeyUsageEncrypt, "encrypt" },
- { WebKit::WebCryptoKeyUsageDecrypt, "decrypt" },
- { WebKit::WebCryptoKeyUsageSign, "sign" },
- { WebKit::WebCryptoKeyUsageVerify, "verify" },
- { WebKit::WebCryptoKeyUsageDeriveKey, "deriveKey" },
- { WebKit::WebCryptoKeyUsageWrapKey, "wrapKey" },
- { WebKit::WebCryptoKeyUsageUnwrapKey, "unwrapKey" },
+ { blink::WebCryptoKeyUsageEncrypt, "encrypt" },
+ { blink::WebCryptoKeyUsageDecrypt, "decrypt" },
+ { blink::WebCryptoKeyUsageSign, "sign" },
+ { blink::WebCryptoKeyUsageVerify, "verify" },
+ { blink::WebCryptoKeyUsageDeriveKey, "deriveKey" },
+ { blink::WebCryptoKeyUsageWrapKey, "wrapKey" },
+ { blink::WebCryptoKeyUsageUnwrapKey, "unwrapKey" },
};
-COMPILE_ASSERT(WebKit::EndOfWebCryptoKeyUsage == (1 << 6) + 1, update_keyUsageMappings);
+COMPILE_ASSERT(blink::EndOfWebCryptoKeyUsage == (1 << 6) + 1, update_keyUsageMappings);
-const char* keyUsageToString(WebKit::WebCryptoKeyUsage usage)
+const char* keyUsageToString(blink::WebCryptoKeyUsage usage)
{
for (size_t i = 0; i < WTF_ARRAY_LENGTH(keyUsageMappings); ++i) {
if (keyUsageMappings[i].value == usage)
@@ -81,7 +81,7 @@ const char* keyUsageToString(WebKit::WebCryptoKeyUsage usage)
return 0;
}
-WebKit::WebCryptoKeyUsageMask keyUsageStringToMask(const String& usageString)
+blink::WebCryptoKeyUsageMask keyUsageStringToMask(const String& usageString)
{
for (size_t i = 0; i < WTF_ARRAY_LENGTH(keyUsageMappings); ++i) {
if (keyUsageMappings[i].name == usageString)
@@ -90,23 +90,23 @@ WebKit::WebCryptoKeyUsageMask keyUsageStringToMask(const String& usageString)
return 0;
}
-WebKit::WebCryptoKeyUsageMask toKeyUsage(AlgorithmOperation operation)
+blink::WebCryptoKeyUsageMask toKeyUsage(AlgorithmOperation operation)
{
switch (operation) {
case Encrypt:
- return WebKit::WebCryptoKeyUsageEncrypt;
+ return blink::WebCryptoKeyUsageEncrypt;
case Decrypt:
- return WebKit::WebCryptoKeyUsageDecrypt;
+ return blink::WebCryptoKeyUsageDecrypt;
case Sign:
- return WebKit::WebCryptoKeyUsageSign;
+ return blink::WebCryptoKeyUsageSign;
case Verify:
- return WebKit::WebCryptoKeyUsageVerify;
+ return blink::WebCryptoKeyUsageVerify;
case DeriveKey:
- return WebKit::WebCryptoKeyUsageDeriveKey;
+ return blink::WebCryptoKeyUsageDeriveKey;
case WrapKey:
- return WebKit::WebCryptoKeyUsageWrapKey;
+ return blink::WebCryptoKeyUsageWrapKey;
case UnwrapKey:
- return WebKit::WebCryptoKeyUsageUnwrapKey;
+ return blink::WebCryptoKeyUsageUnwrapKey;
case Digest:
case GenerateKey:
case ImportKey:
@@ -118,7 +118,7 @@ WebKit::WebCryptoKeyUsageMask toKeyUsage(AlgorithmOperation operation)
return 0;
}
-bool getHmacHashId(const WebKit::WebCryptoAlgorithm& algorithm, WebKit::WebCryptoAlgorithmId& hashId)
+bool getHmacHashId(const blink::WebCryptoAlgorithm& algorithm, blink::WebCryptoAlgorithmId& hashId)
{
if (algorithm.hmacParams()) {
hashId = algorithm.hmacParams()->hash().id();
@@ -137,7 +137,7 @@ Key::~Key()
{
}
-Key::Key(const WebKit::WebCryptoKey& key)
+Key::Key(const blink::WebCryptoKey& key)
: m_key(key)
{
ScriptWrappable::init(this);
@@ -168,14 +168,14 @@ Vector<String> Key::usages() const
{
Vector<String> result;
for (size_t i = 0; i < WTF_ARRAY_LENGTH(keyUsageMappings); ++i) {
- WebKit::WebCryptoKeyUsage usage = keyUsageMappings[i].value;
+ blink::WebCryptoKeyUsage usage = keyUsageMappings[i].value;
if (m_key.usages() & usage)
result.append(keyUsageToString(usage));
}
return result;
}
-bool Key::canBeUsedForAlgorithm(const WebKit::WebCryptoAlgorithm& algorithm, AlgorithmOperation op, ExceptionState& es) const
+bool Key::canBeUsedForAlgorithm(const blink::WebCryptoAlgorithm& algorithm, AlgorithmOperation op, ExceptionState& es) const
{
if (!(m_key.usages() & toKeyUsage(op))) {
es.throwDOMException(NotSupportedError, "key.usages does not permit this operation");
@@ -190,9 +190,9 @@ bool Key::canBeUsedForAlgorithm(const WebKit::WebCryptoAlgorithm& algorithm, Alg
// Verify that the algorithm-specific parameters for the key conform to the
// algorithm.
- if (m_key.algorithm().id() == WebKit::WebCryptoAlgorithmIdHmac) {
- WebKit::WebCryptoAlgorithmId keyHash;
- WebKit::WebCryptoAlgorithmId algorithmHash;
+ if (m_key.algorithm().id() == blink::WebCryptoAlgorithmIdHmac) {
+ blink::WebCryptoAlgorithmId keyHash;
+ blink::WebCryptoAlgorithmId algorithmHash;
if (!getHmacHashId(m_key.algorithm(), keyHash) || !getHmacHashId(algorithm, algorithmHash) || keyHash != algorithmHash) {
es.throwDOMException(NotSupportedError, "key.algorithm does not match that of operation (HMAC's hash differs)");
return false;
@@ -202,23 +202,23 @@ bool Key::canBeUsedForAlgorithm(const WebKit::WebCryptoAlgorithm& algorithm, Alg
return true;
}
-bool Key::parseFormat(const String& formatString, WebKit::WebCryptoKeyFormat& format, ExceptionState& es)
+bool Key::parseFormat(const String& formatString, blink::WebCryptoKeyFormat& format, ExceptionState& es)
{
// There are few enough values that testing serially is fast enough.
if (formatString == "raw") {
- format = WebKit::WebCryptoKeyFormatRaw;
+ format = blink::WebCryptoKeyFormatRaw;
return true;
}
if (formatString == "pkcs8") {
- format = WebKit::WebCryptoKeyFormatPkcs8;
+ format = blink::WebCryptoKeyFormatPkcs8;
return true;
}
if (formatString == "spki") {
- format = WebKit::WebCryptoKeyFormatSpki;
+ format = blink::WebCryptoKeyFormatSpki;
return true;
}
if (formatString == "jwk") {
- format = WebKit::WebCryptoKeyFormatJwk;
+ format = blink::WebCryptoKeyFormatJwk;
return true;
}
@@ -226,11 +226,11 @@ bool Key::parseFormat(const String& formatString, WebKit::WebCryptoKeyFormat& fo
return false;
}
-bool Key::parseUsageMask(const Vector<String>& usages, WebKit::WebCryptoKeyUsageMask& mask, ExceptionState& es)
+bool Key::parseUsageMask(const Vector<String>& usages, blink::WebCryptoKeyUsageMask& mask, ExceptionState& es)
{
mask = 0;
for (size_t i = 0; i < usages.size(); ++i) {
- WebKit::WebCryptoKeyUsageMask usage = keyUsageStringToMask(usages[i]);
+ blink::WebCryptoKeyUsageMask usage = keyUsageStringToMask(usages[i]);
if (!usage) {
es.throwTypeError("Invalid keyUsages argument");
return false;
« no previous file with comments | « Source/modules/crypto/Key.h ('k') | Source/modules/crypto/KeyPair.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698