OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 #ifndef IntegrityMetadata_h | 5 #ifndef IntegrityMetadata_h |
6 #define IntegrityMetadata_h | 6 #define IntegrityMetadata_h |
7 | 7 |
8 #include "core/CoreExport.h" | |
9 #include "platform/Crypto.h" | 8 #include "platform/Crypto.h" |
| 9 #include "platform/PlatformExport.h" |
10 #include "wtf/HashSet.h" | 10 #include "wtf/HashSet.h" |
11 #include "wtf/StringHasher.h" | 11 #include "wtf/StringHasher.h" |
12 #include "wtf/text/StringHash.h" | 12 #include "wtf/text/StringHash.h" |
13 #include "wtf/text/WTFString.h" | 13 #include "wtf/text/WTFString.h" |
14 | 14 |
15 namespace blink { | 15 namespace blink { |
16 | 16 |
17 class IntegrityMetadata; | 17 class IntegrityMetadata; |
18 | 18 |
19 using IntegrityMetadataPair = std::pair<WTF::String, HashAlgorithm>; | 19 using IntegrityMetadataPair = std::pair<WTF::String, HashAlgorithm>; |
20 using IntegrityMetadataSet = WTF::HashSet<IntegrityMetadataPair>; | 20 using IntegrityMetadataSet = WTF::HashSet<IntegrityMetadataPair>; |
21 | 21 |
22 class CORE_EXPORT IntegrityMetadata { | 22 class PLATFORM_EXPORT IntegrityMetadata { |
23 public: | 23 public: |
24 IntegrityMetadata() {} | 24 IntegrityMetadata() {} |
25 IntegrityMetadata(WTF::String digest, HashAlgorithm); | 25 IntegrityMetadata(WTF::String digest, HashAlgorithm); |
26 IntegrityMetadata(std::pair<WTF::String, HashAlgorithm>); | 26 IntegrityMetadata(std::pair<WTF::String, HashAlgorithm>); |
27 | 27 |
28 WTF::String digest() const { return m_digest; } | 28 WTF::String digest() const { return m_digest; } |
29 void setDigest(const WTF::String& digest) { m_digest = digest; } | 29 void setDigest(const WTF::String& digest) { m_digest = digest; } |
30 HashAlgorithm algorithm() const { return m_algorithm; } | 30 HashAlgorithm algorithm() const { return m_algorithm; } |
31 void setAlgorithm(HashAlgorithm algorithm) { m_algorithm = algorithm; } | 31 void setAlgorithm(HashAlgorithm algorithm) { m_algorithm = algorithm; } |
32 | 32 |
33 IntegrityMetadataPair toPair() const; | 33 IntegrityMetadataPair toPair() const; |
34 | 34 |
35 static bool setsEqual(const IntegrityMetadataSet& set1, | 35 static bool setsEqual(const IntegrityMetadataSet& set1, |
36 const IntegrityMetadataSet& set2); | 36 const IntegrityMetadataSet& set2); |
37 | 37 |
38 private: | 38 private: |
39 WTF::String m_digest; | 39 WTF::String m_digest; |
40 HashAlgorithm m_algorithm; | 40 HashAlgorithm m_algorithm; |
41 }; | 41 }; |
42 | 42 |
43 enum class ResourceIntegrityDisposition { NotChecked = 0, Failed, Passed }; | 43 enum class ResourceIntegrityDisposition { NotChecked = 0, Failed, Passed }; |
44 | 44 |
45 } // namespace blink | 45 } // namespace blink |
46 | 46 |
47 #endif | 47 #endif |
OLD | NEW |