| 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 MediaListDirective_h | 5 #ifndef MediaListDirective_h |
| 6 #define MediaListDirective_h | 6 #define MediaListDirective_h |
| 7 | 7 |
| 8 #include "core/frame/csp/CSPDirective.h" | 8 #include "core/frame/csp/CSPDirective.h" |
| 9 #include "platform/network/ContentSecurityPolicyParsers.h" | 9 #include "platform/network/ContentSecurityPolicyParsers.h" |
| 10 #include "wtf/HashSet.h" | 10 #include "wtf/HashSet.h" |
| 11 #include "wtf/text/WTFString.h" | 11 #include "wtf/text/WTFString.h" |
| 12 | 12 |
| 13 namespace blink { | 13 namespace blink { |
| 14 | 14 |
| 15 class ContentSecurityPolicy; | 15 class ContentSecurityPolicy; |
| 16 | 16 |
| 17 class CORE_EXPORT MediaListDirective final : public CSPDirective { | 17 class CORE_EXPORT MediaListDirective final : public CSPDirective { |
| 18 WTF_MAKE_NONCOPYABLE(MediaListDirective); | 18 WTF_MAKE_NONCOPYABLE(MediaListDirective); |
| 19 | 19 |
| 20 public: | 20 public: |
| 21 MediaListDirective(const String& name, | 21 MediaListDirective(const String& name, |
| 22 const String& value, | 22 const String& value, |
| 23 ContentSecurityPolicy*); | 23 ContentSecurityPolicy*); |
| 24 bool allows(const String& type); | 24 bool allows(const String& type) const; |
| 25 | 25 |
| 26 // The algorothm is described more extensively here: | 26 // The algorothm is described more extensively here: |
| 27 // https://w3c.github.io/webappsec-csp/embedded/#subsume-policy. | 27 // https://w3c.github.io/webappsec-csp/embedded/#subsume-policy. |
| 28 bool subsumes(const std::vector<MediaListDirective*>& other); | 28 bool subsumes(const HeapVector<Member<MediaListDirective>>& other) const; |
| 29 | 29 |
| 30 private: | 30 private: |
| 31 FRIEND_TEST_ALL_PREFIXES(MediaListDirectiveTest, GetIntersect); | 31 FRIEND_TEST_ALL_PREFIXES(MediaListDirectiveTest, GetIntersect); |
| 32 FRIEND_TEST_ALL_PREFIXES(MediaListDirectiveTest, Subsumes); | 32 FRIEND_TEST_ALL_PREFIXES(MediaListDirectiveTest, Subsumes); |
| 33 | 33 |
| 34 void parse(const UChar* begin, const UChar* end); | 34 void parse(const UChar* begin, const UChar* end); |
| 35 | 35 |
| 36 // The algorothm is described more extensively here: | 36 // The algorothm is described more extensively here: |
| 37 // https://w3c.github.io/webappsec-csp/embedded/#subsume-policy. | 37 // https://w3c.github.io/webappsec-csp/embedded/#subsume-policy. |
| 38 HashSet<String> getIntersect(const HashSet<String>& other); | 38 HashSet<String> getIntersect(const HashSet<String>& other) const; |
| 39 | 39 |
| 40 HashSet<String> m_pluginTypes; | 40 HashSet<String> m_pluginTypes; |
| 41 }; | 41 }; |
| 42 | 42 |
| 43 } // namespace blink | 43 } // namespace blink |
| 44 | 44 |
| 45 #endif | 45 #endif |
| OLD | NEW |