OLD | NEW |
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/algorithm_registry.h" | 5 #include "components/webcrypto/algorithm_registry.h" |
6 | 6 |
7 #include "base/lazy_instance.h" | 7 #include "base/lazy_instance.h" |
8 #include "content/child/webcrypto/algorithm_implementation.h" | 8 #include "components/webcrypto/algorithm_implementation.h" |
9 #include "content/child/webcrypto/platform_crypto.h" | 9 #include "components/webcrypto/platform_crypto.h" |
10 #include "content/child/webcrypto/status.h" | 10 #include "components/webcrypto/status.h" |
11 | |
12 namespace content { | |
13 | 11 |
14 namespace webcrypto { | 12 namespace webcrypto { |
15 | 13 |
16 namespace { | 14 namespace { |
17 | 15 |
18 // This class is used as a singleton. All methods must be threadsafe. | 16 // This class is used as a singleton. All methods must be threadsafe. |
19 class AlgorithmRegistry { | 17 class AlgorithmRegistry { |
20 public: | 18 public: |
21 AlgorithmRegistry() | 19 AlgorithmRegistry() |
22 : sha_(CreatePlatformShaImplementation()), | 20 : sha_(CreatePlatformShaImplementation()), |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
95 | 93 |
96 Status GetAlgorithmImplementation(blink::WebCryptoAlgorithmId id, | 94 Status GetAlgorithmImplementation(blink::WebCryptoAlgorithmId id, |
97 const AlgorithmImplementation** impl) { | 95 const AlgorithmImplementation** impl) { |
98 *impl = g_algorithm_registry.Get().GetAlgorithm(id); | 96 *impl = g_algorithm_registry.Get().GetAlgorithm(id); |
99 if (*impl) | 97 if (*impl) |
100 return Status::Success(); | 98 return Status::Success(); |
101 return Status::ErrorUnsupported(); | 99 return Status::ErrorUnsupported(); |
102 } | 100 } |
103 | 101 |
104 } // namespace webcrypto | 102 } // namespace webcrypto |
105 | |
106 } // namespace content | |
OLD | NEW |