| OLD | NEW |
| 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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 const WebCryptoKeyUsageMask usages; | 56 const WebCryptoKeyUsageMask usages; |
| 57 }; | 57 }; |
| 58 | 58 |
| 59 WebCryptoKey WebCryptoKey::create(WebCryptoKeyHandle* handle, WebCryptoKeyType t
ype, bool extractable, const WebCryptoAlgorithm& algorithm, WebCryptoKeyUsageMas
k usages) | 59 WebCryptoKey WebCryptoKey::create(WebCryptoKeyHandle* handle, WebCryptoKeyType t
ype, bool extractable, const WebCryptoAlgorithm& algorithm, WebCryptoKeyUsageMas
k usages) |
| 60 { | 60 { |
| 61 WebCryptoKey key; | 61 WebCryptoKey key; |
| 62 key.m_private = adoptRef(new WebCryptoKeyPrivate(adoptPtr(handle), type, ext
ractable, algorithm, usages)); | 62 key.m_private = adoptRef(new WebCryptoKeyPrivate(adoptPtr(handle), type, ext
ractable, algorithm, usages)); |
| 63 return key; | 63 return key; |
| 64 } | 64 } |
| 65 | 65 |
| 66 WebCryptoKey WebCryptoKey::createNull() |
| 67 { |
| 68 return WebCryptoKey(); |
| 69 } |
| 70 |
| 66 WebCryptoKeyHandle* WebCryptoKey::handle() const | 71 WebCryptoKeyHandle* WebCryptoKey::handle() const |
| 67 { | 72 { |
| 73 ASSERT(!isNull()); |
| 68 return m_private->handle.get(); | 74 return m_private->handle.get(); |
| 69 } | 75 } |
| 70 | 76 |
| 71 WebCryptoKeyType WebCryptoKey::type() const | 77 WebCryptoKeyType WebCryptoKey::type() const |
| 72 { | 78 { |
| 79 ASSERT(!isNull()); |
| 73 return m_private->type; | 80 return m_private->type; |
| 74 } | 81 } |
| 75 | 82 |
| 76 bool WebCryptoKey::extractable() const | 83 bool WebCryptoKey::extractable() const |
| 77 { | 84 { |
| 85 ASSERT(!isNull()); |
| 78 return m_private->extractable; | 86 return m_private->extractable; |
| 79 } | 87 } |
| 80 | 88 |
| 81 const WebCryptoAlgorithm& WebCryptoKey::algorithm() const | 89 const WebCryptoAlgorithm& WebCryptoKey::algorithm() const |
| 82 { | 90 { |
| 91 ASSERT(!isNull()); |
| 83 return m_private->algorithm; | 92 return m_private->algorithm; |
| 84 } | 93 } |
| 85 | 94 |
| 86 WebCryptoKeyUsageMask WebCryptoKey::usages() const | 95 WebCryptoKeyUsageMask WebCryptoKey::usages() const |
| 87 { | 96 { |
| 97 ASSERT(!isNull()); |
| 88 return m_private->usages; | 98 return m_private->usages; |
| 89 } | 99 } |
| 90 | 100 |
| 101 bool WebCryptoKey::isNull() const |
| 102 { |
| 103 return m_private.isNull(); |
| 104 } |
| 105 |
| 91 void WebCryptoKey::assign(const WebCryptoKey& other) | 106 void WebCryptoKey::assign(const WebCryptoKey& other) |
| 92 { | 107 { |
| 93 m_private = other.m_private; | 108 m_private = other.m_private; |
| 94 } | 109 } |
| 95 | 110 |
| 96 void WebCryptoKey::reset() | 111 void WebCryptoKey::reset() |
| 97 { | 112 { |
| 98 m_private.reset(); | 113 m_private.reset(); |
| 99 } | 114 } |
| 100 | 115 |
| 101 } // namespace WebKit | 116 } // namespace WebKit |
| OLD | NEW |