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