| 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 "platform/Crypto.h" | 8 #include "platform/Crypto.h" |
| 9 | 9 |
| 10 namespace WTF { | 10 namespace WTF { |
| 11 class String; | 11 class String; |
| 12 }; | 12 }; |
| 13 | 13 |
| 14 namespace blink { | 14 namespace blink { |
| 15 | 15 |
| 16 class Document; | 16 class Document; |
| 17 class Element; | 17 class Element; |
| 18 class KURL; | 18 class KURL; |
| 19 class Resource; |
| 19 | 20 |
| 20 class SubresourceIntegrity { | 21 class SubresourceIntegrity { |
| 21 public: | 22 public: |
| 22 static bool CheckSubresourceIntegrity(const Element&, const WTF::String& con
tent, const KURL& resourceUrl, const WTF::String& mimeType); | 23 static bool CheckSubresourceIntegrity(const Element&, const WTF::String& con
tent, const KURL& resourceUrl, const WTF::String& mimeType, const Resource&); |
| 23 | 24 |
| 24 private: | 25 private: |
| 25 // FIXME: After the merge with the Chromium repo, this should be refactored | 26 // FIXME: After the merge with the Chromium repo, this should be refactored |
| 26 // to use FRIEND_TEST in base/gtest_prod_util.h. | 27 // to use FRIEND_TEST in base/gtest_prod_util.h. |
| 27 friend class SubresourceIntegrityTest; | 28 friend class SubresourceIntegrityTest; |
| 28 | 29 |
| 29 static bool parseAlgorithm(const UChar*& begin, const UChar* end, HashAlgori
thm&); | 30 static bool parseAlgorithm(const UChar*& begin, const UChar* end, HashAlgori
thm&); |
| 30 static bool parseDigest(const UChar*& begin, const UChar* end, String& diges
t); | 31 static bool parseDigest(const UChar*& begin, const UChar* end, String& diges
t); |
| 31 static bool parseMimeType(const UChar*& begin, const UChar* end, String& typ
e); | 32 static bool parseMimeType(const UChar*& begin, const UChar* end, String& typ
e); |
| 32 | 33 |
| 33 static bool parseIntegrityAttribute(const WTF::String& attribute, WTF::Strin
g& integrity, HashAlgorithm&, WTF::String& type, Document&); | 34 static bool parseIntegrityAttribute(const WTF::String& attribute, WTF::Strin
g& integrity, HashAlgorithm&, WTF::String& type, Document&); |
| 34 }; | 35 }; |
| 35 | 36 |
| 36 } // namespace blink | 37 } // namespace blink |
| 37 | 38 |
| 38 #endif | 39 #endif |
| OLD | NEW |