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 21 matching lines...) Expand all Loading... |
32 #include "public/platform/WebCryptoAlgorithm.h" | 32 #include "public/platform/WebCryptoAlgorithm.h" |
33 | 33 |
34 #include "public/platform/WebCryptoAlgorithmParams.h" | 34 #include "public/platform/WebCryptoAlgorithmParams.h" |
35 #include "wtf/OwnPtr.h" | 35 #include "wtf/OwnPtr.h" |
36 #include "wtf/ThreadSafeRefCounted.h" | 36 #include "wtf/ThreadSafeRefCounted.h" |
37 | 37 |
38 namespace WebKit { | 38 namespace WebKit { |
39 | 39 |
40 class WebCryptoAlgorithmPrivate : public ThreadSafeRefCounted<WebCryptoAlgorithm
Private> { | 40 class WebCryptoAlgorithmPrivate : public ThreadSafeRefCounted<WebCryptoAlgorithm
Private> { |
41 public: | 41 public: |
42 WebCryptoAlgorithmPrivate(WebCryptoAlgorithmId algorithmId, const char* algo
rithmName, PassOwnPtr<WebCryptoAlgorithmParams> params) | 42 WebCryptoAlgorithmPrivate(WebCryptoAlgorithmId id, const char* name, PassOwn
Ptr<WebCryptoAlgorithmParams> params) |
43 : algorithmId(algorithmId) | 43 : id(id) |
44 , algorithmName(algorithmName) | 44 , name(name) |
45 , params(params) | 45 , params(params) |
46 { | 46 { |
47 } | 47 } |
48 | 48 |
49 WebCryptoAlgorithmId algorithmId; | 49 WebCryptoAlgorithmId id; |
50 const char* const algorithmName; | 50 const char* const name; |
51 OwnPtr<WebCryptoAlgorithmParams> params; | 51 OwnPtr<WebCryptoAlgorithmParams> params; |
52 }; | 52 }; |
53 | 53 |
54 WebCryptoAlgorithm::WebCryptoAlgorithm(WebCryptoAlgorithmId algorithmId, const c
har* algorithmName, PassOwnPtr<WebCryptoAlgorithmParams> params) | 54 WebCryptoAlgorithm::WebCryptoAlgorithm(WebCryptoAlgorithmId id, const char* name
, PassOwnPtr<WebCryptoAlgorithmParams> params) |
55 : m_private(adoptRef(new WebCryptoAlgorithmPrivate(algorithmId, algorithmNam
e, params))) | 55 : m_private(adoptRef(new WebCryptoAlgorithmPrivate(id, name, params))) |
56 { | 56 { |
57 } | 57 } |
58 | 58 |
59 WebCryptoAlgorithmId WebCryptoAlgorithm::algorithmId() const | 59 WebCryptoAlgorithmId WebCryptoAlgorithm::id() const |
60 { | 60 { |
61 return m_private->algorithmId; | 61 return m_private->id; |
62 } | 62 } |
63 | 63 |
64 const char* WebCryptoAlgorithm::algorithmName() const | 64 const char* WebCryptoAlgorithm::name() const |
65 { | 65 { |
66 return m_private->algorithmName; | 66 return m_private->name; |
67 } | 67 } |
68 | 68 |
69 WebCryptoAlgorithmParamsType WebCryptoAlgorithm::paramsType() const | 69 WebCryptoAlgorithmParamsType WebCryptoAlgorithm::paramsType() const |
70 { | 70 { |
71 if (!m_private->params) | 71 if (!m_private->params) |
72 return WebCryptoAlgorithmParamsTypeNone; | 72 return WebCryptoAlgorithmParamsTypeNone; |
73 return m_private->params->type(); | 73 return m_private->params->type(); |
74 } | 74 } |
75 | 75 |
76 WebCryptoAesCbcParams* WebCryptoAlgorithm::aesCbcParams() const | 76 WebCryptoAesCbcParams* WebCryptoAlgorithm::aesCbcParams() const |
(...skipping 14 matching lines...) Expand all Loading... |
91 { | 91 { |
92 m_private = other.m_private; | 92 m_private = other.m_private; |
93 } | 93 } |
94 | 94 |
95 void WebCryptoAlgorithm::reset() | 95 void WebCryptoAlgorithm::reset() |
96 { | 96 { |
97 m_private.reset(); | 97 m_private.reset(); |
98 } | 98 } |
99 | 99 |
100 } // namespace WebKit | 100 } // namespace WebKit |
OLD | NEW |