Oilpan: fix build after r202625.
[chromium-blink-merge.git] / third_party / WebKit / Source / core / frame / SubresourceIntegrity.h
blob1a5c3016f6f1784d87ce0babf6f9c6c240d0974a
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
3 // found in the LICENSE file.
5 #ifndef SubresourceIntegrity_h
6 #define SubresourceIntegrity_h
8 #include "core/CoreExport.h"
9 #include "platform/Crypto.h"
10 #include "wtf/Allocator.h"
12 namespace WTF {
13 class String;
16 namespace blink {
18 class Document;
19 class Element;
20 class KURL;
21 class Resource;
23 class CORE_EXPORT SubresourceIntegrity {
24 STATIC_ONLY(SubresourceIntegrity);
25 public:
26 enum IntegrityParseResult {
27 IntegrityParseValidResult,
28 IntegrityParseNoValidResult
31 static bool CheckSubresourceIntegrity(const Element&, const WTF::String& content, const KURL& resourceUrl, const Resource&);
32 static bool CheckSubresourceIntegrity(const String&, const WTF::String& content, const KURL& resourceUrl, Document&, WTF::String&);
34 private:
35 // FIXME: After the merge with the Chromium repo, this should be refactored
36 // to use FRIEND_TEST in base/gtest_prod_util.h.
37 friend class SubresourceIntegrityTest;
38 friend class SubresourceIntegrityTest_Parsing_Test;
39 friend class SubresourceIntegrityTest_ParseAlgorithm_Test;
40 friend class SubresourceIntegrityTest_Prioritization_Test;
42 enum AlgorithmParseResult {
43 AlgorithmValid,
44 AlgorithmUnparsable,
45 AlgorithmUnknown
48 struct IntegrityMetadata {
49 WTF::String digest;
50 HashAlgorithm algorithm;
53 static HashAlgorithm getPrioritizedHashFunction(HashAlgorithm, HashAlgorithm);
54 static AlgorithmParseResult parseAlgorithm(const UChar*& begin, const UChar* end, HashAlgorithm&);
55 static bool parseDigest(const UChar*& begin, const UChar* end, String& digest);
57 static IntegrityParseResult parseIntegrityAttribute(const WTF::String& attribute, WTF::Vector<IntegrityMetadata>& metadataList, Document&);
60 } // namespace blink
62 #endif