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 #ifndef SubresourceIntegrity_h | 5 #ifndef SubresourceIntegrity_h |
6 #define SubresourceIntegrity_h | 6 #define SubresourceIntegrity_h |
7 | 7 |
8 #include "base/gtest_prod_util.h" | 8 #include "base/gtest_prod_util.h" |
9 #include "core/CoreExport.h" | 9 #include "core/CoreExport.h" |
10 #include "platform/Crypto.h" | 10 #include "platform/Crypto.h" |
11 #include "platform/loader/fetch/IntegrityMetadata.h" | 11 #include "platform/loader/fetch/IntegrityMetadata.h" |
12 #include "wtf/Allocator.h" | 12 #include "wtf/Allocator.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 Element; | 17 class Document; |
18 class ExecutionContext; | 18 class ExecutionContext; |
19 class KURL; | 19 class KURL; |
20 class Resource; | 20 class Resource; |
21 | 21 |
22 class CORE_EXPORT SubresourceIntegrity { | 22 class CORE_EXPORT SubresourceIntegrity { |
23 STATIC_ONLY(SubresourceIntegrity); | 23 STATIC_ONLY(SubresourceIntegrity); |
24 | 24 |
25 public: | 25 public: |
26 enum IntegrityParseResult { | 26 enum IntegrityParseResult { |
27 IntegrityParseValidResult, | 27 IntegrityParseValidResult, |
28 IntegrityParseNoValidResult | 28 IntegrityParseNoValidResult |
29 }; | 29 }; |
30 | 30 |
31 // The versions with the IntegrityMetadataSet passed as the first argument | 31 // The versions with the IntegrityMetadataSet passed as the first argument |
32 // assume that the integrity attribute has already been parsed, and the | 32 // assume that the integrity attribute has already been parsed, and the |
33 // IntegrityMetadataSet represents the result of that parsing. | 33 // IntegrityMetadataSet represents the result of that parsing. |
34 static bool CheckSubresourceIntegrity(const Element&, | 34 static bool CheckSubresourceIntegrity(const String& integrityAttribute, |
| 35 Document&, // the embedding document |
35 const char* content, | 36 const char* content, |
36 size_t, | 37 size_t, |
37 const KURL& resourceUrl, | 38 const KURL& resourceUrl, |
38 const Resource&); | 39 const Resource&); |
39 static bool CheckSubresourceIntegrity(const IntegrityMetadataSet&, | 40 static bool CheckSubresourceIntegrity(const IntegrityMetadataSet&, |
40 const Element&, | 41 Document&, |
41 const char* content, | 42 const char* content, |
42 size_t, | 43 size_t, |
43 const KURL& resourceUrl, | 44 const KURL& resourceUrl, |
44 const Resource&); | 45 const Resource&); |
45 static bool CheckSubresourceIntegrity(const String&, | 46 static bool CheckSubresourceIntegrity(const String&, |
46 const char*, | 47 const char*, |
47 size_t, | 48 size_t, |
48 const KURL& resourceUrl, | 49 const KURL& resourceUrl, |
49 ExecutionContext&, | 50 ExecutionContext&, |
50 WTF::String&); | 51 WTF::String&); |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
82 const UChar* end, | 83 const UChar* end, |
83 HashAlgorithm&); | 84 HashAlgorithm&); |
84 static bool parseDigest(const UChar*& begin, | 85 static bool parseDigest(const UChar*& begin, |
85 const UChar* end, | 86 const UChar* end, |
86 String& digest); | 87 String& digest); |
87 }; | 88 }; |
88 | 89 |
89 } // namespace blink | 90 } // namespace blink |
90 | 91 |
91 #endif | 92 #endif |
OLD | NEW |